near logincli command and fill in the information in order to add your account credentials locally and run the rest of the commands.
cdinto the folder, and run the following command, replacing
YOUR_TESTNET_ACCT_IDwith your actual testnet account id.
create_data_request()) to forward a payment bond to the oracle by calling the token contract with the new request payload.
validity_bondthat you must post with the request in order to interact with the oracle. This is in place to deter malicious actors from spamming the oracle with invalid requests, unless they actually wish to lose all of their money to validators. If your request is deemed invalid by the validators, your bond will be kept by the treasury.
Numberwith the value being the multiplier for the number. For example:
data_typefield with the
Stringvalue like this:
tagsto categorize a data request for easier querying later on when the outcome is needed. Tags are very flexible and can be used to group together multiple data request types. In our example, we use an auto-incrementing number to easily associate each data request with it's outcome.
descriptioncan be filled at the of the data being requested, e.g.: “What was the closing price of Bitcoin on the 1st of December 2020?”
outcomesfield. It can also be left empty in case of an arbitrary answer, like from a price feed.
challenge_periodis the window of time for validators to stake on outcomes once the settlement time is reached. This period has a minimum term of 300.000ms (5 minutes) and a maximum term of 86.400.000ms (24 hours).
creatorof the data request, often set automatically by the Request Interface.
sourcessection such that a singular outcome can be found. If you are a protocol that needs to make automated requests, you can do so quite easily by setting up API requests.
sh scripts/request.sh YOUR_TESTNET_ACCOUNT_ID:
description, change the
data_typeand leave the
set_outcomefunction that is called by the oracle. In our sample contract, the outcome is stored in the
data_responseslookup map with the same key (auto-incremented value) as it's corresponding data request.
sh scripts/response.sh YOUR_TESTNET_ACCOUNT_ID NONCEto get the request information and corresponding outcome:
get_data_requestfunction will return
get_data_responsefunction will return