Data transaction to set token negotiation value


#1

How do I json the transaction data to set the trading value when using the code below to create a smart asset?

This token can be bought/sold for WAVES only at a rate published by
asset issuer.
The issuer publishes the exchange rate with a data transaction on his
account. The actual exchange rate must match the published rate up to
7th significant digit.

let issuer = Address(base58’3issuerAddress’)
let assetId = base58’ThisAsset1d’
match tx {
case ex: ExchangeTransaction =>
let pair = AssetPair(assetId, unit)
let rate = extract(getInteger(issuer, “exchangeRate”))
let rateDiff = rate - fraction(100000000, ex.price, ex.amount)
ex.buyOrder.assetPair == pair && rateDiff > -100 && rateDiff < 100
case _ => true
}


#2

Descobri ao ver um tutorial no YouTube :slight_smile:

{
“type”: 12,
“version”: 1,
“fee”: 100000,
“data”: [
{
“type”: “integer”,
“key”: “exchangeRate”,
“value”: 100
}
]
}