UNPKG

witnet-solidity-bridge

Version:

Witnet Solidity Bridge contracts for EVM-compatible chains

992 lines (991 loc) 115 kB
{ "contractName": "UsingWitOracle", "abi": [ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "evmRequester", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "evmGasPrice", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmReward", "type": "uint256" }, { "indexed": false, "internalType": "Witnet.QueryId", "name": "queryId", "type": "uint64" }, { "indexed": false, "internalType": "Witnet.RadonHash", "name": "radonHash", "type": "bytes32" }, { "components": [ { "internalType": "uint16", "name": "witResultMaxSize", "type": "uint16" }, { "internalType": "uint16", "name": "witCommitteeSize", "type": "uint16" }, { "internalType": "uint64", "name": "witUnitaryReward", "type": "uint64" } ], "indexed": false, "internalType": "struct Witnet.QuerySLA", "name": "radonParams", "type": "tuple" } ], "name": "WitOracleQuery", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "Witnet.QueryId", "name": "queryId", "type": "uint64" }, { "indexed": false, "internalType": "uint256", "name": "evmGasPrice", "type": "uint256" } ], "name": "WitOracleQueryReport", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "Witnet.QueryId", "name": "queryId", "type": "uint64" }, { "indexed": false, "internalType": "address", "name": "evmConsumer", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "evmGasPrice", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmCallbackGas", "type": "uint256" } ], "name": "WitOracleQueryReportDelivery", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "Witnet.QueryId", "name": "queryId", "type": "uint64" }, { "indexed": false, "internalType": "address", "name": "evmDisputer", "type": "address" } ], "name": "WitOracleQueryReportDispute", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "Witnet.QueryId", "name": "queryId", "type": "uint64" }, { "indexed": false, "internalType": "address", "name": "evmSender", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "evmGasPrice", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmReward", "type": "uint256" } ], "name": "WitOracleQueryUpgrade", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "Witnet.QueryId", "name": "queryId", "type": "uint64" }, { "indexed": false, "internalType": "address", "name": "evmConsumer", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "evmGasPrice", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmCallbackActualGas", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "evmCallbackRevertReason", "type": "string" }, { "indexed": false, "internalType": "bytes", "name": "resultCborBytes", "type": "bytes" } ], "name": "WitOracleResportDeliveryFailed", "type": "event" }, { "inputs": [], "name": "witOracle", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"evmRequester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmReward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"Witnet.QueryId\",\"name\":\"queryId\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"Witnet.RadonHash\",\"name\":\"radonHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint16\",\"name\":\"witResultMaxSize\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"witCommitteeSize\",\"type\":\"uint16\"},{\"internalType\":\"uint64\",\"name\":\"witUnitaryReward\",\"type\":\"uint64\"}],\"indexed\":false,\"internalType\":\"struct Witnet.QuerySLA\",\"name\":\"radonParams\",\"type\":\"tuple\"}],\"name\":\"WitOracleQuery\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"Witnet.QueryId\",\"name\":\"queryId\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"}],\"name\":\"WitOracleQueryReport\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"Witnet.QueryId\",\"name\":\"queryId\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"evmConsumer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmCallbackGas\",\"type\":\"uint256\"}],\"name\":\"WitOracleQueryReportDelivery\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"Witnet.QueryId\",\"name\":\"queryId\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"evmDisputer\",\"type\":\"address\"}],\"name\":\"WitOracleQueryReportDispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"Witnet.QueryId\",\"name\":\"queryId\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"evmSender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmReward\",\"type\":\"uint256\"}],\"name\":\"WitOracleQueryUpgrade\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"Witnet.QueryId\",\"name\":\"queryId\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"evmConsumer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmCallbackActualGas\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"evmCallbackRevertReason\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"resultCborBytes\",\"type\":\"bytes\"}],\"name\":\"WitOracleResportDeliveryFailed\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"witOracle\",\"outputs\":[{\"internalType\":\"address\",\"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\":{\"_witOracle\":\"Address of the WitOracle bridging contract.\"}}},\"stateVariables\":{\"__witOracleBaseFeeOverheadPercentage\":{\"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. \"}},\"title\":\"The UsingWitOracle contract\",\"version\":1},\"userdoc\":{\"events\":{\"WitOracleQuery(address,uint256,uint256,uint64,bytes32,(uint16,uint16,uint64))\":{\"notice\":\"Emitted every time a new query containing some verified data request is posted to the WitOracle.\"},\"WitOracleQueryReport(uint64,uint256)\":{\"notice\":\"Emitted when a query with no callback gets reported into the WRB.\"},\"WitOracleQueryReportDelivery(uint64,address,uint256,uint256)\":{\"notice\":\"Emitted when a query with a callback gets successfully reported into the WRB.\"},\"WitOracleQueryUpgrade(uint64,address,uint256,uint256)\":{\"notice\":\"Emitted when the reward of some not-yet reported query gets upgraded.\"},\"WitOracleResportDeliveryFailed(uint64,address,uint256,uint256,string,bytes)\":{\"notice\":\"Emitted when a query with a callback cannot get reported into the WRB.\"}},\"kind\":\"user\",\"methods\":{\"witOracle()\":{\"notice\":\"Immutable reference to the WitOracle contract.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/mockups/UsingWitOracle.sol\":\"UsingWitOracle\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/WitOracle.sol\":{\"keccak256\":\"0x7f20eab15140df459753dfa8e406b826918b56ebe2c46456f9d04345c02629d1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e0573ce3d48200c71d8235a1a8c055b706420b2037bd21336f3c61713c3b8349\",\"dweb:/ipfs/QmY7BnVaNXFtJs1BFdeaa7dQfvUVoZyfwtv9HuToCxUUHU\"]},\"project:/contracts/interfaces/IWitAppliance.sol\":{\"keccak256\":\"0xd207ca54a1049445a3d99eea497d9b34c6dbdd44d771eee825e4c031bd2f447e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f81de32d868ff2881ed6fe97cc897e40b4b11d23cbe53a0e23cf3e68f9c0f0a3\",\"dweb:/ipfs/QmeeXmzmK5MAzt7Hf5DB2L81efKtTzZg9VbQ8sUiTqEk5c\"]},\"project:/contracts/interfaces/IWitOracle.sol\":{\"keccak256\":\"0x26cbe2074c0b3f545a46d95fad5e2280b67edcd958e4ae0b88f3a018aa11b805\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5324bac61f65e3edb01c88b9b75ca17affd593be88da5753a93b3f5304d3f479\",\"dweb:/ipfs/QmcVmNV6smbFiPaxvuN8ShkqbDZsT1wfjnF7f3qs6ke7QG\"]},\"project:/contracts/interfaces/IWitOracleAppliance.sol\":{\"keccak256\":\"0xcd8e57eca7f8042c85a83264e2ff6d1cd7a9f1521831736d7f57bcc7800642e6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5c639668e9439d60770b5df77436088ae7bd0aeb1d1be446552a98b6c29138f0\",\"dweb:/ipfs/QmbN3f5YuKMSd2j9tjay3VEkiYibGWpbfbwRNyrxA8k4o4\"]},\"project:/contracts/interfaces/IWitOracleQueriable.sol\":{\"keccak256\":\"0xdb0da1e377a35a7d620f43cb583a876750a52d91da2b888f48042483ad9c4910\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://edfcdf3e96ec3c5de7438f82e3d5a1dc9af9eb29080044213dccb26ff978354c\",\"dweb:/ipfs/Qmap2FzSysh2fug88eortbsTM7itFygRzKc9HfV43ePMik\"]},\"project:/contracts/interfaces/IWitOracleQueriableEvents.sol\":{\"keccak256\":\"0x47c283e931006d35bd2599524f86724e45eae6fad2fdd9cdecd1c85a90ff3f8c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3ad0520f99ec9298536ae9434f58caeb470c10dd3eaab1e4c7ed4cae9a97e2a2\",\"dweb:/ipfs/QmSuYCsSPweZfQc5Fbf9jYDdx4u7gwYCUdjhpcrrxmWZy6\"]},\"project:/contracts/interfaces/IWitOracleRadonRegistry.sol\":{\"keccak256\":\"0x437bbb89129311bd1cc8f6becd333df46109ec53b24d3159be942b225614071f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ef9bcdf4a73cb126885478c994821b7fe2b87d9221b767b4c9342b89b0d6550a\",\"dweb:/ipfs/QmXzZXPMxjSiFpcEnhg6CjLFNxGCpDZt22xpUh7VHxNTGd\"]},\"project:/contracts/libs/Bech32.sol\":{\"keccak256\":\"0x14618323a0efe7586c20906a2e9cee7ad63baa976ff231c57f7f2d7d3707fb8b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a19f05fe84047a7a6d3d6fc39972b432e6e536aa70472386a9d7a6d9aab64a64\",\"dweb:/ipfs/QmcHwUY66yjiotRH4Q3kbRvSzcHyLQ1yHL3KbtQKiMhtZE\"]},\"project:/contracts/libs/Secp256k1.sol\":{\"keccak256\":\"0xbe686002da5004ff39dd70709f3820eba2afe9323ae9cb894009c161e4b1a666\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18fab91775216de0707cea9ad285b10be09127461a13432fea358bf9cb2a0c2e\",\"dweb:/ipfs/QmeRUGsgstnM4hxM9hpkBf3L6cE5btirEaowcMxmuw3utj\"]},\"project:/contracts/libs/Witnet.sol\":{\"keccak256\":\"0x1d446c3e534e40e676d1763bfb2897fadfac8afed904ab757843d7d6770b0a6c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://338fb1073f17d64e8d31bfe492d9475ce906788ee08e6489ce30413f91dc1328\",\"dweb:/ipfs/QmPe5QX2AGTnQFjse1Xttq4ZYWwYAiXoySb5VUui3PqPhk\"]},\"project:/contracts/libs/WitnetBuffer.sol\":{\"keccak256\":\"0x8e07aebe2954ab3e6f2d8eceedb12db7cf915c1f3e8630f4fa9999cecb1c78ec\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ed6c54cc901183d61546e8fd15bd5ea8ef238ebc915642946071d435dd7481ea\",\"dweb:/ipfs/Qmcaqta7YjUSBbBUGqoh44bsCS6UqqoyHjBuz4qnKBShXM\"]},\"project:/contracts/libs/WitnetCBOR.sol\":{\"keccak256\":\"0xd99308373575cc10fb7f2ceb0f6a8625f3911275c1fa27811fae498d98d03d97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b4909a999d7b660a2dc54ca957b6eccfa523e2765fc4d6a2574dee7d5cd67b43\",\"dweb:/ipfs/QmWGQT4KDcfSFe1hcHVoWx6E4PhYMaod5iLpJCWBEeShzh\"]},\"project:/contracts/mockups/UsingWitOracle.sol\":{\"keccak256\":\"0x0267939c44b36438369cd253c3e4114b6311066dfe255934948d73b7bb8504ad\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://796712b61479f428718954f2367c16bef9813cfbf485e52b1895bdaf0f03ed37\",\"dweb:/ipfs/QmWMz37qL2qQkyHyuoKtmFjAL4Cjcsy8s3xXdbza7LRizi\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "", "deployedSourceMap": "", "source": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity >=0.8.0 <0.9.0;\r\n\r\nimport \"../WitOracle.sol\";\r\n\r\n/// @title The UsingWitOracle 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 UsingWitOracle\r\n is\r\n IWitOracleQueriableEvents\r\n{ \r\n /// @notice Immutable reference to the WitOracle contract.\r\n function witOracle() virtual public view returns (address) {\r\n return address(__witOracle);\r\n }\r\n WitOracle internal immutable __witOracle;\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 __witOracleBaseFeeOverheadPercentage;\r\n\r\n /// @notice Default SLA data security parameters to be fulfilled by the Wit/Oracle blockchain\r\n /// @notice when solving a data request.\r\n Witnet.QuerySLA internal __witOracleDefaultQueryParams;\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 from the Wit/Oracle blockchain,\r\n /// @dev either with an error or successfully.\r\n modifier witOracleQuerySolved(uint256 _queryId) {\r\n Witnet.QueryStatus _queryStatus = _witOracleCheckQueryStatus(_queryId);\r\n require(\r\n _queryStatus == Witnet.QueryStatus.Finalized\r\n || _queryStatus == Witnet.QueryStatus.Expired\r\n || _queryStatus == Witnet.QueryStatus.Disputed\r\n , \"UsingWitOracle: unsolved query\"\r\n ); _;\r\n }\r\n\r\n /// @param _witOracle Address of the WitOracle bridging contract.\r\n constructor(address _witOracle) {\r\n require(\r\n IWitAppliance(_witOracle).specs() == (\r\n type(IWitOracle).interfaceId\r\n ^ type(IWitOracleQueriable).interfaceId\r\n ), \"UsingWitOracle: uncompliant WitOracle\"\r\n );\r\n __witOracle = WitOracle(_witOracle);\r\n __witOracleDefaultQueryParams = Witnet.QuerySLA({\r\n witResultMaxSize: 32, // defaults to 32 bytes\r\n witCommitteeSize: 3, // defaults to 10 witnesses\r\n witUnitaryReward: 2 * 10 ** 8 // defaults to 0.2 $WIT\r\n });\r\n \r\n __witOracleBaseFeeOverheadPercentage = 33; // defaults to 33%\r\n }\r\n\r\n /// @dev Check if given query was already reported back from the Wit/Oracle blockchain.\r\n /// @param _id The unique identifier of a previously posted data request.\r\n function _witOracleCheckQueryStatus(uint256 _id)\r\n internal view\r\n returns (Witnet.QueryStatus)\r\n {\r\n return __witOracle.getQueryStatus(_id);\r\n }\r\n\r\n /// @dev Estimate the minimum reward required for posting a data request (based on `tx.gasprice`).\r\n function _witOracleEstimateBaseFee() virtual internal view returns (uint256) {\r\n return _witOracleEstimateBaseFee(tx.gasprice);\r\n }\r\n\r\n function _witOracleEstimateBaseFee(uint256 _evmGasPrice) virtual internal view returns (uint256) {\r\n return (\r\n __witOracle.estimateBaseFee(_evmGasPrice)\r\n * (100 + __witOracleBaseFeeOverheadPercentage)\r\n ) / 100;\r\n }\r\n}\r\n", "sourcePath": "C:\\Users\\guill\\github\\guidiaz\\witnet-solidity-bridge\\contracts\\mockups\\UsingWitOracle.sol", "ast": { "absolutePath": "project:/contracts/mockups/UsingWitOracle.sol", "exportedSymbols": { "Bech32": [ 31372 ], "IWitAppliance": [ 26514 ], "IWitOracle": [ 26581 ], "IWitOracleAppliance": [ 26593 ], "IWitOracleQueriable": [ 26795 ], "IWitOracleQueriableEvents": [ 26892 ], "IWitOracleRadonRegistry": [ 27394 ], "Secp256k1": [ 32535 ], "UsingWitOracle": [ 44338 ], "WitOracle": [ 678 ], "Witnet": [ 40741 ], "WitnetBuffer": [ 42631 ], "WitnetCBOR": [ 44174 ] }, "id": 44339, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 44176, "literals": [ "solidity", ">=", "0.8", ".0", "<", "0.9", ".0" ], "nodeType": "PragmaDirective", "src": "35:31:119" }, { "absolutePath": "project:/contracts/WitOracle.sol", "file": "../WitOracle.sol", "id": 44177, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 44339, "sourceUnit": 679, "src": "70:26:119", "symbolAliases": [], "unitAlias": "" }, { "abstract": true, "baseContracts": [ { "baseName": { "id": 44179, "name": "IWitOracleQueriableEvents", "nameLocations": [ "324:25:119" ], "nodeType": "IdentifierPath", "referencedDeclaration": 26892, "src": "324:25:119" }, "id": 44180, "nodeType": "InheritanceSpecifier", "src": "324:25:119" } ], "canonicalName": "UsingWitOracle", "contractDependencies": [], "contractKind": "contract", "documentation": { "id": 44178, "nodeType": "StructuredDocumentation", "src": "100:174:119", "text": "@title The UsingWitOracle 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": 44338, "linearizedBaseContracts": [ 44338, 26892 ], "name": "UsingWitOracle", "nameLocation": "292:14:119", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 44191, "nodeType": "Block", "src": "484:46:119", "statements": [ { "expression": { "arguments": [ { "id": 44188, "name": "__witOracle", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 44195, "src": "510:11:119", "typeDescriptions": { "typeIdentifier": "t_contract$_WitOracle_$678", "typeString": "contract WitOracle" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_WitOracle_$678", "typeString": "contract WitOracle" } ], "id": 44187, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "502:7:119", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 44186, "name": "address", "nodeType": "ElementaryTypeName", "src": "502:7:119", "typeDescriptions": {} } }, "id": 44189, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "502:20:119", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 44185, "id": 44190, "nodeType": "Return", "src": "495:27:119" } ] }, "documentation": { "id": 44181, "nodeType": "StructuredDocumentation", "src": "361:58:119", "text": "@notice Immutable reference to the WitOracle contract." }, "functionSelector": "1014d375", "id": 44192, "implemented": true, "kind": "function", "modifiers": [], "name": "witOracle", "nameLocation": "434:9:119", "nodeType": "FunctionDefinition", "parameters": { "id": 44182, "nodeType": "ParameterList", "parameters": [], "src": "443:2:119" }, "returnParameters": { "id": 44185, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 44184, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 44192, "src": "475:7:119", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 44183, "name": "address", "nodeType": "ElementaryTypeName", "src": "475:7:119", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" } ], "src": "474:9:119" }, "scope": 44338, "src": "425:105:119", "stateMutability": "view", "virtual": true, "visibility": "public" }, { "constant": false, "id": 44195, "mutability": "immutable", "name": "__witOracle", "nameLocation": "565:11:119", "nodeType": "VariableDeclaration", "scope": 44338, "src": "536:40:119", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_WitOracle_$678", "typeString": "contract WitOracle" }, "typeName": { "id": 44194, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 44193, "name": "WitOracle", "nameLocations": [ "536:9:119" ], "nodeType": "IdentifierPath", "referencedDeclaration": 678, "src": "536:9:119" }, "referencedDeclaration": 678, "src": "536:9:119", "typeDescriptions": { "typeIdentifier": "t_contract$_WitOracle_$678", "typeString": "contract WitOracle" } }, "visibility": "internal" }, { "constant": false, "documentation": { "id": 44196, "nodeType": "StructuredDocumentation", "src": "589:327:119", "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": 44198, "mutability": "mutable", "name": "__witOracleBaseFeeOverheadPercentage", "nameLocation": "938:36:119", "nodeType": "VariableDeclaration", "scope": 44338, "src": "922:52:119", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" }, "typeName": { "id": 44197, "name": "uint16", "nodeType": "ElementaryTypeName", "src": "922:6:119", "typeDescriptions": { "typeIdentifier": "t_uint16", "typeString": "uint16" } }, "visibility": "internal" }, { "constant": false, "documentation": { "id": 44199, "nodeType": "StructuredDocumentation", "src": "983:139:119", "text": "@notice Default SLA data security parameters to be fulfilled by the Wit/Oracle blockchain\n @notice when solving a data request." }, "id": 44202, "mutability": "mutable", "name": "__witOracleDefaultQueryParams", "nameLocation": "1153:29:119", "nodeType": "VariableDeclaration", "scope": 44338, "src": "1128:54:119", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_QuerySLA_$37373_storage", "typeString": "struct Witnet.QuerySLA" }, "typeName": { "id": 44201, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 44200, "name": "Witnet.QuerySLA", "nameLocations": [ "1128:6:119", "1135:8:119" ], "nodeType": "IdentifierPath", "referencedDeclaration": 37373, "src": "1128:15:119" }, "referencedDeclaration": 37373, "src": "1128:15:119", "typeDescriptions": { "typeIdentifier": "t_struct$_QuerySLA_$37373_storage_ptr", "typeString": "struct Witnet.QuerySLA" } }, "visibility": "internal" }, { "body": { "id": 44238, "nodeType": "Block", "src": "1539:355:119", "statements": [ { "assignments": [ 44211 ], "declarations": [ { "constant": false, "id": 44211, "mutability": "mutable", "name": "_queryStatus", "nameLocation": "1569:12:119", "nodeType": "VariableDeclaration", "scope": 44238, "src": "1550:31:119", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" }, "typeName": { "id": 44210, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 44209, "name": "Witnet.QueryStatus", "nameLocations": [ "1550:6:119", "1557:11:119" ], "nodeType": "IdentifierPath", "referencedDeclaration": 37335, "src": "1550:18:119" }, "referencedDeclaration": 37335, "src": "1550:18:119", "typeDescriptions": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" } }, "visibility": "internal" } ], "id": 44215, "initialValue": { "arguments": [ { "id": 44213, "name": "_queryId", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 44205, "src": "1611:8:119", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 44212, "name": "_witOracleCheckQueryStatus", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 44304, "src": "1584:26:119", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_enum$_QueryStatus_$37335_$", "typeString": "function (uint256) view returns (enum Witnet.QueryStatus)" } }, "id": 44214, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "nameLocations": [], "names": [], "nodeType": "FunctionCall", "src": "1584:36:119", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" } }, "nodeType": "VariableDeclarationStatement", "src": "1550:70:119" }, { "expression": { "arguments": [ { "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 44233, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 44227, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "commonType": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" }, "id": 44221, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 44217, "name": "_queryStatus", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 44211, "src": "1653:12:119", "typeDescriptions": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "expression": { "expression": { "id": 44218, "name": "Witnet", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40741, "src": "1669:6:119", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Witnet_$40741_$", "typeString": "type(library Witnet)" } }, "id": 44219, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberLocation": "1676:11:119", "memberName": "QueryStatus", "nodeType": "MemberAccess", "referencedDeclaration": 37335, "src": "1669:18:119", "typeDescriptions": { "typeIdentifier": "t_type$_t_enum$_QueryStatus_$37335_$", "typeString": "type(enum Witnet.QueryStatus)" } }, "id": 44220, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberLocation": "1688:9:119", "memberName": "Finalized", "nodeType": "MemberAccess", "referencedDeclaration": 37331, "src": "1669:28:119", "typeDescriptions": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" } }, "src": "1653:44:119", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "||", "rightExpression": { "commonType": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" }, "id": 44226, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 44222, "name": "_queryStatus", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 44211, "src": "1718:12:119", "typeDescriptions": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "expression": { "expression": { "id": 44223, "name": "Witnet", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40741, "src": "1734:6:119", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Witnet_$40741_$", "typeString": "type(library Witnet)" } }, "id": 44224, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberLocation": "1741:11:119", "memberName": "QueryStatus", "nodeType": "MemberAccess", "referencedDeclaration": 37335, "src": "1734:18:119", "typeDescriptions": { "typeIdentifier": "t_type$_t_enum$_QueryStatus_$37335_$", "typeString": "type(enum Witnet.QueryStatus)" } }, "id": 44225, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberLocation": "1753:7:119", "memberName": "Expired", "nodeType": "MemberAccess", "referencedDeclaration": 37333, "src": "1734:26:119", "typeDescriptions": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" } }, "src": "1718:42:119", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "1653:107:119", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "||", "rightExpression": { "commonType": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" }, "id": 44232, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "id": 44228, "name": "_queryStatus", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 44211, "src": "1781:12:119", "typeDescriptions": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "expression": { "expression": { "id": 44229, "name": "Witnet", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40741, "src": "1797:6:119", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Witnet_$40741_$", "typeString": "type(library Witnet)" } }, "id": 44230, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberLocation": "1804:11:119", "memberName": "QueryStatus", "nodeType": "MemberAccess", "referencedDeclaration": 37335, "src": "1797:18:119", "typeDescriptions": { "typeIdentifier": "t_type$_t_enum$_QueryStatus_$37335_$", "typeString": "type(enum Witnet.QueryStatus)" } }, "id": 44231, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberLocation": "1816:8:119", "memberName": "Disputed", "nodeType": "MemberAccess", "referencedDeclaration": 37334, "src": "1797:27:119", "typeDescriptions": { "typeIdentifier": "t_enum$_QueryStatus_$37335", "typeString": "enum Witnet.QueryStatus" } }, "src": "1781:43:119", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "1653:171:119", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "hexValue": "5573696e675769744f7261636c653a20756e736f6c766564207175657279", "id": 44234, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "1840:32:119", "typeDescriptions": { "typeIdentifier": "t_stringliteral_8d371d1bd625ece18000bb0c75a4f5761efe5c0719593a155977fbbaf4b37fc5", "typeString": "literal_string \"UsingWitOracle: unsolved query\"" }, "value": "UsingWitOracle: unsolved query" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_8d371d1bd625ece18000bb0c75a4f5761efe5c0719593a155977fbbaf4b37fc5", "typeString": "literal_string \"UsingWitOracle: unsolved query\"" } ], "id": 44216, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 4294967278, 4294967278, 4294967278 ], "referencedDeclaration": 4294967278, "src": "1631:7:119", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",