near login
cli command and fill in the information in order to add your account credentials locally and run the rest of the commands.cd
into the folder, and run the following command, replacing YOUR_TESTNET_ACCT_ID
with 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_bond
that 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.Source
is:DataRequestDataType
is:data_type
field as Number
with the value being the multiplier for the number. For example:data_type
field with the String
value like this:tags
to 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.description
can be filled at the of the data being requested, e.g.: “What was the closing price of Bitcoin on the 1st of December 2020?”outcomes
field. It can also be left empty in case of an arbitrary answer, like from a price feed.challenge_period
is 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).creator
of the data request, often set automatically by the Request Interface.end_point
and source_path
in the sources
section 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_type
and leave the sources
empty.set_outcome
function that is called by the oracle. In our sample contract, the outcome is stored in the data_responses
lookup map with the same key (auto-incremented value) as it's corresponding data request.sh scripts/response.sh YOUR_TESTNET_ACCOUNT_ID NONCE
to get the request information and corresponding outcome:get_data_request
function will return Option<DataRequest>
and the get_data_response
function will return Option<DataResponse>
.