Skip to content

OracleSet

[Source]

(Added by the PriceOracle amendment.)

{
"TransactionType": "OracleSet",
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"OracleDocumentID": 1,
"Provider": "70726F7669646572",
"AssetClass": "63757272656E6379",
"LastUpdateTime": 1763033559,
"PriceDataSeries": [
{
"PriceData": {
"BaseAsset": "XAH",
"QuoteAsset": "USD",
"AssetPrice": 74560,
"Scale": 4
}
}
]
}
{
"TransactionType": "OracleSet",
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
"OracleDocumentID": 1,
"LastUpdateTime": 1763033700,
"PriceDataSeries": [
{
"PriceData": {
"BaseAsset": "XAH",
"QuoteAsset": "USD",
"AssetPrice": 74800,
"Scale": 4
}
}
]
}
FieldJSON TypeInternal TypeDescription
AccountStringAccountIDThe address of the account creating or updating the Oracle. Only this account can later update or delete the object.
OracleDocumentIDNumberUInt32A unique identifier for this Oracle within the owner account. Multiple Oracles can exist per account using different IDs.
ProviderStringBlob(Optional on update; required on create) Hex-encoded identifier of the Oracle provider (e.g. Chainlink, Band). Max 256 bytes.
URIStringBlob(Optional) Hex-encoded URI referencing supplementary off-chain data for this Oracle (e.g. IPFS CID). Max 256 bytes.
AssetClassStringBlob(Optional on update; required on create) Hex-encoded category describing the type of assets (e.g. 63757272656E6379 = “currency”). Max 16 bytes.
LastUpdateTimeNumberUInt32Unix timestamp (seconds since January 1, 1970) of the last price update. Must be within ±300 seconds of the ledger close time and must be strictly greater than the current stored value on updates.
PriceDataSeriesArrayArrayArray of PriceData objects. Must contain between 1 and 10 entries. On update, pairs without AssetPrice are deleted from the object.

Each entry in PriceDataSeries is a PriceData object:

FieldJSON TypeInternal TypeDescription
BaseAssetStringCurrencyThe asset being priced (e.g. "XAH", "BTC").
QuoteAssetStringCurrencyThe denomination currency (e.g. "USD", "EUR"). Must differ from BaseAsset.
AssetPriceNumberUInt64(Optional) The price as a scaled integer. The effective price is AssetPrice × 10^(-Scale). Omit this field to delete an existing pair during an update.
ScaleNumberUInt8(Optional) Decimal exponent used to derive the effective price. Valid values: 0–10. Default: 0. Example: AssetPrice = 74560, Scale = 4 → effective price = 7.456.

OracleSet transactions consume owner reserves depending on the number of PriceData pairs stored:

PairsOwner reserves consumed
1–51
6–102

If an update changes the number of pairs across the 5-pair threshold, the owner count is adjusted automatically (±1).

OracleSet transactions have the standard transaction cost.

Error CodeDescription
temDISABLEDThe PriceOracle amendment is not enabled.
temINVALID_FLAGInvalid flags specified.
temMALFORMEDProvider, URI, or AssetClass is empty or exceeds max length; duplicate base/quote pairs in the same transaction; BaseAsset equals QuoteAsset; Scale > 10; Provider or AssetClass do not match stored values on update; Provider or AssetClass missing on create.
temARRAY_EMPTYPriceDataSeries is empty.
temARRAY_TOO_LARGEPriceDataSeries contains more than 10 entries in the transaction.
terNO_ACCOUNTThe sending account does not exist.
tecINVALID_UPDATE_TIMELastUpdateTime is outside the ±300 second window from ledger close time, predates the UNIX timestamp (seconds since January 1, 1970), or is not strictly greater than the stored value on an update.
tecTOKEN_PAIR_NOT_FOUNDA pair specified for deletion (no AssetPrice) does not exist in the current Oracle object.
tecARRAY_EMPTYThe result after applying all updates and deletions would leave PriceDataSeries empty.
tecARRAY_TOO_LARGEThe result after applying all updates and additions would exceed 10 entries.
tecINSUFFICIENT_RESERVEThe account does not have enough XAH to meet the reserve requirement for creating the Oracle object.