Velo-Protocol
Search…
Rebalancing the Reserve and Collateral Pool
GO SDK
1
package main
2
​
3
import (
4
"context"
5
"github.com/velo-protocol/DRSv2_Evrynet/libs/vclient"
6
"log"
7
)
8
​
9
func main() {
10
​
11
client, err := vclient.NewClient("<evrynet rpc>", "<account private key>", ContractAddress{
12
DrsAddress: "<drs address>",
13
HeartAddress: "<heart address>",
14
})
15
16
if err != nil {
17
panic(err)
18
}
19
​
20
output, err := client.Rebalance(context.Background(), &RebalanceInput{})
21
if err != nil {
22
panic(err)
23
}
24
​
25
for index, rebalanceTransaction := range output.RebalanceTransactions {
26
fmt.Printf("Event %d Transaction Hashes: %s", index, rebalanceTransaction.Tx.Hash().String())
27
fmt.Printf("Event %d Transaction Receipt: %d", index, rebalanceTransaction.Receipt.Status)
28
fmt.Printf("Events %d AssetCode: %s", index, rebalanceTransaction.AssetCode)
29
fmt.Printf("Events %d CollateralAssetCode: %s", index, rebalanceTransaction.CollateralAssetCode)
30
fmt.Printf("Events %d PresentAmount: %s", index, rebalanceTransaction.PresentAmount)
31
fmt.Printf("Events %d RequiredAmount: %s", index, rebalanceTransaction.RequiredAmount)
32
}
33
}
34
​
Copied!
​

What's next?

That's it! If you have gone through this document step-by-step from setup through to rebalance, you have mastered Velo.
Last modified 1yr ago
Copy link
Contents
What's next?