Updating price

For user with account whitelisted as price feeder only

Parameters

Name

Description

Required?

Validation

assetCode

Asset code of the collateral.

Yes

  • Must be VELO

priceInCurrencyPerAssetUnit

Price per unit of collateral in the currency specified.

Yes

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

currency

Currency of the price

Yes

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

GO SDK
GO SDK
package main
import (
"context"
"github.com/velo-protocol/DRSv1/libs/client"
"github.com/velo-protocol/DRSv1/libs/txnbuild"
"github.com/velo-protocol/DRSv1/testkit/helper"
"log"
)
func main() {
// Init Velo SDK From Price Feeder Secret Key
client, err := vclient.NewDefaultTestNetClient("testnet-drsv1-0.velo.org", "<PRICE FEEDER SECRET KEY>")
if err != nil {
panic(err)
}
defer func() {
_ = client.Close()
}()
// Using Velo SDK Price Update Operation
result, err := client.PriceUpdate(context.Background(), vtxnbuild.PriceUpdate{
Asset: "<COLLATERAL ASSET CODE>", // Ex: VELO
Currency: "<CURRENCY>", // Ex: THB
PriceInCurrencyPerAssetUnit: "<PRICE>", // Ex: 0.5
})
if err != nil {
panic(err)
}
log.Println("Transaction Hash: ":, result.HorizonResult.TransactionSuccessToString())
log.Println("Collateral Code: ", result.VeloNodeResult.CollateralCode)
log.Println("Currency: ", result.VeloNodeResult.Currency)
log.Println("Price In Currency Per Asset Unit: ", result.VeloNodeResult.PriceInCurrencyPerAssetUnit)
}

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

Price feeder is not allowed to feed price for the specified currency

currency must match with the registered currency

7