Mint price-stable credit

Mint the stable credit you set up

Parameters

Name

Description

Required?

Validation

assetCodeToBeIssued

The asset code of price-stable credit that you want to mint.

Yes

  • Already been setup

  • Correct format (1-7 alphanumeric characters)

collateralAssetCode

The asset code of the collateral that will be used.

Yes

  • Must be VELO

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

GO SDK
GO SDK
package main
import (
"context"
"github.com/velo-protocol/DRSv1/libs/client"
"github.com/velo-protocol/DRSv1/libs/txnbuild"
"log"
)
func main() {
// Init Velo SDK From Trusted Partner Secret Key
client, err := vclient.NewDefaultTestNetClient("testnet-drsv1-0.velo.org", "<TRUSTED PARTNER SECRET KEY>")
if err != nil {
log.Println(err)
return
}
defer func() {
_ = client.Close()
}()
// Using Velo SDK Mint Credit Operation
result, err := client.MintCredit(context.Background(), vtxnbuild.MintCredit{
AssetCodeToBeIssued: "<ASSET CODE FOR ISSUED>", // Ex: vTHB
CollateralAssetCode: "<COLLATERAL ASSET CODE>", // Ex: VELO (Now Supported Only VELO Token)
CollateralAmount: "<COLLATERAL AMOUNT FOR ISSUED>", // Ex: 10
})
if err != nil {
log.Println(err)
return
}
log.Println("Transaction Hash:", result.HorizonResult.TransactionSuccessToString())
// Transaction Hash: 4a3365180521e16b478d9f0c9198b97a9434fc9cb07b34f83ecc32fc54d0ca8a
log.Println("Asset Code To Be Issued: ", result.VeloNodeResult.AssetCodeToBeIssued)
// Asset Code To Be Issued: vTHB
log.Println("Asset Amount To Be Issued: ", result.VeloNodeResult.AssetAmountToBeIssued)
// Asset Amount To Be Issued: 10
log.Println("Asset Issuer To Be Issued: ", result.VeloNodeResult.AssetIssuerToBeIssued)
// Asset Issuer To Be Issued: GCGXZPH2QNKJP4GI2J77EFQQUMP3NYY4PCUZ4UPKHR2XYBKRUYKQ2DS6
log.Println("Asset Distributor To Be Issued: ", result.VeloNodeResult.AssetDistributorToBeIssued)
// Asset Distributor To Be Issued: GCJQGKBCU2GRQ5PDZGQSAD4XPD5754ZIEZQLGOER5SGZ6P6EG6CU4ZN7
log.Println("Collateral Asset Code:", result.VeloNodeResult.CollateralAssetCode)
// Collateral Asset Code: VELO
log.Println("Collateral Amount: ", result.VeloNodeResult.CollateralAmount)
// Collateral Amount: 10
}

Error

SDK
SDK

Description

Message

Response code

Cannot parse XDR

The XDR message cannot be decoded

3

Source account not found in user table or does not have permission to perform minting price-stable credit

The signer is not found or does not have sufficient permission to perform mint price-stable credit

7

Signature and source account does not match

The signature and source account does not match

16

Source account is blank

sourceAccount for the transaction must not be blank

3

Source account format is incorrect

invalid sourceAccount format

3

Cannot contact Stellar

internal server error

13

Cannot get price of pegged currency

cannot get price of pegged currency: no valid price in price account ${account}

9

Cannot get account details

fail to get account detail of ${account}

9

What's next?

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