UNPKG

witnet-solidity-bridge

Version:

Witnet Solidity Bridge contracts for EVM-compatible chains

1,121 lines (1,120 loc) 111 kB
{ "contractName": "WitnetV2", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/libs/WitnetV2.sol\":\"WitnetV2\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"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": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212207bd90be9fc487c26e69039523982c11908ba84b7d03602b35d6bba215bb190f564736f6c63430008190033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212207bd90be9fc487c26e69039523982c11908ba84b7d03602b35d6bba215bb190f564736f6c63430008190033", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "96:4561:70:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;96:4561:70;;;;;;;;;;;;;;;;;", "deployedSourceMap": "96:4561:70:-:0;;;;;;;;", "source": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity >=0.8.0 <0.9.0;\r\n\r\nimport \"./Witnet.sol\";\r\n\r\nlibrary WitnetV2 {\r\n\r\n /// Struct containing both request and response data related to every query posted to the Witnet Request Board\r\n struct Query {\r\n Request request;\r\n Response response;\r\n }\r\n\r\n /// Possible status of a Witnet query.\r\n enum QueryStatus {\r\n Unknown,\r\n Posted,\r\n Reported,\r\n Finalized\r\n }\r\n\r\n /// Data kept in EVM-storage for every Request posted to the Witnet Request Board.\r\n struct Request {\r\n address requester; // EVM address from which the request was posted.\r\n uint24 gasCallback; // Max callback gas limit upon response, if a callback is required.\r\n uint72 evmReward; // EVM amount in wei eventually to be paid to the legit result reporter.\r\n bytes witnetBytecode; // Optional: Witnet Data Request bytecode to be solved by the Witnet blockchain.\r\n bytes32 witnetRAD; // Optional: Previously verified hash of the Witnet Data Request to be solved.\r\n WitnetV2.RadonSLA witnetSLA; // Minimum Service-Level parameters to be committed by the Witnet blockchain. \r\n }\r\n\r\n /// Response metadata and result as resolved by the Witnet blockchain.\r\n struct Response {\r\n address reporter; // EVM address from which the Data Request result was reported.\r\n uint64 finality; // EVM block number at which the reported data will be considered to be finalized.\r\n uint32 resultTimestamp; // Unix timestamp (seconds) at which the data request was resolved in the Witnet blockchain.\r\n bytes32 resultTallyHash; // Unique hash of the commit/reveal act in the Witnet blockchain that resolved the data request.\r\n bytes resultCborBytes; // CBOR-encode result to the request, as resolved in the Witnet blockchain.\r\n }\r\n\r\n /// Response status from a requester's point of view.\r\n enum ResponseStatus {\r\n Void,\r\n Awaiting,\r\n Ready,\r\n Error,\r\n Finalizing,\r\n Delivered\r\n }\r\n\r\n struct RadonSLA {\r\n /// @notice Number of nodes in the Witnet blockchain that will take part in solving the data request. \r\n uint8 committeeSize;\r\n \r\n /// @notice Fee in $nanoWIT paid to every node in the Witnet blockchain involved in solving the data request.\r\n /// @dev Witnet nodes participating as witnesses will have to stake as collateral 100x this amount.\r\n uint64 witnessingFeeNanoWit;\r\n }\r\n\r\n \r\n /// ===============================================================================================================\r\n /// --- 'WitnetV2.RadonSLA' helper methods ------------------------------------------------------------------------\r\n\r\n function equalOrGreaterThan(RadonSLA memory a, RadonSLA memory b) \r\n internal pure returns (bool)\r\n {\r\n return (a.committeeSize >= b.committeeSize);\r\n }\r\n \r\n function isValid(RadonSLA calldata sla) internal pure returns (bool) {\r\n return (\r\n sla.witnessingFeeNanoWit > 0 \r\n && sla.committeeSize > 0 && sla.committeeSize <= 127\r\n );\r\n }\r\n\r\n function toV1(RadonSLA memory self) internal pure returns (Witnet.RadonSLA memory) {\r\n return Witnet.RadonSLA({\r\n numWitnesses: self.committeeSize,\r\n minConsensusPercentage: 51,\r\n witnessReward: self.witnessingFeeNanoWit,\r\n witnessCollateral: self.witnessingFeeNanoWit * 100,\r\n minerCommitRevealFee: self.witnessingFeeNanoWit / self.committeeSize\r\n });\r\n }\r\n\r\n function nanoWitTotalFee(RadonSLA storage self) internal view returns (uint64) {\r\n return self.witnessingFeeNanoWit * (self.committeeSize + 3);\r\n }\r\n\r\n\r\n /// ===============================================================================================================\r\n /// --- P-RNG generators ------------------------------------------------------------------------------------------\r\n\r\n /// Generates a pseudo-random uint32 number uniformly distributed within the range `[0 .. range)`, based on\r\n /// the given `nonce` and `seed` values. \r\n function randomUniformUint32(uint32 range, uint256 nonce, bytes32 seed)\r\n internal pure \r\n returns (uint32) \r\n {\r\n uint256 _number = uint256(\r\n keccak256(\r\n abi.encode(seed, nonce)\r\n )\r\n ) & uint256(2 ** 224 - 1);\r\n return uint32((_number * range) >> 224);\r\n }\r\n}\r\n", "sourcePath": "C:\\Users\\guill\\github\\witnet\\witnet-solidity-bridge\\contracts\\libs\\WitnetV2.sol", "ast": { "absolutePath": "project:/contracts/libs/WitnetV2.sol", "exportedSymbols": { "Witnet": [ 17557 ], "WitnetBuffer": [ 19191 ], "WitnetCBOR": [ 20734 ], "WitnetV2": [ 23640 ] }, "id": 23641, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 23446, "literals": [ "solidity", ">=", "0.8", ".0", "<", "0.9", ".0" ], "nodeType": "PragmaDirective", "src": "35:31:70" }, { "absolutePath": "project:/contracts/libs/Witnet.sol", "file": "./Witnet.sol", "id": 23447, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 23641, "sourceUnit": 17558, "src": "70:22:70", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "canonicalName": "WitnetV2", "contractDependencies": [], "contractKind": "library", "fullyImplemented": true, "id": 23640, "linearizedBaseContracts": [ 23640 ], "name": "WitnetV2", "nameLocation": "104:8:70", "nodeType": "ContractDefinition", "nodes": [ { "canonicalName": "WitnetV2.Query", "documentation": { "id": 23448, "nodeType": "StructuredDocumentation", "src": "122:110:70", "text": "Struct containing both request and response data related to every query posted to the Witnet Request Board" }, "id": 23455, "members": [ { "constant": false, "id": 23451, "mutability": "mutable", "name": "request", "nameLocation": "270:7:70", "nodeType": "VariableDeclaration", "scope": 23455, "src": "262:15:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_Request_$23476_storage_ptr", "typeString": "struct WitnetV2.Request" }, "typeName": { "id": 23450, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 23449, "name": "Request", "nameLocations": [ "262:7:70" ], "nodeType": "IdentifierPath", "referencedDeclaration": 23476, "src": "262:7:70" }, "referencedDeclaration": 23476, "src": "262:7:70", "typeDescriptions": { "typeIdentifier": "t_struct$_Request_$23476_storage_ptr", "typeString": "struct WitnetV2.Request" } }, "visibility": "internal" }, { "constant": false, "id": 23454, "mutability": "mutable", "name": "response", "nameLocation": "297:8:70", "nodeType": "VariableDeclaration", "scope": 23455, "src": "288:17:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_Response_$23488_storage_ptr", "typeString": "struct WitnetV2.Response" }, "typeName": { "id": 23453, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 23452, "name": "Response", "nameLocations": [ "288:8:70" ], "nodeType": "IdentifierPath", "referencedDeclaration": 23488, "src": "288:8:70" }, "referencedDeclaration": 23488, "src": "288:8:70", "typeDescriptions": { "typeIdentifier": "t_struct$_Response_$23488_storage_ptr", "typeString": "struct WitnetV2.Response" } }, "visibility": "internal" } ], "name": "Query", "nameLocation": "245:5:70", "nodeType": "StructDefinition", "scope": 23640, "src": "238:75:70", "visibility": "public" }, { "canonicalName": "WitnetV2.QueryStatus", "documentation": { "id": 23456, "nodeType": "StructuredDocumentation", "src": "321:38:70", "text": "Possible status of a Witnet query." }, "id": 23461, "members": [ { "id": 23457, "name": "Unknown", "nameLocation": "393:7:70", "nodeType": "EnumValue", "src": "393:7:70" }, { "id": 23458, "name": "Posted", "nameLocation": "411:6:70", "nodeType": "EnumValue", "src": "411:6:70" }, { "id": 23459, "name": "Reported", "nameLocation": "428:8:70", "nodeType": "EnumValue", "src": "428:8:70" }, { "id": 23460, "name": "Finalized", "nameLocation": "447:9:70", "nodeType": "EnumValue", "src": "447:9:70" } ], "name": "QueryStatus", "nameLocation": "370:11:70", "nodeType": "EnumDefinition", "src": "365:98:70" }, { "canonicalName": "WitnetV2.Request", "documentation": { "id": 23462, "nodeType": "StructuredDocumentation", "src": "471:82:70", "text": "Data kept in EVM-storage for every Request posted to the Witnet Request Board." }, "id": 23476, "members": [ { "constant": false, "id": 23464, "mutability": "mutable", "name": "requester", "nameLocation": "593:9:70", "nodeType": "VariableDeclaration", "scope": 23476, "src": "585:17:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 23463, "name": "address", "nodeType": "ElementaryTypeName", "src": "585:7:70", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" }, { "constant": false, "id": 23466, "mutability": "mutable", "name": "gasCallback", "nameLocation": "684:11:70", "nodeType": "VariableDeclaration", "scope": 23476, "src": "676:19:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint24", "typeString": "uint24" }, "typeName": { "id": 23465, "name": "uint24", "nodeType": "ElementaryTypeName", "src": "676:6:70", "typeDescriptions": { "typeIdentifier": "t_uint24", "typeString": "uint24" } }, "visibility": "internal" }, { "constant": false, "id": 23468, "mutability": "mutable", "name": "evmReward", "nameLocation": "793:9:70", "nodeType": "VariableDeclaration", "scope": 23476, "src": "785:17:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint72", "typeString": "uint72" }, "typeName": { "id": 23467, "name": "uint72", "nodeType": "ElementaryTypeName", "src": "785:6:70", "typeDescriptions": { "typeIdentifier": "t_uint72", "typeString": "uint72" } }, "visibility": "internal" }, { "constant": false, "id": 23470, "mutability": "mutable", "name": "witnetBytecode", "nameLocation": "907:14:70", "nodeType": "VariableDeclaration", "scope": 23476, "src": "899:22:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" }, "typeName": { "id": 23469, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "899:5:70", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "visibility": "internal" }, { "constant": false, "id": 23472, "mutability": "mutable", "name": "witnetRAD", "nameLocation": "1029:9:70", "nodeType": "VariableDeclaration", "scope": 23476, "src": "1021:17:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 23471, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1021:7:70", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "visibility": "internal" }, { "constant": false, "id": 23475, "mutability": "mutable", "name": "witnetSLA", "nameLocation": "1159:9:70", "nodeType": "VariableDeclaration", "scope": 23476, "src": "1141:27:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_RadonSLA_$23503_storage_ptr", "typeString": "struct WitnetV2.RadonSLA" }, "typeName": { "id": 23474, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 23473, "name": "WitnetV2.RadonSLA", "nameLocations": [ "1141:8:70", "1150:8:70" ], "nodeType": "IdentifierPath", "referencedDeclaration": 23503, "src": "1141:17:70" }, "referencedDeclaration": 23503, "src": "1141:17:70", "typeDescriptions": { "typeIdentifier": "t_struct$_RadonSLA_$23503_storage_ptr", "typeString": "struct WitnetV2.RadonSLA" } }, "visibility": "internal" } ], "name": "Request", "nameLocation": "566:7:70", "nodeType": "StructDefinition", "scope": 23640, "src": "559:699:70", "visibility": "public" }, { "canonicalName": "WitnetV2.Response", "documentation": { "id": 23477, "nodeType": "StructuredDocumentation", "src": "1266:70:70", "text": "Response metadata and result as resolved by the Witnet blockchain." }, "id": 23488, "members": [ { "constant": false, "id": 23479, "mutability": "mutable", "name": "reporter", "nameLocation": "1377:8:70", "nodeType": "VariableDeclaration", "scope": 23488, "src": "1369:16:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 23478, "name": "address", "nodeType": "ElementaryTypeName", "src": "1369:7:70", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "visibility": "internal" }, { "constant": false, "id": 23481, "mutability": "mutable", "name": "finality", "nameLocation": "1482:8:70", "nodeType": "VariableDeclaration", "scope": 23488, "src": "1474:16:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" }, "typeName": { "id": 23480, "name": "uint64", "nodeType": "ElementaryTypeName", "src": "1474:6:70", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "visibility": "internal" }, { "constant": false, "id": 23483, "mutability": "mutable", "name": "resultTimestamp", "nameLocation": "1606:15:70", "nodeType": "VariableDeclaration", "scope": 23488, "src": "1598:23:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" }, "typeName": { "id": 23482, "name": "uint32", "nodeType": "ElementaryTypeName", "src": "1598:6:70", "typeDescriptions": { "typeIdentifier": "t_uint32", "typeString": "uint32" } }, "visibility": "internal" }, { "constant": false, "id": 23485, "mutability": "mutable", "name": "resultTallyHash", "nameLocation": "1740:15:70", "nodeType": "VariableDeclaration", "scope": 23488, "src": "1732:23:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 23484, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1732:7:70", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "visibility": "internal" }, { "constant": false, "id": 23487, "mutability": "mutable", "name": "resultCborBytes", "nameLocation": "1878:15:70", "nodeType": "VariableDeclaration", "scope": 23488, "src": "1870:23:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" }, "typeName": { "id": 23486, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "1870:5:70", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "visibility": "internal" } ], "name": "Response", "nameLocation": "1349:8:70", "nodeType": "StructDefinition", "scope": 23640, "src": "1342:642:70", "visibility": "public" }, { "canonicalName": "WitnetV2.ResponseStatus", "documentation": { "id": 23489, "nodeType": "StructuredDocumentation", "src": "1992:53:70", "text": "Response status from a requester's point of view." }, "id": 23496, "members": [ { "id": 23490, "name": "Void", "nameLocation": "2082:4:70", "nodeType": "EnumValue", "src": "2082:4:70" }, { "id": 23491, "name": "Awaiting", "nameLocation": "2097:8:70", "nodeType": "EnumValue", "src": "2097:8:70" }, { "id": 23492, "name": "Ready", "nameLocation": "2116:5:70", "nodeType": "EnumValue", "src": "2116:5:70" }, { "id": 23493, "name": "Error", "nameLocation": "2132:5:70", "nodeType": "EnumValue", "src": "2132:5:70" }, { "id": 23494, "name": "Finalizing", "nameLocation": "2148:10:70", "nodeType": "EnumValue", "src": "2148:10:70" }, { "id": 23495, "name": "Delivered", "nameLocation": "2169:9:70", "nodeType": "EnumValue", "src": "2169:9:70" } ], "name": "ResponseStatus", "nameLocation": "2056:14:70", "nodeType": "EnumDefinition", "src": "2051:134:70" }, { "canonicalName": "WitnetV2.RadonSLA", "id": 23503, "members": [ { "constant": false, "id": 23499, "mutability": "mutable", "name": "committeeSize", "nameLocation": "2340:13:70", "nodeType": "VariableDeclaration", "scope": 23503, "src": "2332:21:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 23498, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "2332:5:70", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "visibility": "internal" }, { "constant": false, "id": 23502, "mutability": "mutable", "name": "witnessingFeeNanoWit", "nameLocation": "2610:20:70", "nodeType": "VariableDeclaration", "scope": 23503, "src": "2602:28:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" }, "typeName": { "id": 23501, "name": "uint64", "nodeType": "ElementaryTypeName", "src": "2602:6:70", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "visibility": "internal" } ], "name": "RadonSLA", "nameLocation": "2200:8:70", "nodeType": "StructDefinition", "scope": 23640, "src": "2193:445:70", "visibility": "public" }, { "body": { "id": 23522, "nodeType": "Block", "src": "3006:62:70", "statements": [ { "expression": { "components": [ { "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 23519, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { "id": 23515, "name": "a", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 23507, "src": "3025:1:70", "typeDescriptions": { "typeIdentifier": "t_struct$_RadonSLA_$23503_memory_ptr", "typeString": "struct WitnetV2.RadonSLA memory" } }, "id": 23516, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberLocation": "3027:13:70", "memberName": "committeeSize", "nodeType": "MemberAccess", "referencedDeclaration": 23499, "src": "3025:15:70", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": ">=", "rightExpression": { "expression": { "id": 23517, "name": "b", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 23510, "src": "3044:1:70", "typeDescriptions": { "typeIdentifier": "t_struct$_RadonSLA_$23503_memory_ptr", "typeString": "struct WitnetV2.RadonSLA memory" } }, "id": 23518, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberLocation": "3046:13:70", "memberName": "committeeSize", "nodeType": "MemberAccess", "referencedDeclaration": 23499, "src": "3044:15:70", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "src": "3025:34:70", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "id": 23520, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "3024:36:70", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 23514, "id": 23521, "nodeType": "Return", "src": "3017:43:70" } ] }, "documentation": { "id": 23504, "nodeType": "StructuredDocumentation", "src": "2652:238:70", "text": "===============================================================================================================\n --- 'WitnetV2.RadonSLA' helper methods ------------------------------------------------------------------------" }, "id": 23523, "implemented": true, "kind": "function", "modifiers": [], "name": "equalOrGreaterThan", "nameLocation": "2905:18:70", "nodeType": "FunctionDefinition", "parameters": { "id": 23511, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 23507, "mutability": "mutable", "name": "a", "nameLocation": "2940:1:70", "nodeType": "VariableDeclaration", "scope": 23523, "src": "2924:17:70", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_RadonSLA_$23503_memory_ptr", "typeString": "struct WitnetV2.RadonSLA" }, "typeName": { "id": 23506, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 23505, "name": "RadonSLA", "nameLocations": [ "2924:8:70" ], "nodeType": "IdentifierPath", "referencedDeclaration": 23503, "src": "2924:8:70" }, "referencedDeclaration": 23503, "src": "2924:8:70", "typeDescriptions": { "typeIdentifier": "t_struct$_RadonSLA_$23503_storage_ptr", "typeString": "struct WitnetV2.RadonSLA" } }, "visibility": "internal" }, { "constant": false, "id": 23510, "mutability": "mutable", "name": "b", "nameLocation": "2959:1:70", "nodeType": "VariableDeclaration", "scope": 23523, "src": "2943:17:70", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_struct$_RadonSLA_$23503_memory_ptr", "typeString": "struct WitnetV2.RadonSLA" }, "typeName": { "id": 23509, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 23508, "name": "RadonSLA", "nameLocations": [ "2943:8:70" ], "nodeType": "IdentifierPath", "referencedDeclaration": 23503, "src": "2943:8:70" }, "referencedDeclaration": 23503, "src": "2943:8:70", "typeDescriptions": { "typeIdentifier": "t_struct$_RadonSLA_$23503_storage_ptr", "typeString": "struct WitnetV2.RadonSLA" } }, "visibility": "internal" } ], "src": "2923:38:70" }, "returnParameters": { "id": 23514, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 23513, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 23523, "src": "2995:4:70", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 23512, "name": "bool", "nodeType": "ElementaryTypeName", "src": "2995:4:70", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "visibility": "internal" } ], "src": "2994:6:70" }, "scope": 23640, "src": "2896:172:70", "stateMutability": "pure", "virtual": false, "visibility": "internal" }, { "body": { "id": 23547, "nodeType": "Block", "src": "3150:151:70", "statements": [ { "expression": { "components": [ { "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 23544, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 23539, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "commonType": { "typeIdentifier": "t_uint64", "typeString": "uint64" }, "id": 23534, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { "id": 23531, "name": "sla", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 23526, "src": "3183:3:70", "typeDescriptions": { "typeIdentifier": "t_struct$_RadonSLA_$23503_calldata_ptr", "typeString": "struct WitnetV2.RadonSLA calldata" } }, "id": 23532, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberLocation": "3187:20:70", "memberName": "witnessingFeeNanoWit", "nodeType": "MemberAccess", "referencedDeclaration": 23502, "src": "3183:24:70", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "hexValue": "30", "id": 23533, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3210:1:70", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "3183:28:70", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "&&", "rightExpression": { "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 23538, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { "id": 23535, "name": "sla", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 23526, "src": "3233:3:70", "typeDescriptions": { "typeIdentifier": "t_struct$_RadonSLA_$23503_calldata_ptr", "typeString": "struct WitnetV2.RadonSLA calldata" } }, "id": 23536, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberLocation": "3237:13:70", "memberName": "committeeSize", "nodeType": "MemberAccess", "referencedDeclaration": 23499, "src": "3233:17:70", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "hexValue": "30", "id": 23537, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "3253:1:70", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "3233:21:70", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "3183:71:70", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "&&", "rightExpression": { "commonType": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "id": 23543, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { "id": 23540, "name": "sla", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 23526, "src": "3258:3:70", "typeDescriptions": { "typeIdentifier": "t_struct$_RadonSLA_$23503_calldata_ptr", "typeString": "struct WitnetV2.RadonSLA calldata" } }, "id": 23541, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberLocation": "3262:13:70", "memberName": "committeeSize", "nodeType": "MemberAccess", "referencedDeclaration": 23499, "src": "3258:17:70", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "nodeType": "BinaryOperation",