witnet-solidity-bridge
Version:
Witnet Solidity Bridge contracts for EVM-compatible chains
1,010 lines (1,009 loc) • 98.2 kB
JSON
{
"contractName": "UsingWitnet",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "evmReward",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint8",
"name": "committeeSize",
"type": "uint8"
},
{
"internalType": "uint64",
"name": "witnessingFeeNanoWit",
"type": "uint64"
}
],
"indexed": false,
"internalType": "struct WitnetV2.RadonSLA",
"name": "witnetSLA",
"type": "tuple"
}
],
"name": "WitnetQuery",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "evmGasPrice",
"type": "uint256"
}
],
"name": "WitnetQueryResponse",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "evmGasPrice",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "evmCallbackGas",
"type": "uint256"
}
],
"name": "WitnetQueryResponseDelivered",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "resultCborBytes",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint256",
"name": "evmGasPrice",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "evmCallbackActualGas",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "evmCallbackRevertReason",
"type": "string"
}
],
"name": "WitnetQueryResponseDeliveryFailed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "evmReward",
"type": "uint256"
}
],
"name": "WitnetQueryRewardUpgraded",
"type": "event"
},
{
"inputs": [],
"name": "witnet",
"outputs": [
{
"internalType": "contract WitnetOracle",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmReward\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"committeeSize\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"witnessingFeeNanoWit\",\"type\":\"uint64\"}],\"indexed\":false,\"internalType\":\"struct WitnetV2.RadonSLA\",\"name\":\"witnetSLA\",\"type\":\"tuple\"}],\"name\":\"WitnetQuery\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"}],\"name\":\"WitnetQueryResponse\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmCallbackGas\",\"type\":\"uint256\"}],\"name\":\"WitnetQueryResponseDelivered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"resultCborBytes\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmCallbackActualGas\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"evmCallbackRevertReason\",\"type\":\"string\"}],\"name\":\"WitnetQueryResponseDeliveryFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmReward\",\"type\":\"uint256\"}],\"name\":\"WitnetQueryRewardUpgraded\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"witnet\",\"outputs\":[{\"internalType\":\"contract WitnetOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"The Witnet Foundation.\",\"details\":\"Witnet-aware contracts can inherit from this contract in order to interact with Witnet.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_wrb\":\"Address of the WitnetOracle contract.\"}}},\"stateVariables\":{\"__witnet\":{\"details\":\"Immutable reference to the Witnet Request Board contract.\"},\"__witnetBaseFeeOverheadPercentage\":{\"details\":\"Percentage over base fee to pay on every data request, as to deal with volatility of evmGasPrice and evmWitPrice during the live time of a data request (since being posted until a result gets reported back), at both the EVM and the Witnet blockchain levels, respectivelly. \"},\"__witnetDefaultSLA\":{\"details\":\"Default Security-Level Agreement parameters to be fulfilled by the Witnet blockchainwhen solving a data request.\"}},\"title\":\"The UsingWitnet contract\",\"version\":1},\"userdoc\":{\"events\":{\"WitnetQuery(uint256,uint256,(uint8,uint64))\":{\"notice\":\"Emitted every time a new query containing some verified data request is posted to the WRB.\"},\"WitnetQueryResponse(uint256,uint256)\":{\"notice\":\"Emitted when a query with no callback gets reported into the WRB.\"},\"WitnetQueryResponseDelivered(uint256,uint256,uint256)\":{\"notice\":\"Emitted when a query with a callback gets successfully reported into the WRB.\"},\"WitnetQueryResponseDeliveryFailed(uint256,bytes,uint256,uint256,string)\":{\"notice\":\"Emitted when a query with a callback cannot get reported into the WRB.\"},\"WitnetQueryRewardUpgraded(uint256,uint256)\":{\"notice\":\"Emitted when the reward of some not-yet reported query is upgraded.\"}},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/apps/UsingWitnet.sol\":\"UsingWitnet\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/WitnetOracle.sol\":{\"keccak256\":\"0x84ef8d2ebcba273e4bc23a5ee414a1213df55d1b4e496197a146031fea3a4874\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c4a6e31964ed08c4c9dfe5279b4ffe9eeba6e759f15901e080e174e98e96a7f5\",\"dweb:/ipfs/QmTghzVFf2EHnfnHejgFGRBjanXYcstK9ftVaYmHWJfk8w\"]},\"project:/contracts/WitnetRequestBytecodes.sol\":{\"keccak256\":\"0x2a79d919dd79c0e3f857e6bee08368ad0b463188aced4a52de29270ed0f5f3d2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://290d6013ee9f75fedbbb7726527a637ea2ae7a5da0ad118ecc43b298846f0bb0\",\"dweb:/ipfs/QmU8AZtPyctrrvxdmH297p595ZMS6DgcD6djSFKNxAqYMs\"]},\"project:/contracts/WitnetRequestFactory.sol\":{\"keccak256\":\"0x3c66f27d7c1db0e662c37d98005c4cbd871ceb75e97079d7bf673fb75d59c858\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://52adb318b870d0825718125e94fdbdd0e968ced09926420e2543b0ca4c6eb579\",\"dweb:/ipfs/QmYack87Q2UTfQb8KLLEPFBrMJgN2o6PaPqPNSc95McPVH\"]},\"project:/contracts/apps/UsingWitnet.sol\":{\"keccak256\":\"0x3fe6f2f1162bd1c128fb6aad2db81eaa1fdf04b5d15a5eeadf3e44bc81e2d4ef\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://927de4c99298ede8a240305bfd8e9daa5c79a32ed68cef19ece9b7f5bb37860b\",\"dweb:/ipfs/QmeZEbXpCTHegD6H7cVDipyXLYHUE4e3C66XojzYk8CpE4\"]},\"project:/contracts/interfaces/IWitnetOracle.sol\":{\"keccak256\":\"0x5dbb04fce5e05675325232a735c46617378982b48dac2138aca0c6cc95e6e4d5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7447a70455478239500e16aebe5dce6676dc86307d22f662761d8e9f7c5d1276\",\"dweb:/ipfs/QmVkvA4Mt6G1JXxE8ebxKGAjT1WvNbp5QMKg9sUKdrJjhv\"]},\"project:/contracts/interfaces/IWitnetOracleEvents.sol\":{\"keccak256\":\"0x0442f474f253dc1f6bd6a4f153c3adb2abe5f6f0f24c76d1baf666185e61e659\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://535e8efcfc5693669d9bd2b6f62e6fc65aca19b7de355a27152e4362b410540d\",\"dweb:/ipfs/QmVZRXgku1cZewhoucebaiBKAyUjF2dmEzYrzGvjPzbwN9\"]},\"project:/contracts/interfaces/IWitnetRequestBytecodes.sol\":{\"keccak256\":\"0x8da168bee9a78442216965976b1f29087f760f37dcb09337283242599ed1cbca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e120623262ee0559913bdae56c0a7921147dfe08ada7ea81061b14e2fc38c5e1\",\"dweb:/ipfs/Qmbxe8XRrH6ZjJHiR6YYzcZV1jnSWwo9iBYz5r6GJ6To5G\"]},\"project:/contracts/interfaces/IWitnetRequestFactory.sol\":{\"keccak256\":\"0x3b19ec4a976745ba2646e7e1886d647ef30ad678460a712c93bbfb4405b57f1f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fa759ae15b7d4da622a81d50933474910959ac490d8b63ea2e7ed8608859a9c9\",\"dweb:/ipfs/QmRckCu7eBBP5fn9ff6djs7VbdhFc7sxYb2yqDr4go66jV\"]},\"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\n\r\npragma solidity >=0.7.0 <0.9.0;\r\npragma experimental ABIEncoderV2;\r\n\r\nimport \"../WitnetOracle.sol\";\r\n\r\n/// @title The UsingWitnet contract\r\n/// @dev Witnet-aware contracts can inherit from this contract in order to interact with Witnet.\r\n/// @author The Witnet Foundation.\r\nabstract contract UsingWitnet\r\n is\r\n IWitnetOracleEvents\r\n{\r\n /// @dev Immutable reference to the Witnet Request Board contract.\r\n WitnetOracle internal immutable __witnet;\r\n \r\n /// @dev Default Security-Level Agreement parameters to be fulfilled by the Witnet blockchain\r\n /// @dev when solving a data request.\r\n WitnetV2.RadonSLA internal __witnetDefaultSLA;\r\n\r\n /// @dev Percentage over base fee to pay on every data request, \r\n /// @dev as to deal with volatility of evmGasPrice and evmWitPrice during the live time of \r\n /// @dev a data request (since being posted until a result gets reported back), at both the EVM and \r\n /// @dev the Witnet blockchain levels, respectivelly. \r\n uint16 internal __witnetBaseFeeOverheadPercentage;\r\n\r\n /// @param _wrb Address of the WitnetOracle contract.\r\n constructor(WitnetOracle _wrb) {\r\n require(\r\n _wrb.specs() == type(IWitnetOracle).interfaceId,\r\n \"UsingWitnet: uncompliant WitnetOracle\"\r\n );\r\n __witnet = _wrb;\r\n __witnetDefaultSLA = WitnetV2.RadonSLA({\r\n // Number of nodes in the Witnet blockchain that will take part in solving the data request:\r\n committeeSize: 10,\r\n // Fee in $nanoWIT paid to every node in the Witnet blockchain involved in solving the data request:\r\n witnessingFeeNanoWit: 2 * 10 ** 8 // defaults to 0.2 $WIT\r\n });\r\n \r\n __witnetBaseFeeOverheadPercentage = 33; // defaults to 33%\r\n }\r\n\r\n /// @dev Provides a convenient way for client contracts extending this to block the execution of the main logic of the\r\n /// @dev contract until a particular request has been successfully solved and reported by Witnet,\r\n /// @dev either with an error or successfully.\r\n modifier witnetQuerySolved(uint256 _witnetQueryId) {\r\n require(_witnetCheckQueryResultAvailability(_witnetQueryId), \"UsingWitnet: unsolved query\");\r\n _;\r\n }\r\n\r\n function witnet() virtual public view returns (WitnetOracle) {\r\n return __witnet;\r\n }\r\n\r\n /// @notice Check if given query was already reported back from the Witnet oracle.\r\n /// @param _id The unique identifier of a previously posted data request.\r\n function _witnetCheckQueryResultAvailability(uint256 _id)\r\n internal view\r\n returns (bool)\r\n {\r\n return __witnet.getQueryStatus(_id) == WitnetV2.QueryStatus.Reported;\r\n }\r\n\r\n /// @notice Estimate the minimum reward required for posting a data request, using `tx.gasprice` as a reference.\r\n /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. \r\n /// @param _resultMaxSize Maximum expected size of returned data (in bytes).\r\n function _witnetEstimateEvmReward(uint16 _resultMaxSize)\r\n virtual internal view\r\n returns (uint256)\r\n {\r\n return (\r\n (100 + __witnetBaseFeeOverheadPercentage)\r\n * __witnet.estimateBaseFee(tx.gasprice, _resultMaxSize) \r\n ) / 100;\r\n }\r\n\r\n function _witnetCheckQueryResponseStatus(uint256 _witnetQueryId)\r\n internal view\r\n returns (WitnetV2.ResponseStatus)\r\n {\r\n return __witnet.getQueryResponseStatus(_witnetQueryId);\r\n }\r\n\r\n function _witnetCheckQueryResultError(uint256 _witnetQueryId)\r\n internal view\r\n returns (Witnet.ResultError memory)\r\n {\r\n return __witnet.getQueryResultError(_witnetQueryId);\r\n }\r\n}\r\n",
"sourcePath": "C:\\Users\\guill\\github\\witnet\\witnet-solidity-bridge\\contracts\\apps\\UsingWitnet.sol",
"ast": {
"absolutePath": "project:/contracts/apps/UsingWitnet.sol",
"exportedSymbols": {
"IWitnetOracle": [
13265
],
"IWitnetOracleEvents": [
13315
],
"IWitnetRequestBytecodes": [
13979
],
"IWitnetRequestFactory": [
14002
],
"UsingWitnet": [
1157
],
"Witnet": [
17557
],
"WitnetBuffer": [
19191
],
"WitnetCBOR": [
20734
],
"WitnetOracle": [
749
],
"WitnetRequestBytecodes": [
849
],
"WitnetRequestFactory": [
880
],
"WitnetV2": [
23640
]
},
"id": 1158,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1007,
"literals": [
"solidity",
">=",
"0.7",
".0",
"<",
"0.9",
".0"
],
"nodeType": "PragmaDirective",
"src": "35:31:16"
},
{
"id": 1008,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "68:33:16"
},
{
"absolutePath": "project:/contracts/WitnetOracle.sol",
"file": "../WitnetOracle.sol",
"id": 1009,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 1158,
"sourceUnit": 750,
"src": "105:29:16",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": true,
"baseContracts": [
{
"baseName": {
"id": 1011,
"name": "IWitnetOracleEvents",
"nameLocations": [
"356:19:16"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 13315,
"src": "356:19:16"
},
"id": 1012,
"nodeType": "InheritanceSpecifier",
"src": "356:19:16"
}
],
"canonicalName": "UsingWitnet",
"contractDependencies": [],
"contractKind": "contract",
"documentation": {
"id": 1010,
"nodeType": "StructuredDocumentation",
"src": "138:171:16",
"text": "@title The UsingWitnet contract\n @dev Witnet-aware contracts can inherit from this contract in order to interact with Witnet.\n @author The Witnet Foundation."
},
"fullyImplemented": true,
"id": 1157,
"linearizedBaseContracts": [
1157,
13315
],
"name": "UsingWitnet",
"nameLocation": "327:11:16",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"documentation": {
"id": 1013,
"nodeType": "StructuredDocumentation",
"src": "384:66:16",
"text": "@dev Immutable reference to the Witnet Request Board contract."
},
"id": 1016,
"mutability": "immutable",
"name": "__witnet",
"nameLocation": "488:8:16",
"nodeType": "VariableDeclaration",
"scope": 1157,
"src": "456:40:16",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetOracle_$749",
"typeString": "contract WitnetOracle"
},
"typeName": {
"id": 1015,
"nodeType": "UserDefinedTypeName",
"pathNode": {
"id": 1014,
"name": "WitnetOracle",
"nameLocations": [
"456:12:16"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 749,
"src": "456:12:16"
},
"referencedDeclaration": 749,
"src": "456:12:16",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetOracle_$749",
"typeString": "contract WitnetOracle"
}
},
"visibility": "internal"
},
{
"constant": false,
"documentation": {
"id": 1017,
"nodeType": "StructuredDocumentation",
"src": "509:136:16",
"text": "@dev Default Security-Level Agreement parameters to be fulfilled by the Witnet blockchain\n @dev when solving a data request."
},
"id": 1020,
"mutability": "mutable",
"name": "__witnetDefaultSLA",
"nameLocation": "678:18:16",
"nodeType": "VariableDeclaration",
"scope": 1157,
"src": "651:45:16",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_struct$_RadonSLA_$23503_storage",
"typeString": "struct WitnetV2.RadonSLA"
},
"typeName": {
"id": 1019,
"nodeType": "UserDefinedTypeName",
"pathNode": {
"id": 1018,
"name": "WitnetV2.RadonSLA",
"nameLocations": [
"651:8:16",
"660:8:16"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 23503,
"src": "651:17:16"
},
"referencedDeclaration": 23503,
"src": "651:17:16",
"typeDescriptions": {
"typeIdentifier": "t_struct$_RadonSLA_$23503_storage_ptr",
"typeString": "struct WitnetV2.RadonSLA"
}
},
"visibility": "internal"
},
{
"constant": false,
"documentation": {
"id": 1021,
"nodeType": "StructuredDocumentation",
"src": "705:327:16",
"text": "@dev Percentage over base fee to pay on every data request, \n @dev as to deal with volatility of evmGasPrice and evmWitPrice during the live time of \n @dev a data request (since being posted until a result gets reported back), at both the EVM and \n @dev the Witnet blockchain levels, respectivelly. "
},
"id": 1023,
"mutability": "mutable",
"name": "__witnetBaseFeeOverheadPercentage",
"nameLocation": "1054:33:16",
"nodeType": "VariableDeclaration",
"scope": 1157,
"src": "1038:49:16",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
},
"typeName": {
"id": 1022,
"name": "uint16",
"nodeType": "ElementaryTypeName",
"src": "1038:6:16",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
},
"visibility": "internal"
},
{
"body": {
"id": 1062,
"nodeType": "Block",
"src": "1186:644:16",
"statements": [
{
"expression": {
"arguments": [
{
"commonType": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"id": 1038,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"id": 1031,
"name": "_wrb",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1027,
"src": "1219:4:16",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetOracle_$749",
"typeString": "contract WitnetOracle"
}
},
"id": 1032,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "1224:5:16",
"memberName": "specs",
"nodeType": "MemberAccess",
"referencedDeclaration": 748,
"src": "1219:10:16",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_bytes4_$",
"typeString": "function () view external returns (bytes4)"
}
},
"id": 1033,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1219:12:16",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"expression": {
"arguments": [
{
"id": 1035,
"name": "IWitnetOracle",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 13265,
"src": "1240:13:16",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IWitnetOracle_$13265_$",
"typeString": "type(contract IWitnetOracle)"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_type$_t_contract$_IWitnetOracle_$13265_$",
"typeString": "type(contract IWitnetOracle)"
}
],
"id": 1034,
"name": "type",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 4294967269,
"src": "1235:4:16",
"typeDescriptions": {
"typeIdentifier": "t_function_metatype_pure$__$returns$__$",
"typeString": "function () pure"
}
},
"id": 1036,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1235:19:16",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_magic_meta_type_t_contract$_IWitnetOracle_$13265",
"typeString": "type(contract IWitnetOracle)"
}
},
"id": 1037,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberLocation": "1255:11:16",
"memberName": "interfaceId",
"nodeType": "MemberAccess",
"src": "1235:31:16",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"src": "1219:47:16",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"hexValue": "5573696e675769746e65743a20756e636f6d706c69616e74205769746e65744f7261636c65",
"id": 1039,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1281:39:16",
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_57d830abe71d02a02e5da4295b2a41f780665da6ca2ca2ca1e1e440e807c06d7",
"typeString": "literal_string \"UsingWitnet: uncompliant WitnetOracle\""
},
"value": "UsingWitnet: uncompliant WitnetOracle"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_57d830abe71d02a02e5da4295b2a41f780665da6ca2ca2ca1e1e440e807c06d7",
"typeString": "literal_string \"UsingWitnet: uncompliant WitnetOracle\""
}
],
"id": 1030,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
4294967278,
4294967278
],
"referencedDeclaration": 4294967278,
"src": "1197:7:16",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 1040,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1197:134:16",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 1041,
"nodeType": "ExpressionStatement",
"src": "1197:134:16"
},
{
"expression": {
"id": 1044,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 1042,
"name": "__witnet",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1016,
"src": "1342:8:16",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetOracle_$749",
"typeString": "contract WitnetOracle"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 1043,
"name": "_wrb",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1027,
"src": "1353:4:16",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetOracle_$749",
"typeString": "contract WitnetOracle"
}
},
"src": "1342:15:16",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetOracle_$749",
"typeString": "contract WitnetOracle"
}
},
"id": 1045,
"nodeType": "ExpressionStatement",
"src": "1342:15:16"
},
{
"expression": {
"id": 1056,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 1046,
"name": "__witnetDefaultSLA",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1020,
"src": "1368:18:16",
"typeDescriptions": {
"typeIdentifier": "t_struct$_RadonSLA_$23503_storage",
"typeString": "struct WitnetV2.RadonSLA storage ref"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"hexValue": "3130",
"id": 1049,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1543:2:16",
"typeDescriptions": {
"typeIdentifier": "t_rational_10_by_1",
"typeString": "int_const 10"
},
"value": "10"
},
{
"commonType": {
"typeIdentifier": "t_rational_200000000_by_1",
"typeString": "int_const 200000000"
},
"id": 1054,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"leftExpression": {
"hexValue": "32",
"id": 1050,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1696:1:16",
"typeDescriptions": {
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
},
"value": "2"
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"commonType": {
"typeIdentifier": "t_rational_100000000_by_1",
"typeString": "int_const 100000000"
},
"id": 1053,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"leftExpression": {
"hexValue": "3130",
"id": 1051,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1700:2:16",
"typeDescriptions": {
"typeIdentifier": "t_rational_10_by_1",
"typeString": "int_const 10"
},
"value": "10"
},
"nodeType": "BinaryOperation",
"operator": "**",
"rightExpression": {
"hexValue": "38",
"id": 1052,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1706:1:16",
"typeDescriptions": {
"typeIdentifier": "t_rational_8_by_1",
"typeString": "int_const 8"
},
"value": "8"
},
"src": "1700:7:16",
"typeDescriptions": {
"typeIdentifier": "t_rational_100000000_by_1",
"typeString": "int_const 100000000"
}
},
"src": "1696:11:16",
"typeDescriptions": {
"typeIdentifier": "t_rational_200000000_by_1",
"typeString": "int_const 200000000"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_10_by_1",
"typeString": "int_const 10"
},
{
"typeIdentifier": "t_rational_200000000_by_1",
"typeString": "int_const 200000000"
}
],
"expression": {
"id": 1047,
"name": "WitnetV2",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23640,
"src": "1389:8:16",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_WitnetV2_$23640_$",
"typeString": "type(library WitnetV2)"
}
},
"id": 1048,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "1398:8:16",
"memberName": "RadonSLA",
"nodeType": "MemberAccess",
"referencedDeclaration": 23503,
"src": "1389:17:16",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_struct$_RadonSLA_$23503_storage_ptr_$",
"typeString": "type(struct WitnetV2.RadonSLA storage pointer)"
}
},
"id": 1055,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "structConstructorCall",
"lValueRequested": false,
"nameLocations": [
"1528:13:16",
"1674:20:16"
],
"names": [
"committeeSize",
"witnessingFeeNanoWit"
],
"nodeType": "FunctionCall",
"src": "1389:355:16",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_struct$_RadonSLA_$23503_memory_ptr",
"typeString": "struct WitnetV2.RadonSLA memory"
}
},
"src": "1368:376:16",
"typeDescriptions": {
"typeIdentifier": "t_struct$_RadonSLA_$23503_storage",
"typeString": "struct WitnetV2.RadonSLA storage ref"
}
},
"id": 1057,
"nodeType": "ExpressionStatement",
"src": "1368:376:16"
},
{
"expression": {
"id": 1060,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 1058,
"name": "__witnetBaseFeeOverheadPercentage",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1023,
"src": "1765:33:16",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"hexValue": "3333",
"id": 1059,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1801:2:16",
"typeDescriptions": {
"typeIdentifier": "t_rational_33_by_1",
"typeString": "int_const 33"
},
"value": "33"
},
"src": "1765:38:16",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
},
"id": 1061,
"nodeType": "ExpressionStatement",
"src": "1765:38:16"
}
]
},
"documentation": {
"id": 1024,
"nodeType": "StructuredDocumentation",
"src": "1096:53:16",
"text": "@param _wrb Address of the WitnetOracle contract."
},
"id": 1063,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1028,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1027,
"mutability": "mutable",
"name": "_wrb",
"nameLocation": "1180:4:16",
"nodeType": "VariableDeclaration",
"scope": 1063,
"src": "1167:17:16",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetOracle_$749",
"typeString": "contract WitnetOracle"
},
"typeName": {
"id": 1026,
"nodeType": "UserDefinedTypeName",
"pathNode": {
"id": 1025,
"name": "WitnetOracle",
"nameLocations": [
"1167:12:16"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 749,
"src": "1167:12:16"
},
"referencedDeclaration": 749,
"src": "1167:12:16",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetOracle_$749",
"typeString": "contract WitnetOracle"
}
},
"visibility": "internal"
}
],
"src": "1166:19:16"
},
"returnParameters": {
"id": 1029,
"nodeType": "ParameterList",
"parameters": [],
"src": "1186:0:16"
},
"scope": 1157,
"src": "1155:675:16",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 1076,
"nodeType": "Block",
"src": "2168:122:16",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"id": 1070,
"name": "_witnetQueryId",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1066,
"src": "2223:14:16",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 1069,
"name": "_witnetCheckQueryResultAvailability",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1104,
"src": "2187:35:16",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_bool_$",
"typeString": "function (uint256) view returns (bool)"
}
},
"id": 1071,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "2187:51:16",
"tryCall": false,