Mint stable credit

Mint the stable credit you set up

Parameters

Name

Description

Required?

Validation

AssetCode

The name of your custom asset.

Yes

  • Unique for trusted partner.

  • Correct format (1-7 alphanumeric characters).

collateralAmount

The amount of collateral that you which to exchange into the stable credit.

Yes

  • Must be a positive number greater than 0 and has less than or equal to 7 decimal places

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)
	}

	result, err := client.MintFromCollateralAmount(context.Background(), &MintFromCollateralAmountInput{
		AssetCode:        "vUSD",
		CollateralAmount: "100",
	})
	if err != nil {
		panic(err)
	}

	log.Println("Mint From Collateral Amount Transaction Hash: ", result.Tx.Hash().String())
	log.Println("Asset Address: ", result.Event.AssetAddress)
	log.Println("Asset Code: ", result.Event.AssetCode)
	log.Println("Collateral Amount: ", result.Event.CollateralAmount)
	log.Println("Collateral Asset Code: ", result.Event.CollateralAssetCode)
	log.Println("Stable Credit Amount: ", result.Event.StableCreditAmount)
}

What's next?

You now have stable credit. Play around with it! When you are ready, you can redeem the collateral back.

Last updated