UNPKG

witnet-solidity-bridge

Version:

Witnet Solidity Bridge contracts for EVM-compatible chains

1,047 lines (1,046 loc) 89.8 kB
{ "contractName": "UsingWitnetRequestTemplate", "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": "dataRequestTemplate", "outputs": [ { "internalType": "contract WitnetRequestTemplate", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "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\":\"dataRequestTemplate\",\"outputs\":[{\"internalType\":\"contract WitnetRequestTemplate\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"witnet\",\"outputs\":[{\"internalType\":\"contract WitnetOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_baseFeeOverheadPercentage\":\"Percentage over base fee to pay as on every data request.\",\"_witnetRequestTemplate\":\"Address of the WitnetRequestTemplate from which actual data requests will get built.\"}}},\"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/UsingWitnetRequestTemplate.sol\":\"UsingWitnetRequestTemplate\"},\"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/WitnetRequest.sol\":{\"keccak256\":\"0x5b5e8e9744de10fe86adf97826e3db5c5bcbf357d179a532ef4d7073c7c3af88\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://25bed2c86e46beb6f59024b731b9f3d1ab176312a28b090ad149ddea48841c32\",\"dweb:/ipfs/QmT3aAXfKQ2MTHo4dK1pCyhdvaLYf5TJtgcim5DfbWHjp4\"]},\"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/WitnetRequestTemplate.sol\":{\"keccak256\":\"0x10084f4f493f87d0acd9937fa786bf9e92512bf3670ee0427445d43c2cae973e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2491b8a6ec8f01a53f35f6aa602df8630955000f3dc67e7dc8b61b0b25a71657\",\"dweb:/ipfs/QmXEuPy6pVnSQpbg8G1DuVMKQyVfbTdtsDUrPYCbZNHARD\"]},\"project:/contracts/apps/UsingWitnet.sol\":{\"keccak256\":\"0x3fe6f2f1162bd1c128fb6aad2db81eaa1fdf04b5d15a5eeadf3e44bc81e2d4ef\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://927de4c99298ede8a240305bfd8e9daa5c79a32ed68cef19ece9b7f5bb37860b\",\"dweb:/ipfs/QmeZEbXpCTHegD6H7cVDipyXLYHUE4e3C66XojzYk8CpE4\"]},\"project:/contracts/apps/UsingWitnetRequestTemplate.sol\":{\"keccak256\":\"0xcd05eef301092e6b16f9d60fb99a205d09a897c728f223b11393ab78e2089e73\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2971b6571e08e6f5c17736a189299d570beb2aaece4742775f4ba3ecb5885ba7\",\"dweb:/ipfs/QmdGovKLyzg2PTFCVAXYBJVbkfD1Vr9nTB8BNYp7GgewAU\"]},\"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\npragma solidity ^0.8.0;\r\n\r\nimport \"./UsingWitnet.sol\";\r\nimport \"../WitnetRequest.sol\";\r\n\r\nabstract contract UsingWitnetRequestTemplate\r\n is UsingWitnet\r\n{\r\n WitnetRequestTemplate immutable public dataRequestTemplate;\r\n \r\n uint16 immutable internal __witnetQueryResultMaxSize;\r\n \r\n /// @param _witnetRequestTemplate Address of the WitnetRequestTemplate from which actual data requests will get built.\r\n /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request.\r\n constructor (\r\n WitnetRequestTemplate _witnetRequestTemplate, \r\n uint16 _baseFeeOverheadPercentage\r\n )\r\n UsingWitnet(_witnetRequestTemplate.witnet())\r\n {\r\n require(\r\n _witnetRequestTemplate.specs() == type(WitnetRequestTemplate).interfaceId,\r\n \"UsingWitnetRequestTemplate: uncompliant WitnetRequestTemplate\"\r\n );\r\n dataRequestTemplate = _witnetRequestTemplate;\r\n __witnetQueryResultMaxSize = _witnetRequestTemplate.resultDataMaxSize();\r\n __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage;\r\n }\r\n\r\n function _witnetBuildRadHash(string[][] memory _witnetRequestArgs)\r\n internal returns (bytes32)\r\n {\r\n return dataRequestTemplate.verifyRadonRequest(_witnetRequestArgs);\r\n }\r\n \r\n function _witnetBuildRequest(string[][] memory _witnetRequestArgs)\r\n internal returns (WitnetRequest)\r\n {\r\n return WitnetRequest(dataRequestTemplate.buildRequest(_witnetRequestArgs));\r\n }\r\n\r\n function _witnetEstimateEvmReward()\r\n virtual internal view\r\n returns (uint256)\r\n {\r\n return _witnetEstimateEvmReward(__witnetQueryResultMaxSize);\r\n }\r\n\r\n function __witnetRequestData(\r\n uint256 _witnetEvmReward,\r\n string[][] memory _witnetRequestArgs\r\n )\r\n virtual internal returns (uint256)\r\n {\r\n return __witnetRequestData(_witnetEvmReward, _witnetRequestArgs, __witnetDefaultSLA);\r\n }\r\n\r\n function __witnetRequestData(\r\n uint256 _witnetEvmReward,\r\n string[][] memory _witnetRequestArgs,\r\n WitnetV2.RadonSLA memory _witnetQuerySLA\r\n )\r\n virtual internal returns (uint256)\r\n {\r\n return __witnet.postRequest{value: _witnetEvmReward}(\r\n _witnetBuildRadHash(_witnetRequestArgs),\r\n _witnetQuerySLA\r\n );\r\n }\r\n}\r\n", "sourcePath": "C:\\Users\\guill\\github\\witnet\\witnet-solidity-bridge\\contracts\\apps\\UsingWitnetRequestTemplate.sol", "ast": { "absolutePath": "project:/contracts/apps/UsingWitnetRequestTemplate.sol", "exportedSymbols": { "IWitnetOracle": [ 13265 ], "IWitnetOracleEvents": [ 13315 ], "IWitnetRequestBytecodes": [ 13979 ], "IWitnetRequestFactory": [ 14002 ], "UsingWitnet": [ 1157 ], "UsingWitnetRequestTemplate": [ 1453 ], "Witnet": [ 17557 ], "WitnetBuffer": [ 19191 ], "WitnetCBOR": [ 20734 ], "WitnetOracle": [ 749 ], "WitnetRequest": [ 826 ], "WitnetRequestBytecodes": [ 849 ], "WitnetRequestFactory": [ 880 ], "WitnetRequestTemplate": [ 1005 ], "WitnetV2": [ 23640 ] }, "id": 1454, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 1316, "literals": [ "solidity", "^", "0.8", ".0" ], "nodeType": "PragmaDirective", "src": "33:23:19" }, { "absolutePath": "project:/contracts/apps/UsingWitnet.sol", "file": "./UsingWitnet.sol", "id": 1317, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 1454, "sourceUnit": 1158, "src": "60:27:19", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "project:/contracts/WitnetRequest.sol", "file": "../WitnetRequest.sol", "id": 1318, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 1454, "sourceUnit": 827, "src": "89:30:19", "symbolAliases": [], "unitAlias": "" }, { "abstract": true, "baseContracts": [ { "baseName": { "id": 1319, "name": "UsingWitnet", "nameLocations": [ "176:11:19" ], "nodeType": "IdentifierPath", "referencedDeclaration": 1157, "src": "176:11:19" }, "id": 1320, "nodeType": "InheritanceSpecifier", "src": "176:11:19" } ], "canonicalName": "UsingWitnetRequestTemplate", "contractDependencies": [], "contractKind": "contract", "fullyImplemented": true, "id": 1453, "linearizedBaseContracts": [ 1453, 1157, 13315 ], "name": "UsingWitnetRequestTemplate", "nameLocation": "141:26:19", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "functionSelector": "3c85fb6a", "id": 1323, "mutability": "immutable", "name": "dataRequestTemplate", "nameLocation": "235:19:19", "nodeType": "VariableDeclaration", "scope": 1453, "src": "196:58:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetRequestTemplate_$1005", "typeString": "contract WitnetRequestTemplate" }, "typeName": { "id": 1322, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 1321, "name": "WitnetRequestTemplate", "nameLocations": [ "196:21:19" ], "nodeType": "IdentifierPath", "referencedDeclaration": 1005, "src": "196:21:19" }, "referencedDeclaration": 1005, "src": "196:21:19", "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetRequestTemplate_$1005", "typeString": "contract WitnetRequestTemplate" } }, "visibility": "public" }, { "constant": false, "id": 1325, "mutability": "immutable", "name": "__witnetQueryResultMaxSize", "nameLocation": "293:26:19", "nodeType": "VariableDeclaration", "scope": 1453, "src": "267:52:19", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" }, "typeName": { "id": 1324, "name": "uint16", "nodeType": "ElementaryTypeName", "src": "267:6:19", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" } }, "visibility": "internal" }, { "body": { "id": 1365, "nodeType": "Block", "src": "745:413:19", "statements": [ { "expression": { "arguments": [ { "commonType": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "id": 1347, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "arguments": [], "expression": { "argumentTypes": [], "expression": { "id": 1340, "name": "_witnetRequestTemplate", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1329, "src": "778:22:19", "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetRequestTemplate_$1005", "typeString": "contract WitnetRequestTemplate" } }, "id": 1341, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberLocation": "801:5:19", "memberName": "specs", "nodeType": "MemberAccess", "referencedDeclaration": 918, "src": "778:28:19", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_bytes4_$", "typeString": "function () view external returns (bytes4)" } }, "id": 1342, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "778:30:19", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "expression": { "arguments": [ { "id": 1344, "name": "WitnetRequestTemplate", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1005, "src": "817:21:19", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_WitnetRequestTemplate_$1005_$", "typeString": "type(contract WitnetRequestTemplate)" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_type$_t_contract$_WitnetRequestTemplate_$1005_$", "typeString": "type(contract WitnetRequestTemplate)" } ], "id": 1343, "name": "type", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4294967269, "src": "812:4:19", "typeDescriptions": { "typeIdentifier": "t_function_metatype_pure$__$returns$__$", "typeString": "function () pure" } }, "id": 1345, "isConstant": false, "isLValue": false, "isPure": true, "kind": "functionCall", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "812:27:19", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_magic_meta_type_t_contract$_WitnetRequestTemplate_$1005", "typeString": "type(contract WitnetRequestTemplate)" } }, "id": 1346, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberLocation": "840:11:19", "memberName": "interfaceId", "nodeType": "MemberAccess", "src": "812:39:19", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "src": "778:73:19", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "hexValue": "5573696e675769746e65745265717565737454656d706c6174653a20756e636f6d706c69616e74205769746e65745265717565737454656d706c617465", "id": 1348, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "866:63:19", "typeDescriptions": { "typeIdentifier": "t_stringliteral_444ad71e017d40953bc91df6e3479f6a5ebec2581b72a9c415e09a2023fbe90d", "typeString": "literal_string \"UsingWitnetRequestTemplate: uncompliant WitnetRequestTemplate\"" }, "value": "UsingWitnetRequestTemplate: uncompliant WitnetRequestTemplate" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_444ad71e017d40953bc91df6e3479f6a5ebec2581b72a9c415e09a2023fbe90d", "typeString": "literal_string \"UsingWitnetRequestTemplate: uncompliant WitnetRequestTemplate\"" } ], "id": 1339, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 4294967278, 4294967278 ], "referencedDeclaration": 4294967278, "src": "756:7:19", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 1349, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "756:184:19", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 1350, "nodeType": "ExpressionStatement", "src": "756:184:19" }, { "expression": { "id": 1353, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 1351, "name": "dataRequestTemplate", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1323, "src": "951:19:19", "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetRequestTemplate_$1005", "typeString": "contract WitnetRequestTemplate" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "id": 1352, "name": "_witnetRequestTemplate", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1329, "src": "973:22:19", "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetRequestTemplate_$1005", "typeString": "contract WitnetRequestTemplate" } }, "src": "951:44:19", "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetRequestTemplate_$1005", "typeString": "contract WitnetRequestTemplate" } }, "id": 1354, "nodeType": "ExpressionStatement", "src": "951:44:19" }, { "expression": { "id": 1359, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 1355, "name": "__witnetQueryResultMaxSize", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1325, "src": "1006:26:19", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "arguments": [], "expression": { "argumentTypes": [], "expression": { "id": 1356, "name": "_witnetRequestTemplate", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1329, "src": "1035:22:19", "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetRequestTemplate_$1005", "typeString": "contract WitnetRequestTemplate" } }, "id": 1357, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberLocation": "1058:17:19", "memberName": "resultDataMaxSize", "nodeType": "MemberAccess", "referencedDeclaration": 944, "src": "1035:40:19", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_uint16_$", "typeString": "function () view external returns (uint16)" } }, "id": 1358, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "1035:42:19", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" } }, "src": "1006:71:19", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" } }, "id": 1360, "nodeType": "ExpressionStatement", "src": "1006:71:19" }, { "expression": { "id": 1363, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "id": 1361, "name": "__witnetBaseFeeOverheadPercentage", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1023, "src": "1088:33:19", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "id": 1362, "name": "_baseFeeOverheadPercentage", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1331, "src": "1124:26:19", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" } }, "src": "1088:62:19", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" } }, "id": 1364, "nodeType": "ExpressionStatement", "src": "1088:62:19" } ] }, "documentation": { "id": 1326, "nodeType": "StructuredDocumentation", "src": "329:219:19", "text": "@param _witnetRequestTemplate Address of the WitnetRequestTemplate from which actual data requests will get built.\n @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request." }, "id": 1366, "implemented": true, "kind": "constructor", "modifiers": [ { "arguments": [ { "arguments": [], "expression": { "argumentTypes": [], "expression": { "id": 1334, "name": "_witnetRequestTemplate", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1329, "src": "707:22:19", "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetRequestTemplate_$1005", "typeString": "contract WitnetRequestTemplate" } }, "id": 1335, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberLocation": "730:6:19", "memberName": "witnet", "nodeType": "MemberAccess", "referencedDeclaration": 929, "src": "707:29:19", "typeDescriptions": { "typeIdentifier": "t_function_external_view$__$returns$_t_contract$_WitnetOracle_$749_$", "typeString": "function () view external returns (contract WitnetOracle)" } }, "id": 1336, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "707:31:19", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetOracle_$749", "typeString": "contract WitnetOracle" } } ], "id": 1337, "kind": "baseConstructorSpecifier", "modifierName": { "id": 1333, "name": "UsingWitnet", "nameLocations": [ "695:11:19" ], "nodeType": "IdentifierPath", "referencedDeclaration": 1157, "src": "695:11:19" }, "nodeType": "ModifierInvocation", "src": "695:44:19" } ], "name": "", "nameLocation": "-1:-1:-1", "nodeType": "FunctionDefinition", "parameters": { "id": 1332, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1329, "mutability": "mutable", "name": "_witnetRequestTemplate", "nameLocation": "603:22:19", "nodeType": "VariableDeclaration", "scope": 1366, "src": "581:44:19", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetRequestTemplate_$1005", "typeString": "contract WitnetRequestTemplate" }, "typeName": { "id": 1328, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 1327, "name": "WitnetRequestTemplate", "nameLocations": [ "581:21:19" ], "nodeType": "IdentifierPath", "referencedDeclaration": 1005, "src": "581:21:19" }, "referencedDeclaration": 1005, "src": "581:21:19", "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetRequestTemplate_$1005", "typeString": "contract WitnetRequestTemplate" } }, "visibility": "internal" }, { "constant": false, "id": 1331, "mutability": "mutable", "name": "_baseFeeOverheadPercentage", "nameLocation": "648:26:19", "nodeType": "VariableDeclaration", "scope": 1366, "src": "641:33:19", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" }, "typeName": { "id": 1330, "name": "uint16", "nodeType": "ElementaryTypeName", "src": "641:6:19", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" } }, "visibility": "internal" } ], "src": "566:119:19" }, "returnParameters": { "id": 1338, "nodeType": "ParameterList", "parameters": [], "src": "745:0:19" }, "scope": 1453, "src": "554:604:19", "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { "body": { "id": 1380, "nodeType": "Block", "src": "1274:84:19", "statements": [ { "expression": { "arguments": [ { "id": 1377, "name": "_witnetRequestArgs", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1370, "src": "1331:18:19", "typeDescriptions": { "typeIdentifier": "t_array$_t_array$_t_string_memory_ptr_$dyn_memory_ptr_$dyn_memory_ptr", "typeString": "string memory[] memory[] memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_array$_t_array$_t_string_memory_ptr_$dyn_memory_ptr_$dyn_memory_ptr", "typeString": "string memory[] memory[] memory" } ], "expression": { "id": 1375, "name": "dataRequestTemplate", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1323, "src": "1292:19:19", "typeDescriptions": { "typeIdentifier": "t_contract$_WitnetRequestTemplate_$1005", "typeString": "contract WitnetRequestTemplate" } }, "id": 1376, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberLocation": "1312:18:19", "memberName": "verifyRadonRequest", "nodeType": "MemberAccess", "referencedDeclaration": 1004, "src": "1292:38:19", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_array$_t_array$_t_string_memory_ptr_$dyn_memory_ptr_$dyn_memory_ptr_$returns$_t_bytes32_$", "typeString": "function (string memory[] memory[] memory) external returns (bytes32)" } }, "id": 1378, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "1292:58:19", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "functionReturnParameters": 1374, "id": 1379, "nodeType": "Return", "src": "1285:65:19" } ] }, "id": 1381, "implemented": true, "kind": "function", "modifiers": [], "name": "_witnetBuildRadHash", "nameLocation": "1175:19:19", "nodeType": "FunctionDefinition", "parameters": { "id": 1371, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1370, "mutability": "mutable", "name": "_witnetRequestArgs", "nameLocation": "1213:18:19", "nodeType": "VariableDeclaration", "scope": 1381, "src": "1195:36:19", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_array$_t_string_memory_ptr_$dyn_memory_ptr_$dyn_memory_ptr", "typeString": "string[][]" }, "typeName": { "baseType": { "baseType": { "id": 1367, "name": "string", "nodeType": "ElementaryTypeName", "src": "1195:6:19", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "id": 1368, "nodeType": "ArrayTypeName", "src": "1195:8:19", "typeDescriptions": { "typeIdentifier": "t_array$_t_string_storage_$dyn_storage_ptr", "typeString": "string[]" } }, "id": 1369, "nodeType": "ArrayTypeName", "src": "1195:10:19", "typeDescriptions": { "typeIdentifier": "t_array$_t_array$_t_string_storage_$dyn_storage_$dyn_storage_ptr", "typeString": "string[][]" } }, "visibility": "internal" } ], "src": "1194:38:19" }, "returnParameters": { "id": 1374, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 1373, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 1381, "src": "1260:7:19", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32",