UNPKG

witnet-solidity-bridge

Version:

Witnet Solidity Bridge contracts for EVM-compatible chains

453 lines 21 kB
{ "contractName": "IWitRandomnessConsumer", "abi": [ { "inputs": [ { "internalType": "bytes32", "name": "randomness", "type": "bytes32" }, { "internalType": "uint256", "name": "evmRandomizeBlock", "type": "uint256" }, { "internalType": "uint256", "name": "evmFinalityBlock", "type": "uint256" }, { "internalType": "Witnet.Timestamp", "name": "witnetTimestamp", "type": "uint64" }, { "internalType": "Witnet.TransactionHash", "name": "witnetDrTxHash", "type": "bytes32" } ], "name": "reportRandomness", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "witRandomness", "outputs": [ { "internalType": "contract IWitRandomness", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"randomness\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"evmRandomizeBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"evmFinalityBlock\",\"type\":\"uint256\"},{\"internalType\":\"Witnet.Timestamp\",\"name\":\"witnetTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"Witnet.TransactionHash\",\"name\":\"witnetDrTxHash\",\"type\":\"bytes32\"}],\"name\":\"reportRandomness\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"witRandomness\",\"outputs\":[{\"internalType\":\"contract IWitRandomness\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"reportRandomness(bytes32,uint256,uint256,uint64,bytes32)\":{\"details\":\"It should revert if called from an address other than `witRandomness()`.Randomness metadata is stored in the `witRandomness()` address, indexed by `evmRandomizeBlock`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"reportRandomness(bytes32,uint256,uint256,uint64,bytes32)\":{\"notice\":\"Reports some Witnet-certified randomness. \"},\"witRandomness()\":{\"notice\":\"Returns the address of the one and only `IWitRandomness` instance that can provide Witnet-certified randomness.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/interfaces/IWitRandomnessConsumer.sol\":\"IWitRandomnessConsumer\"},\"evmVersion\":\"prague\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/interfaces/IWitRandomness.sol\":{\"keccak256\":\"0x349b27a7ecb4ca22f87d4ab13714a010668a7014d9c37fdb91caa407981b889a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a53b9c8d63c973bb98790ef3305fbc24debaa2dadad1b48b82ffdbfce73e08b6\",\"dweb:/ipfs/QmSue9dMNK1V5ChooMBTtccmpx2JoiyktqTP1Ng6bSuUGx\"]},\"project:/contracts/interfaces/IWitRandomnessAdmin.sol\":{\"keccak256\":\"0xb5b9b2375509f03db5b1e198089f4b0cf4e4ebbd31a2a7b5d2480a743bebbcd2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0cade769eec375a3ec1cd4d376be54ee48a0e18786543f6ee396c0debfa4c04c\",\"dweb:/ipfs/QmY7AucsWp54PZVgMFjrJRt1n1DKCXb84ZXzTXnRZULYXF\"]},\"project:/contracts/interfaces/IWitRandomnessConsumer.sol\":{\"keccak256\":\"0x8006c81ac34c0797d31606164e6e0c6a7e97f0ba0f5228505bbc3d4fbcf16cdd\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8cc71c0afed6dd296a808513b3119840490f76fb884ad35729669201446348bf\",\"dweb:/ipfs/QmQLs5jg8nugFgNu5psvGaCsMC6X1YoD6qV5nt7Gf5iAuk\"]},\"project:/contracts/interfaces/IWitRandomnessEvents.sol\":{\"keccak256\":\"0x005a56891f103c78ce015fbbcb9cf96f64e3810a70cd20dcdcce2963186788fc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6365a0bb99b2ac7990b74b33a4df7b045702362baf11998f8345f1a2530c29ae\",\"dweb:/ipfs/QmY2d5m2E7JwFT4EFzbrXZkiL4sSTowmosMHjSE3fTAwXf\"]},\"project:/contracts/interfaces/IWitRandomnessTypes.sol\":{\"keccak256\":\"0x52d825bf6bd6a2515116f993e939108f5412f5a05e304893ba81e9fcbfce4e09\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://60b3db141539544afc2701a873570a7b78639090e36b4bb7a57ae0d0dddeb9f4\",\"dweb:/ipfs/QmTWkwYdF4QMTeCFVcYNi9pWi3PwVeK29xgp946z8xtuiN\"]},\"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\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "", "deployedSourceMap": "", "source": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport {IWitRandomness} from \"./IWitRandomness.sol\";\r\nimport {Witnet} from \"../libs/Witnet.sol\";\r\n\r\ninterface IWitRandomnessConsumer {\r\n /// Reports some Witnet-certified randomness. \r\n /// @dev It should revert if called from an address other than `witRandomness()`.\r\n /// @dev Randomness metadata is stored in the `witRandomness()` address, indexed by `evmRandomizeBlock`.\r\n function reportRandomness(\r\n bytes32 randomness, \r\n uint256 evmRandomizeBlock,\r\n uint256 evmFinalityBlock,\r\n Witnet.Timestamp witnetTimestamp,\r\n Witnet.TransactionHash witnetDrTxHash\r\n ) external;\r\n\r\n /// Returns the address of the one and only `IWitRandomness` instance that can provide Witnet-certified randomness.\r\n function witRandomness() external view returns (IWitRandomness);\r\n}\r\n", "sourcePath": "C:\\Users\\guill\\github\\guidiaz\\witnet-solidity-bridge\\contracts\\interfaces\\IWitRandomnessConsumer.sol", "ast": { "absolutePath": "project:/contracts/interfaces/IWitRandomnessConsumer.sol", "exportedSymbols": { "IWitRandomness": [ 28351 ], "IWitRandomnessConsumer": [ 28425 ], "Witnet": [ 40741 ] }, "id": 28426, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 28397, "literals": [ "solidity", "^", "0.8", ".0" ], "nodeType": "PragmaDirective", "src": "35:23:87" }, { "absolutePath": "project:/contracts/interfaces/IWitRandomness.sol", "file": "./IWitRandomness.sol", "id": 28399, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 28426, "sourceUnit": 28352, "src": "62:52:87", "symbolAliases": [ { "foreign": { "id": 28398, "name": "IWitRandomness", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 28351, "src": "70:14:87", "typeDescriptions": {} }, "nameLocation": "-1:-1:-1" } ], "unitAlias": "" }, { "absolutePath": "project:/contracts/libs/Witnet.sol", "file": "../libs/Witnet.sol", "id": 28401, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 28426, "sourceUnit": 40742, "src": "116:42:87", "symbolAliases": [ { "foreign": { "id": 28400, "name": "Witnet", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 40741, "src": "124:6:87", "typeDescriptions": {} }, "nameLocation": "-1:-1:-1" } ], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "canonicalName": "IWitRandomnessConsumer", "contractDependencies": [], "contractKind": "interface", "fullyImplemented": false, "id": 28425, "linearizedBaseContracts": [ 28425 ], "name": "IWitRandomnessConsumer", "nameLocation": "172:22:87", "nodeType": "ContractDefinition", "nodes": [ { "documentation": { "id": 28402, "nodeType": "StructuredDocumentation", "src": "202:243:87", "text": "Reports some Witnet-certified randomness. \n @dev It should revert if called from an address other than `witRandomness()`.\n @dev Randomness metadata is stored in the `witRandomness()` address, indexed by `evmRandomizeBlock`." }, "functionSelector": "8eaa865f", "id": 28417, "implemented": false, "kind": "function", "modifiers": [], "name": "reportRandomness", "nameLocation": "460:16:87", "nodeType": "FunctionDefinition", "parameters": { "id": 28415, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 28404, "mutability": "mutable", "name": "randomness", "nameLocation": "499:10:87", "nodeType": "VariableDeclaration", "scope": 28417, "src": "491:18:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 28403, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "491:7:87", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "visibility": "internal" }, { "constant": false, "id": 28406, "mutability": "mutable", "name": "evmRandomizeBlock", "nameLocation": "533:17:87", "nodeType": "VariableDeclaration", "scope": 28417, "src": "525:25:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 28405, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "525:7:87", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 28408, "mutability": "mutable", "name": "evmFinalityBlock", "nameLocation": "573:16:87", "nodeType": "VariableDeclaration", "scope": 28417, "src": "565:24:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 28407, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "565:7:87", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 28411, "mutability": "mutable", "name": "witnetTimestamp", "nameLocation": "621:15:87", "nodeType": "VariableDeclaration", "scope": 28417, "src": "604:32:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_userDefinedValueType$_Timestamp_$37157", "typeString": "Witnet.Timestamp" }, "typeName": { "id": 28410, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 28409, "name": "Witnet.Timestamp", "nameLocations": [ "604:6:87", "611:9:87" ], "nodeType": "IdentifierPath", "referencedDeclaration": 37157, "src": "604:16:87" }, "referencedDeclaration": 37157, "src": "604:16:87", "typeDescriptions": { "typeIdentifier": "t_userDefinedValueType$_Timestamp_$37157", "typeString": "Witnet.Timestamp" } }, "visibility": "internal" }, { "constant": false, "id": 28414, "mutability": "mutable", "name": "witnetDrTxHash", "nameLocation": "674:14:87", "nodeType": "VariableDeclaration", "scope": 28417, "src": "651:37:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_userDefinedValueType$_TransactionHash_$37159", "typeString": "Witnet.TransactionHash" }, "typeName": { "id": 28413, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 28412, "name": "Witnet.TransactionHash", "nameLocations": [ "651:6:87", "658:15:87" ], "nodeType": "IdentifierPath", "referencedDeclaration": 37159, "src": "651:22:87" }, "referencedDeclaration": 37159, "src": "651:22:87", "typeDescriptions": { "typeIdentifier": "t_userDefinedValueType$_TransactionHash_$37159", "typeString": "Witnet.TransactionHash" } }, "visibility": "internal" } ], "src": "476:223:87" }, "returnParameters": { "id": 28416, "nodeType": "ParameterList", "parameters": [], "src": "708:0:87" }, "scope": 28425, "src": "451:258:87", "stateMutability": "nonpayable", "virtual": false, "visibility": "external" }, { "documentation": { "id": 28418, "nodeType": "StructuredDocumentation", "src": "717:115:87", "text": "Returns the address of the one and only `IWitRandomness` instance that can provide Witnet-certified randomness." }, "functionSelector": "ae5ce03e", "id": 28424, "implemented": false, "kind": "function", "modifiers": [], "name": "witRandomness", "nameLocation": "847:13:87", "nodeType": "FunctionDefinition", "parameters": { "id": 28419, "nodeType": "ParameterList", "parameters": [], "src": "860:2:87" }, "returnParameters": { "id": 28423, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 28422, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 28424, "src": "886:14:87", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IWitRandomness_$28351", "typeString": "contract IWitRandomness" }, "typeName": { "id": 28421, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 28420, "name": "IWitRandomness", "nameLocations": [ "886:14:87" ], "nodeType": "IdentifierPath", "referencedDeclaration": 28351, "src": "886:14:87" }, "referencedDeclaration": 28351, "src": "886:14:87", "typeDescriptions": { "typeIdentifier": "t_contract$_IWitRandomness_$28351", "typeString": "contract IWitRandomness" } }, "visibility": "internal" } ], "src": "885:16:87" }, "scope": 28425, "src": "838:64:87", "stateMutability": "view", "virtual": false, "visibility": "external" } ], "scope": 28426, "src": "162:743:87", "usedErrors": [], "usedEvents": [] } ], "src": "35:872:87" }, "compiler": { "name": "solc", "version": "0.8.30+commit.73712a01.Emscripten.clang" }, "networks": {}, "schemaVersion": "3.4.16", "updatedAt": "2025-10-15T14:34:45.918Z", "devdoc": { "kind": "dev", "methods": { "reportRandomness(bytes32,uint256,uint256,uint64,bytes32)": { "details": "It should revert if called from an address other than `witRandomness()`.Randomness metadata is stored in the `witRandomness()` address, indexed by `evmRandomizeBlock`." } }, "version": 1 }, "userdoc": { "kind": "user", "methods": { "reportRandomness(bytes32,uint256,uint256,uint64,bytes32)": { "notice": "Reports some Witnet-certified randomness. " }, "witRandomness()": { "notice": "Returns the address of the one and only `IWitRandomness` instance that can provide Witnet-certified randomness." } }, "version": 1 } }