Flux docs
Search…
⌃K

2.2. Data requests

Data requests are created by requesters and stored in a vector with an ID that increments when new ones are created. Everything stored with a data request looks like:
DataRequest {
id: Number, // auto-increments
data_type: String or Number (with multiplier for decimals),
requester: Requester, // creator of this data request
tags: Vec<String>, // used for indexing by requester
description: String, // optional
sources: Vec<Source>, // optional
outcomes: Vec<String>, // optional
resolution_windows: Vector<ResolutionWindow>, // see 1.3.
paid_fee: Balance,
finalized_outcome: Outcome, // either set or unset
global_config_id: Number, // ID of the associated oracle config
initial_challenge_period: Number, // challenge period in seconds for first resolution
final_arbitrator_triggered: True or False
}
Not all of these values are passed when data requests are created -- see 3.1.1 on data creation from the requester side.
Data requests can either be designed to be retrieved from an API(s) or arbitrarily resolved (e.g. the results of a presidential election). Sources are required for API requests while a description is required for an arbitrary request -- only one of the two is required.
Outcomes for data requests can either be a string or a number (also specifying a multiplier value that is used to represent the number of decimal places).
Tags are used for sorting data requests on the requester. For example, on the requester sample contract, a Nonce object auto-increments an integer to associate with each data request it has created. In set_outcome() when the data request is finalized, the oracle passes tags and the requester uses this to associate the outcome with the created data request.