Setup price-stable credit

Inception of price stable credit

Parameters

In Testnet, we only support 3 currencies; SGD, THB and USD

Name

Description

Required?

Validation

assetCode

The name of your custom asset.

Yes

  • Unique for trusted partner.

  • Correct format (1-7 alphanumeric characters).

peggedCurrency

The currency you want to pegged this asset to.

Yes

  • Must be in [SGD, THB, USD].

peggedValue

The ratio of currency value vs 1 unit of custom asset.

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 Setup Credit Operation
result, err := client.SetupCredit(context.Background(), vtxnbuild.SetupCredit{
PeggedValue: "<PEGGED VALUE OF STABLE CREDIT>", // Ex: 1.0
PeggedCurrency: "<PEGGED CURRENCY OF STABLE CREDIT>", // Ex: THB
AssetCode: "<ASSET CODE OF STABLE CREDIT>", // Ex: vTHB
})
if err != nil {
log.Println(err)
return
}
log.Println("Transaction Hash: ", result.HorizonResult.TransactionSuccessToString())
// Transaction Hash: 4a3365180521e16b478d9f0c9198b97a9434fc9cb07b34f83ecc32fc54d0ca8a
log.Println("Pegged Currency: ", result.VeloNodeResult.PeggedCurrency)
// Pegged Currency: THB
log.Println("Pegged Value: ", result.VeloNodeResult.PeggedValue)
// Pegged Value: 1.0
log.Println("Asset Code: ", result.VeloNodeResult.AssetCode)
// Asset Code: vTHB
log.Println("Asset Issuer: ", result.VeloNodeResult.AssetIssuer)
// Asset Issuer: GCGXZPH2QNKJP4GI2J77EFQQUMP3NYY4PCUZ4UPKHR2XYBKRUYKQ2DS6
log.Println("Asset Distributor: ", result.VeloNodeResult.AssetDistributor)
// Asset Distributor: GDGEQS64ISS6Y2KDM5V67B6LXALJX4E7VE4MIA54NANSUX5MKGKBZM5G
}

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 setup credit issuance

The signer is not found or does not have sufficient permission to perform setup credit issuance

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 connect to Stellar

Internal server error

13

What's next?

Now that you have set up your stable credit, go to Mint price-stable credit to mint it into existence!