Flux docs
Search…
⌃K

3.1.1 create_data_request()

create_data_request calls new() on the oracle with a validity bond attached and a payload with the structure:
NewDataRequestArgs {
sources: Vec<Source>, // optional
tags: Vec<String>, // optional
description: String, // optional
outcomes: Vec<String>, // optional
challenge_period: Number (seconds),
data_type: Number (specifying decimals) or String,
}
tags is an important field which allows for requesters to label data requests before they are created. For example, the requester sample contract uses an auto-incrementing nonce value as a tag to track the creation of data requests. If a requester wants to implement custom payout logic for a validity bond (e.g. a user pays for the validity bond during data request creation rather than the requester), tags would be the way to do so by passing the address of the data request creator.
If sources is not populated, description must be populated, and vice versa, since a populated sources field indicates that the data request can be resolved by API data while a description typically indicates a data request to be resolved arbitrarily.