Rebalancing the Reserve and Collateral Pool

package main

import (
	"context"
	"github.com/velo-protocol/DRSv2_Evrynet/libs/vclient"
	"log"
)

func main() {

  client, err := vclient.NewClient("<evrynet rpc>", "<account private key>", ContractAddress{
		DrsAddress:   "<drs address>",  
		HeartAddress: "<heart address>", 
	})
	
	if err != nil {
		panic(err)
	}

	output, err := client.Rebalance(context.Background(), &RebalanceInput{})
	if err != nil {
		panic(err)
	}

	for index, rebalanceTransaction := range output.RebalanceTransactions {
		fmt.Printf("Event %d Transaction Hashes: %s", index, rebalanceTransaction.Tx.Hash().String())
		fmt.Printf("Event %d Transaction Receipt: %d", index, rebalanceTransaction.Receipt.Status)
		fmt.Printf("Events %d AssetCode: %s", index, rebalanceTransaction.AssetCode)
		fmt.Printf("Events %d CollateralAssetCode: %s", index, rebalanceTransaction.CollateralAssetCode)
		fmt.Printf("Events %d PresentAmount: %s", index, rebalanceTransaction.PresentAmount)
		fmt.Printf("Events %d RequiredAmount: %s", index, rebalanceTransaction.RequiredAmount)
	}
}

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 updated