witnet-solidity-bridge
Version:
Witnet Solidity Bridge contracts for EVM-compatible chains
856 lines (855 loc) • 127 kB
JSON
{
"contractName": "IWitnetOracle",
"abi": [
{
"inputs": [
{
"internalType": "uint256",
"name": "gasPrice",
"type": "uint256"
},
{
"internalType": "uint16",
"name": "resultMaxSize",
"type": "uint16"
}
],
"name": "estimateBaseFee",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gasPrice",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "radHash",
"type": "bytes32"
}
],
"name": "estimateBaseFee",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gasPrice",
"type": "uint256"
},
{
"internalType": "uint24",
"name": "callbackGasLimit",
"type": "uint24"
}
],
"name": "estimateBaseFeeWithCallback",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"name": "fetchQueryResponse",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "reporter",
"type": "address"
},
{
"internalType": "uint64",
"name": "finality",
"type": "uint64"
},
{
"internalType": "uint32",
"name": "resultTimestamp",
"type": "uint32"
},
{
"internalType": "bytes32",
"name": "resultTallyHash",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "resultCborBytes",
"type": "bytes"
}
],
"internalType": "struct WitnetV2.Response",
"name": "",
"type": "tuple"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"name": "getQuery",
"outputs": [
{
"components": [
{
"components": [
{
"internalType": "address",
"name": "requester",
"type": "address"
},
{
"internalType": "uint24",
"name": "gasCallback",
"type": "uint24"
},
{
"internalType": "uint72",
"name": "evmReward",
"type": "uint72"
},
{
"internalType": "bytes",
"name": "witnetBytecode",
"type": "bytes"
},
{
"internalType": "bytes32",
"name": "witnetRAD",
"type": "bytes32"
},
{
"components": [
{
"internalType": "uint8",
"name": "committeeSize",
"type": "uint8"
},
{
"internalType": "uint64",
"name": "witnessingFeeNanoWit",
"type": "uint64"
}
],
"internalType": "struct WitnetV2.RadonSLA",
"name": "witnetSLA",
"type": "tuple"
}
],
"internalType": "struct WitnetV2.Request",
"name": "request",
"type": "tuple"
},
{
"components": [
{
"internalType": "address",
"name": "reporter",
"type": "address"
},
{
"internalType": "uint64",
"name": "finality",
"type": "uint64"
},
{
"internalType": "uint32",
"name": "resultTimestamp",
"type": "uint32"
},
{
"internalType": "bytes32",
"name": "resultTallyHash",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "resultCborBytes",
"type": "bytes"
}
],
"internalType": "struct WitnetV2.Response",
"name": "response",
"type": "tuple"
}
],
"internalType": "struct WitnetV2.Query",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"name": "getQueryEvmReward",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"name": "getQueryRequest",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "requester",
"type": "address"
},
{
"internalType": "uint24",
"name": "gasCallback",
"type": "uint24"
},
{
"internalType": "uint72",
"name": "evmReward",
"type": "uint72"
},
{
"internalType": "bytes",
"name": "witnetBytecode",
"type": "bytes"
},
{
"internalType": "bytes32",
"name": "witnetRAD",
"type": "bytes32"
},
{
"components": [
{
"internalType": "uint8",
"name": "committeeSize",
"type": "uint8"
},
{
"internalType": "uint64",
"name": "witnessingFeeNanoWit",
"type": "uint64"
}
],
"internalType": "struct WitnetV2.RadonSLA",
"name": "witnetSLA",
"type": "tuple"
}
],
"internalType": "struct WitnetV2.Request",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"name": "getQueryResponse",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "reporter",
"type": "address"
},
{
"internalType": "uint64",
"name": "finality",
"type": "uint64"
},
{
"internalType": "uint32",
"name": "resultTimestamp",
"type": "uint32"
},
{
"internalType": "bytes32",
"name": "resultTallyHash",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "resultCborBytes",
"type": "bytes"
}
],
"internalType": "struct WitnetV2.Response",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"name": "getQueryResponseStatus",
"outputs": [
{
"internalType": "enum WitnetV2.ResponseStatus",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"name": "getQueryResultCborBytes",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"name": "getQueryResultError",
"outputs": [
{
"components": [
{
"internalType": "enum Witnet.ResultErrorCodes",
"name": "code",
"type": "uint8"
},
{
"internalType": "string",
"name": "reason",
"type": "string"
}
],
"internalType": "struct Witnet.ResultError",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"name": "getQueryStatus",
"outputs": [
{
"internalType": "enum WitnetV2.QueryStatus",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256[]",
"name": "queryIds",
"type": "uint256[]"
}
],
"name": "getQueryStatusBatch",
"outputs": [
{
"internalType": "enum WitnetV2.QueryStatus[]",
"name": "",
"type": "uint8[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getNextQueryId",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "queryRAD",
"type": "bytes32"
},
{
"components": [
{
"internalType": "uint8",
"name": "committeeSize",
"type": "uint8"
},
{
"internalType": "uint64",
"name": "witnessingFeeNanoWit",
"type": "uint64"
}
],
"internalType": "struct WitnetV2.RadonSLA",
"name": "querySLA",
"type": "tuple"
}
],
"name": "postRequest",
"outputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "queryUnverifiedBytecode",
"type": "bytes"
},
{
"components": [
{
"internalType": "uint8",
"name": "committeeSize",
"type": "uint8"
},
{
"internalType": "uint64",
"name": "witnessingFeeNanoWit",
"type": "uint64"
}
],
"internalType": "struct WitnetV2.RadonSLA",
"name": "querySLA",
"type": "tuple"
},
{
"internalType": "uint24",
"name": "queryCallbackGasLimit",
"type": "uint24"
}
],
"name": "postRequestWithCallback",
"outputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "queryRAD",
"type": "bytes32"
},
{
"components": [
{
"internalType": "uint8",
"name": "committeeSize",
"type": "uint8"
},
{
"internalType": "uint64",
"name": "witnessingFeeNanoWit",
"type": "uint64"
}
],
"internalType": "struct WitnetV2.RadonSLA",
"name": "querySLA",
"type": "tuple"
},
{
"internalType": "uint24",
"name": "queryCallbackGasLimit",
"type": "uint24"
}
],
"name": "postRequestWithCallback",
"outputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "queryId",
"type": "uint256"
}
],
"name": "upgradeQueryEvmReward",
"outputs": [],
"stateMutability": "payable",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint16\",\"name\":\"resultMaxSize\",\"type\":\"uint16\"}],\"name\":\"estimateBaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasPrice\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"radHash\",\"type\":\"bytes32\"}],\"name\":\"estimateBaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint24\",\"name\":\"callbackGasLimit\",\"type\":\"uint24\"}],\"name\":\"estimateBaseFeeWithCallback\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"name\":\"fetchQueryResponse\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"reporter\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"finality\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"resultTimestamp\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"resultTallyHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"resultCborBytes\",\"type\":\"bytes\"}],\"internalType\":\"struct WitnetV2.Response\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNextQueryId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"name\":\"getQuery\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"internalType\":\"uint24\",\"name\":\"gasCallback\",\"type\":\"uint24\"},{\"internalType\":\"uint72\",\"name\":\"evmReward\",\"type\":\"uint72\"},{\"internalType\":\"bytes\",\"name\":\"witnetBytecode\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"witnetRAD\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"committeeSize\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"witnessingFeeNanoWit\",\"type\":\"uint64\"}],\"internalType\":\"struct WitnetV2.RadonSLA\",\"name\":\"witnetSLA\",\"type\":\"tuple\"}],\"internalType\":\"struct WitnetV2.Request\",\"name\":\"request\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"reporter\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"finality\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"resultTimestamp\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"resultTallyHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"resultCborBytes\",\"type\":\"bytes\"}],\"internalType\":\"struct WitnetV2.Response\",\"name\":\"response\",\"type\":\"tuple\"}],\"internalType\":\"struct WitnetV2.Query\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"name\":\"getQueryEvmReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"name\":\"getQueryRequest\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"},{\"internalType\":\"uint24\",\"name\":\"gasCallback\",\"type\":\"uint24\"},{\"internalType\":\"uint72\",\"name\":\"evmReward\",\"type\":\"uint72\"},{\"internalType\":\"bytes\",\"name\":\"witnetBytecode\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"witnetRAD\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"committeeSize\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"witnessingFeeNanoWit\",\"type\":\"uint64\"}],\"internalType\":\"struct WitnetV2.RadonSLA\",\"name\":\"witnetSLA\",\"type\":\"tuple\"}],\"internalType\":\"struct WitnetV2.Request\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"name\":\"getQueryResponse\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"reporter\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"finality\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"resultTimestamp\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"resultTallyHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"resultCborBytes\",\"type\":\"bytes\"}],\"internalType\":\"struct WitnetV2.Response\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"name\":\"getQueryResponseStatus\",\"outputs\":[{\"internalType\":\"enum WitnetV2.ResponseStatus\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"name\":\"getQueryResultCborBytes\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"name\":\"getQueryResultError\",\"outputs\":[{\"components\":[{\"internalType\":\"enum Witnet.ResultErrorCodes\",\"name\":\"code\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"internalType\":\"struct Witnet.ResultError\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"name\":\"getQueryStatus\",\"outputs\":[{\"internalType\":\"enum WitnetV2.QueryStatus\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"queryIds\",\"type\":\"uint256[]\"}],\"name\":\"getQueryStatusBatch\",\"outputs\":[{\"internalType\":\"enum WitnetV2.QueryStatus[]\",\"name\":\"\",\"type\":\"uint8[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"queryRAD\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"committeeSize\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"witnessingFeeNanoWit\",\"type\":\"uint64\"}],\"internalType\":\"struct WitnetV2.RadonSLA\",\"name\":\"querySLA\",\"type\":\"tuple\"}],\"name\":\"postRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"queryUnverifiedBytecode\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"committeeSize\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"witnessingFeeNanoWit\",\"type\":\"uint64\"}],\"internalType\":\"struct WitnetV2.RadonSLA\",\"name\":\"querySLA\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"queryCallbackGasLimit\",\"type\":\"uint24\"}],\"name\":\"postRequestWithCallback\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"queryRAD\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"committeeSize\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"witnessingFeeNanoWit\",\"type\":\"uint64\"}],\"internalType\":\"struct WitnetV2.RadonSLA\",\"name\":\"querySLA\",\"type\":\"tuple\"},{\"internalType\":\"uint24\",\"name\":\"queryCallbackGasLimit\",\"type\":\"uint24\"}],\"name\":\"postRequestWithCallback\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"queryId\",\"type\":\"uint256\"}],\"name\":\"upgradeQueryEvmReward\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"estimateBaseFee(uint256,bytes32)\":{\"details\":\"Fails if the RAD hash was not previously verified on the WitnetRequestBytecodes registry.\",\"params\":{\"gasPrice\":\"Expected gas price to pay upon posting the data request.\",\"radHash\":\"The RAD hash of the data request to be solved by Witnet.\"}},\"estimateBaseFee(uint256,uint16)\":{\"details\":\"Underestimates if the size of returned data is greater than `resultMaxSize`. \",\"params\":{\"gasPrice\":\"Expected gas price to pay upon posting the data request.\",\"resultMaxSize\":\"Maximum expected size of returned data (in bytes). \"}},\"estimateBaseFeeWithCallback(uint256,uint24)\":{\"params\":{\"callbackGasLimit\":\"Maximum gas to be spent when reporting the data request result.\",\"gasPrice\":\"Expected gas price to pay upon posting the data request.\"}},\"fetchQueryResponse(uint256)\":{\"details\":\"Fails if the query was not in 'Reported' status, or called from an address different tothe one that actually posted the given request.\",\"params\":{\"queryId\":\"The unique query identifier.\"}},\"getQueryRequest(uint256)\":{\"params\":{\"queryId\":\"The unique query identifier.\"}},\"getQueryResponse(uint256)\":{\"params\":{\"queryId\":\"The unique query identifier.\"}},\"getQueryResponseStatus(uint256)\":{\"params\":{\"queryId\":\"The unique query identifier.\"}},\"getQueryResultCborBytes(uint256)\":{\"params\":{\"queryId\":\"The unique query identifier.\"}},\"getQueryResultError(uint256)\":{\"params\":{\"queryId\":\"The unique query identifier.\"}},\"postRequest(bytes32,(uint8,uint64))\":{\"details\":\"Reasons to fail:- the RAD hash was not previously verified by the WitnetRequestBytecodes registry;- invalid SLA parameters were provided;- insufficient value is paid as reward.\",\"params\":{\"queryRAD\":\"The RAD hash of the data request to be solved by Witnet.\",\"querySLA\":\"The data query SLA to be fulfilled on the Witnet blockchain.\"},\"returns\":{\"queryId\":\"Unique query identifier.\"}},\"postRequestWithCallback(bytes,(uint8,uint64),uint24)\":{\"details\":\"Reasons to fail:- the caller is not a contract implementing the IWitnetConsumer interface;- the provided bytecode is empty;- invalid SLA parameters were provided;- insufficient value is paid as reward.\",\"params\":{\"queryCallbackGasLimit\":\"Maximum gas to be spent when reporting the data request result.\",\"querySLA\":\"The data query SLA to be fulfilled on the Witnet blockchain.\",\"queryUnverifiedBytecode\":\"The (unverified) bytecode containing the actual data request to be solved by the Witnet blockchain.\"},\"returns\":{\"queryId\":\"Unique query identifier.\"}},\"postRequestWithCallback(bytes32,(uint8,uint64),uint24)\":{\"details\":\"Reasons to fail:- the caller is not a contract implementing the IWitnetConsumer interface;- the RAD hash was not previously verified by the WitnetRequestBytecodes registry;- invalid SLA parameters were provided;- insufficient value is paid as reward.\",\"params\":{\"queryCallbackGasLimit\":\"Maximum gas to be spent when reporting the data request result.\",\"queryRAD\":\"The RAD hash of the data request to be solved by Witnet.\",\"querySLA\":\"The data query SLA to be fulfilled on the Witnet blockchain.\"},\"returns\":{\"queryId\":\"Unique query identifier.\"}},\"upgradeQueryEvmReward(uint256)\":{\"params\":{\"queryId\":\"The unique query identifier.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"estimateBaseFee(uint256,bytes32)\":{\"notice\":\"Estimate the minimum reward required for posting a data request.\"},\"estimateBaseFee(uint256,uint16)\":{\"notice\":\"Estimate the minimum reward required for posting a data request.\"},\"estimateBaseFeeWithCallback(uint256,uint24)\":{\"notice\":\"Estimate the minimum reward required for posting a data request with a callback.\"},\"fetchQueryResponse(uint256)\":{\"notice\":\"Retrieves a copy of all Witnet-provable data related to a previously posted request, removing the whole query from the WRB storage.\"},\"getNextQueryId()\":{\"notice\":\"Returns next query id to be generated by the Witnet Request Board.\"},\"getQuery(uint256)\":{\"notice\":\"Gets the whole Query data contents, if any, no matter its current status.\"},\"getQueryEvmReward(uint256)\":{\"notice\":\"Gets the current EVM reward the report can claim, if not done yet.\"},\"getQueryRequest(uint256)\":{\"notice\":\"Retrieves the RAD hash and SLA parameters of the given query.\"},\"getQueryResponse(uint256)\":{\"notice\":\"Retrieves the whole `Witnet.Response` record referred to a previously posted Witnet Data Request.\"},\"getQueryResponseStatus(uint256)\":{\"notice\":\"Returns query's result current status from a requester's point of view:- 0 => Void: the query is either non-existent or deleted;- 1 => Awaiting: the query has not yet been reported;- 2 => Ready: the query response was finalized, and contains a result with no erros.- 3 => Error: the query response was finalized, and contains a result with errors.\"},\"getQueryResultCborBytes(uint256)\":{\"notice\":\"Retrieves the CBOR-encoded buffer containing the Witnet-provided result to the given query.\"},\"getQueryResultError(uint256)\":{\"notice\":\"Gets error code identifying some possible failure on the resolution of the given query.\"},\"getQueryStatus(uint256)\":{\"notice\":\"Gets current status of given query.\"},\"getQueryStatusBatch(uint256[])\":{\"notice\":\"Get current status of all given query ids.\"},\"postRequest(bytes32,(uint8,uint64))\":{\"notice\":\"Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the reporter who relays back the Witnet-provable result to this request.\"},\"postRequestWithCallback(bytes,(uint8,uint64),uint24)\":{\"notice\":\"Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the reporter who relays back the Witnet-provable result to this request. The Witnet-provable result will be reporteddirectly to the requesting contract. If the report callback fails for any reason, a `WitnetQueryResponseDeliveryFailed`event will be triggered, and the Witnet audit trail will be saved in storage, but not so the CBOR-encoded result.\"},\"postRequestWithCallback(bytes32,(uint8,uint64),uint24)\":{\"notice\":\"Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the reporter who relays back the Witnet-provable result to this request. The Witnet-provable result will be reporteddirectly to the requesting contract. If the report callback fails for any reason, an `WitnetQueryResponseDeliveryFailed`will be triggered, and the Witnet audit trail will be saved in storage, but not so the actual CBOR-encoded result.\"},\"upgradeQueryEvmReward(uint256)\":{\"notice\":\"Increments the reward of a previously posted request by adding the transaction value to it.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/interfaces/IWitnetOracle.sol\":\"IWitnetOracle\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/interfaces/IWitnetOracle.sol\":{\"keccak256\":\"0x5dbb04fce5e05675325232a735c46617378982b48dac2138aca0c6cc95e6e4d5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7447a70455478239500e16aebe5dce6676dc86307d22f662761d8e9f7c5d1276\",\"dweb:/ipfs/QmVkvA4Mt6G1JXxE8ebxKGAjT1WvNbp5QMKg9sUKdrJjhv\"]},\"project:/contracts/libs/Witnet.sol\":{\"keccak256\":\"0x65a87375dd79d63a83fb454b7199b6c999bd59c50b3b59d521c5c4d45a7d3cc3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ca865b681d810c2fc5c3672ea6343c3bdf6fd71764ab824d25994744dc85866b\",\"dweb:/ipfs/QmPGcP3xGTNZfsQ9GSKdujNLRVs8dWDdubyUko1rbQqJNv\"]},\"project:/contracts/libs/WitnetBuffer.sol\":{\"keccak256\":\"0xa14570492eb5a313ddbacae0185c850ec99c67211eb33989a5e21d31bf06a150\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e83c11edb49cab6a767c0b685825bc22ece0d3d2897e0d54fe1923df5cc76ba5\",\"dweb:/ipfs/QmdLDgCc3tnKbgRrXwfNzsg6uUDirNmjvBB8V3iMmnD69a\"]},\"project:/contracts/libs/WitnetCBOR.sol\":{\"keccak256\":\"0xb346547ff731163beea2c657c52675cdf7936691d566a76a045577cf9c34ade0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6d4b5b6424a033584b41f1204d635db98fda9ca9bd2a614c9d82539a3e4e6529\",\"dweb:/ipfs/QmW6Qy3wWpzHSECYaCPaf9LWGfPqWDKVoP2kPSNNQu7LMQ\"]},\"project:/contracts/libs/WitnetV2.sol\":{\"keccak256\":\"0xb276a6da373bfbe9cd942dd7e59979cda898215d1e36ab3df95a6d6cc6ff770f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bc4890876b9bc64f501ccdd48408bb63724865cb2ce8d2057f6b318540adce7c\",\"dweb:/ipfs/QmPMHPdbCsKBavhiLcaDgQ9EjNSvwwzv8TKffotcCv1ctP\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"immutableReferences": {},
"generatedSources": [],
"deployedGeneratedSources": [],
"sourceMap": "",
"deployedSourceMap": "",
"source": "// SPDX-License-Identifier: MIT\r\npragma solidity >=0.7.0 <0.9.0;\r\n\r\nimport \"../libs/WitnetV2.sol\";\r\n\r\ninterface IWitnetOracle {\r\n\r\n /// @notice Estimate the minimum reward required for posting a data request.\r\n /// @dev Underestimates if the size of returned data is greater than `resultMaxSize`. \r\n /// @param gasPrice Expected gas price to pay upon posting the data request.\r\n /// @param resultMaxSize Maximum expected size of returned data (in bytes). \r\n function estimateBaseFee(uint256 gasPrice, uint16 resultMaxSize) external view returns (uint256);\r\n\r\n /// @notice Estimate the minimum reward required for posting a data request.\r\n /// @dev Fails if the RAD hash was not previously verified on the WitnetRequestBytecodes registry.\r\n /// @param gasPrice Expected gas price to pay upon posting the data request.\r\n /// @param radHash The RAD hash of the data request to be solved by Witnet.\r\n function estimateBaseFee(uint256 gasPrice, bytes32 radHash) external view returns (uint256);\r\n \r\n /// @notice Estimate the minimum reward required for posting a data request with a callback.\r\n /// @param gasPrice Expected gas price to pay upon posting the data request.\r\n /// @param callbackGasLimit Maximum gas to be spent when reporting the data request result.\r\n function estimateBaseFeeWithCallback(uint256 gasPrice, uint24 callbackGasLimit) external view returns (uint256);\r\n \r\n /// @notice Retrieves a copy of all Witnet-provable data related to a previously posted request, \r\n /// removing the whole query from the WRB storage.\r\n /// @dev Fails if the query was not in 'Reported' status, or called from an address different to\r\n /// @dev the one that actually posted the given request.\r\n /// @param queryId The unique query identifier.\r\n function fetchQueryResponse(uint256 queryId) external returns (WitnetV2.Response memory);\r\n \r\n /// @notice Gets the whole Query data contents, if any, no matter its current status.\r\n function getQuery(uint256 queryId) external view returns (WitnetV2.Query memory);\r\n\r\n /// @notice Gets the current EVM reward the report can claim, if not done yet.\r\n function getQueryEvmReward(uint256 queryId) external view returns (uint256);\r\n\r\n /// @notice Retrieves the RAD hash and SLA parameters of the given query.\r\n /// @param queryId The unique query identifier.\r\n function getQueryRequest(uint256 queryId) external view returns (WitnetV2.Request memory);\r\n\r\n /// @notice Retrieves the whole `Witnet.Response` record referred to a previously posted Witnet Data Request.\r\n /// @param queryId The unique query identifier.\r\n function getQueryResponse(uint256 queryId) external view returns (WitnetV2.Response memory);\r\n\r\n /// @notice Returns query's result current status from a requester's point of view:\r\n /// @notice - 0 => Void: the query is either non-existent or deleted;\r\n /// @notice - 1 => Awaiting: the query has not yet been reported;\r\n /// @notice - 2 => Ready: the query response was finalized, and contains a result with no erros.\r\n /// @notice - 3 => Error: the query response was finalized, and contains a result with errors.\r\n /// @param queryId The unique query identifier.\r\n function getQueryResponseStatus(uint256 queryId) external view returns (WitnetV2.ResponseStatus);\r\n\r\n /// @notice Retrieves the CBOR-encoded buffer containing the Witnet-provided result to the given query.\r\n /// @param queryId The unique query identifier.\r\n function getQueryResultCborBytes(uint256 queryId) external view returns (bytes memory);\r\n\r\n /// @notice Gets error code identifying some possible failure on the resolution of the given query.\r\n /// @param queryId The unique query identifier.\r\n function getQueryResultError(uint256 queryId) external view returns (Witnet.ResultError memory);\r\n\r\n /// @notice Gets current status of given query.\r\n function getQueryStatus(uint256 queryId) external view returns (WitnetV2.QueryStatus);\r\n \r\n /// @notice Get current status of all given query ids.\r\n function getQueryStatusBatch(uint256[] calldata queryIds) external view returns (WitnetV2.QueryStatus[] memory);\r\n\r\n /// @notice Returns next query id to be generated by the Witnet Request Board.\r\n function getNextQueryId() external view returns (uint256);\r\n\r\n /// @notice Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and \r\n /// @notice solved by the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be \r\n /// @notice transferred to the reporter who relays back the Witnet-provable result to this request.\r\n /// @dev Reasons to fail:\r\n /// @dev - the RAD hash was not previously verified by the WitnetRequestBytecodes registry;\r\n /// @dev - invalid SLA parameters were provided;\r\n /// @dev - insufficient value is paid as reward.\r\n /// @param queryRAD The RAD hash of the data request to be solved by Witnet.\r\n /// @param querySLA The data query SLA to be fulfilled on the Witnet blockchain.\r\n /// @return queryId Unique query identifier.\r\n function postRequest(\r\n bytes32 queryRAD, \r\n WitnetV2.RadonSLA calldata querySLA\r\n ) external payable returns (uint256 queryId);\r\n\r\n /// @notice Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by \r\n /// @notice the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the \r\n /// @notice reporter who relays back the Witnet-provable result to this request. The Witnet-provable result will be reported\r\n /// @notice directly to the requesting contract. If the report callback fails for any reason, an `WitnetQueryResponseDeliveryFailed`\r\n /// @notice will be triggered, and the Witnet audit trail will be saved in storage, but not so the actual CBOR-encoded result.\r\n /// @dev Reasons to fail:\r\n /// @dev - the caller is not a contract implementing the IWitnetConsumer interface;\r\n /// @dev - the RAD hash was not previously verified by the WitnetRequestBytecodes registry;\r\n /// @dev - invalid SLA parameters were provided;\r\n /// @dev - insufficient value is paid as reward.\r\n /// @param queryRAD The RAD hash of the data request to be solved by Witnet.\r\n /// @param querySLA The data query SLA to be fulfilled on the Witnet blockchain.\r\n /// @param queryCallbackGasLimit Maximum gas to be spent when reporting the data request result.\r\n /// @return queryId Unique query identifier.\r\n function postRequestWithCallback(\r\n bytes32 queryRAD, \r\n WitnetV2.RadonSLA calldata querySLA, \r\n uint24 queryCallbackGasLimit\r\n ) external payable returns (uint256 queryId);\r\n\r\n /// @notice Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by \r\n /// @notice the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the \r\n /// @notice reporter who relays back the Witnet-provable result to this request. The Witnet-provable result will be reported\r\n /// @notice directly to the requesting contract. If the report callback fails for any reason, a `WitnetQueryResponseDeliveryFailed`\r\n /// @notice event will be triggered, and the Witnet audit trail will be saved in storage, but not so the CBOR-encoded result.\r\n /// @dev Reasons to fail:\r\n /// @dev - the caller is not a contract implementing the IWitnetConsumer interface;\r\n /// @dev - the provided bytecode is empty;\r\n /// @dev - invalid SLA parameters were provided;\r\n /// @dev - insufficient value is paid as reward.\r\n /// @param queryUnverifiedBytecode The (unverified) bytecode containing the actual data request to be solved by the Witnet blockchain.\r\n /// @param querySLA The data query SLA to be fulfilled on the Witnet blockchain.\r\n /// @param queryCallbackGasLimit Maximum gas to be spent when reporting the data request result.\r\n /// @return queryId Unique query identifier.\r\n function postRequestWithCallback(\r\n bytes calldata queryUnverifiedBytecode,\r\n WitnetV2.RadonSLA calldata querySLA, \r\n uint24 queryCallbackGasLimit\r\n ) external payable returns (uint256 queryId);\r\n\r\n /// @notice Increments the reward of a previously posted request by adding the transaction value to it.\r\n /// @param queryId The unique query identifier.\r\n function upgradeQueryEvmReward(uint256 queryId) external payable;\r\n\r\n}\r\n",
"sourcePath": "C:\\Users\\guill\\github\\witnet\\witnet-solidity-bridge\\contracts\\interfaces\\IWitnetOracle.sol",
"ast": {
"absolutePath": "project:/contracts/interfaces/IWitnetOracle.sol",
"exportedSymbols": {
"IWitnetOracle": [
13265
],
"Witnet": [
17557
],
"WitnetBuffer": [
19191
],
"WitnetCBOR": [
20734
],
"WitnetV2": [
23640
]
},
"id": 13266,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 13094,
"literals": [
"solidity",
">=",
"0.7",
".0",
"<",
"0.9",
".0"
],
"nodeType": "PragmaDirective",
"src": "33:31:49"
},
{
"absolutePath": "project:/contracts/libs/WitnetV2.sol",
"file": "../libs/WitnetV2.sol",
"id": 13095,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 13266,
"sourceUnit": 23641,
"src": "68:30:49",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": false,
"baseContracts": [],
"canonicalName": "IWitnetOracle",
"contractDependencies": [],
"contractKind": "interface",
"fullyImplemented": false,
"id": 13265,
"linearizedBaseContracts": [
13265
],
"name": "IWitnetOracle",
"nameLocation": "112:13:49",
"nodeType": "ContractDefinition",
"nodes": [
{
"documentation": {
"id": 13096,
"nodeType": "StructuredDocumentation",
"src": "135:333:49",
"text": "@notice Estimate the minimum reward required for posting a data request.\n @dev Underestimates if the size of returned data is greater than `resultMaxSize`. \n @param gasPrice Expected gas price to pay upon posting the data request.\n @param resultMaxSize Maximum expected size of returned data (in bytes). "
},
"functionSelector": "7bd88218",
"id": 13105,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "estimateBaseFee",
"nameLocation": "483:15:49",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 13101,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13098,
"mutability": "mutable",
"name": "gasPrice",
"nameLocation": "507:8:49",
"nodeType": "VariableDeclaration",
"scope": 13105,
"src": "499:16:49",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13097,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "499:7:49",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 13100,
"mutability": "mutable",
"name": "resultMaxSize",
"nameLocation": "524:13:49",
"nodeType": "VariableDeclaration",
"scope": 13105,
"src": "517:20:49",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
},
"typeName": {
"id": 13099,
"name": "uint16",
"nodeType": "ElementaryTypeName",
"src": "517:6:49",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
},
"visibility": "internal"
}
],
"src": "498:40:49"
},
"returnParameters": {
"id": 13104,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13103,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"scope": 13105,
"src": "562:7:49",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13102,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "562:7:49",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "561:9:49"
},
"scope": 13265,
"src": "474:97:49",
"stateMutability": "view",
"virtual": false,
"visibility": "external"
},
{
"documentation": {
"id": 13106,
"nodeType": "StructuredDocumentation",
"src": "579:343:49",
"text": "@notice Estimate the minimum reward required for posting a data request.\n @dev Fails if the RAD hash was not previously verified on the WitnetRequestBytecodes registry.\n @param gasPrice Expected gas price to pay upon posting the data request.\n @param radHash The RAD hash of the data request to be solved by Witnet."
},
"functionSelector": "9cc56e67",
"id": 13115,
"implemented": false,
"kind": "function",
"modifiers": [],
"name": "estimateBaseFee",
"nameLocation": "937:15:49",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 13111,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 13108,
"mutability": "mutable",
"name": "gasPrice",
"nameLocation": "961:8:49",
"nodeType": "VariableDeclaration",
"scope": 13115,
"src": "953:16:49",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 13107,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "953:7:49",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 13110,
"mutability": "mutable",
"name": "radHash",
"nameLocation": "979:7:49",
"nodeType": "VariableDeclaration",
"scope": 13115,
"src": "971:15:49",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {