Skip to content

📃 WitnetRequestTemplateConsumer

Solidity wizard

Constructor

ParametersTypeDescription
_witnetRequestTemplateWitnetRequestTemplateAddress of the WitnetRequestTemplatefrom which concrete data requests will get built from this contract.
_baseFeeOverheadPercentageuint16Percentage over base fee to pay when querying new data updates.
_callbackGasLimituint24Maximum gas expected to be spent by the callback methods.

Modifiers

ModifierDescription
onlyFromWitnetTo be added on callback methods for attending query results from the Wit/Oracle.
witnetQuerySolved(uint256 queryId)Provides a convenient way for consuming contracts to block execution of the contract's logic until a particular randomness query gets ultimately reported from the Wit/Oracle blockchain.

Properties

NameVisibilityDescription
dataRequestTemplateImmutable publicAddress of the WitnetRequestTemplatepassed in constructor.
__witnetImmutable internalAddress of the WitnetOracleinstance to directly interact with.
__witnetBaseFeeOverheadPercentageInternalPercentage over base fee to pay when querying new data updates. Defaults to 33%.
__witnetCallbackGasLimitInternalMaximum gas expected to be spent by the callback methods.
__witnetDefaultSLAInternalDefault Service Level Agreement parameters to be fulfilled by the Wit/Oracle blockchain when solving data updates.

Internal methods

MethodsDescription
_witnetBuildRadHash(string[][])Creates a unique RAD hash that identifies the resulting Radon Request after applying the given parameters to the dataRequestTemplate.
__witnetBuildRequest(string[][])Creates a counter-factual WitnetRequest instance that contains the resulting RAdon Request after applying the given parameters to the dataRequestTemplate.
_witnetCheckQueryResponseStatus(uint256)Check current WitnetV2.ResponseStatus of the specified query.
_witnetCheckQueryResultAvailability(uint256)Check if the specified query was already reported back from the Wit/Oracle blockchain.
_witnetCheckQueryResultError(uint256)Get detailed Witnet.ResultError for the specified query.
_witnetEstimateEvmReward()Estimate the minimum reward required for posting a data request, using tx.gasprice as a reference.
__witnetRequestData(uint256,string[][])Query the Wit/Oracle to solve the resulting Radon Request after applying the given parameters to the dataRequestTemplate, specifying also how much fee to pay out from this contract's balance.
__witnetRequestData(u256,string[][],RadonSLA)Query the Wit/Oracle to solve the resulting Radon Request after applying the given parameters to the dataRequestTemplate, specifying how much fee to pay and the SLA parameters to be fulfilled by the Wit/Oracle blockchain.

Events

EventsArgumentsDescription
WitnetQuery

address evmRequester

uint256 evmGasPrice

uint256 evmReward

uint256 queryId

bytes32 queryRadHash

RadonSLA querySLA

Emitted every time a new randomize query gets posted to the WitnetOracle contract.
WitnetQueryUpgrade

uint256 queryId

address evmSender

uint256 evmGasPrice

uint256 evmReward

Emitted if the EVM reward for solving a previously posted randomize is increased by anyone in any amount.