Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add OracleSet transaction #17

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions shared/requests/submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,11 @@ components:
propertyName: TransactionType
mapping:
Payment: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1'
OracleSet: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
# TODO: Add other transaction types here
oneOf:
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransactionV1'
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
# TODO: Add other transaction types here

SubmitSuccessResponseV2:
Expand All @@ -193,6 +195,7 @@ components:
type: string
oneOf:
- $ref: '../base.yaml#/components/schemas/UniversalErrorResponseCodes'
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetErrorCode'
- enum:
- amendmentBlocked
- highFee
Expand Down
101 changes: 101 additions & 0 deletions shared/transactions/oracle_set.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
components:
schemas:
OracleSetTransaction:
$id: OracleSetTransaction
type: object
required:
- Account
- OracleDocumentID
- LastUpdateTime
- PriceDataSeries
allOf:
- $ref: '../base.yaml#/components/schemas/BaseTransaction'
properties:
Account:
type: string
description: The account ID that must match the account in the Owner field of the Oracle object.
OracleDocumentID:
type: integer
description: A unique identifier of the price oracle for the Account.
Provider:
type: string
description: |
An arbitrary value identifying an oracle provider, such as Chainlink, Band, or DIA.
This field is a string, up to 256 ASCII hex-encoded characters (0x20-0x7E).
Required when creating a new Oracle ledger entry, but optional for updates.
maxLength: 256
URI:
type: string
description: |
An optional Universal Resource Identifier (URI) to reference price data off-chain.
Limited to 256 bytes.
maxLength: 256
LastUpdateTime:
type: integer
description: |
The timestamp indicating the last time the data was updated,
in seconds since the UNIX Epoch.
AssetClass:
type: string
description: |
Describes the type of asset, such as "currency", "commodity", or "index".
This field is a string, up to 16 ASCII hex-encoded characters (0x20-0x7E).
Required when creating a new Oracle ledger entry, but optional for updates.
maxLength: 16
PriceDataSeries:
type: array
description: An array of up to 10 PriceData objects, each representing price information for a token pair.
maxItems: 10
minItems: 1
items:
$ref: '#/components/schemas/PriceData'

PriceData:
$id: PriceData
type: object
required:
- BaseAsset
- QuoteAsset
properties:
BaseAsset:
type: string
description: |
The primary asset in a trading pair (e.g., BTC in BTC/USD).
Any valid identifier, such as a stock symbol, bond CUSIP, or currency code, is allowed.
QuoteAsset:
type: string
description: |
The quote asset in a trading pair, denoting the price of one unit of the base asset (e.g., USD in BTC/USD).
AssetPrice:
type: string
description: |
The asset price after applying the Scale precision level.
Recommended to be provided as a hexadecimal, but decimal numbers are accepted.
Not included if the last update transaction didn't include the BaseAsset/QuoteAsset pair.
Scale:
type: integer
description: |
The scaling factor to apply to an asset price. If Scale is 6 and the original price is 0.155,
then the scaled price is 155000. Valid scale ranges are 0-10.
Not included if the last update transaction didn't include the BaseAsset/QuoteAsset pair.
minimum: 0
maximum: 10
x-custom-validation:
mutualPresence:
- field1: AssetPrice
field2: Scale

OracleSetErrorCode:
$id: OracleSetErrorCode
enum:
- temARRAY_EMPTY
- tecARRAY_TOO_LARGE
- tecINVALID_UPDATE_TIME
- tecTOKEN_PAIR_NOT_FOUND
- temARRAY_TOO_LARGE
description: >
* `temARRAY_EMPTY` - The PriceDataSeries has no PriceData objects.
* `tecARRAY_TOO_LARGE` - The PriceDataSeries exceeds the ten PriceData objects limit.
* `tecINVALID_UPDATE_TIME` - The Oracle object has an invalid LastUpdateTime value.
* `tecTOKEN_PAIR_NOT_FOUND` - The token pair you're trying to delete doesn't exist in the Oracle object.
* `temARRAY_TOO_LARGE` - The PriceDataSeries exceeds the ten PriceData objects limit.
Loading