UNPKG

witnet-solidity-bridge

Version:

Witnet Solidity Bridge contracts for EVM-compatible chains

859 lines (858 loc) 105 kB
{ "contractName": "IWitRandomnessLegacy", "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "blockNumber", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmTxGasPrice", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmRandomizeFee", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "witnetQueryId", "type": "uint256" }, { "components": [ { "internalType": "uint8", "name": "committeeSize", "type": "uint8" }, { "internalType": "uint64", "name": "witnessingFeeNanoWit", "type": "uint64" } ], "indexed": false, "internalType": "struct IWitRandomnessLegacy.RandomizeQueryParams", "name": "witnetQuerySLA", "type": "tuple" } ], "name": "Randomizing", "type": "event" }, { "inputs": [ { "internalType": "uint256", "name": "evmGasPrice", "type": "uint256" } ], "name": "estimateRandomizeFee", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } ], "name": "fetchRandomnessAfter", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } ], "name": "fetchRandomnessAfterProof", "outputs": [ { "internalType": "bytes32", "name": "witnetResultRandomness", "type": "bytes32" }, { "internalType": "uint64", "name": "witnetResultTimestamp", "type": "uint64" }, { "internalType": "bytes32", "name": "witnetResultTallyHash", "type": "bytes32" }, { "internalType": "uint256", "name": "witnetResultFinalityBlock", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getLastRandomizeBlock", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } ], "name": "getRandomizeData", "outputs": [ { "internalType": "uint256", "name": "witnetQueryId", "type": "uint256" }, { "internalType": "uint256", "name": "prevRandomizeBlock", "type": "uint256" }, { "internalType": "uint256", "name": "nextRandomizeBlock", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } ], "name": "getRandomizeNextBlock", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } ], "name": "getRandomizePrevBlock", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } ], "name": "getRandomizeStatus", "outputs": [ { "internalType": "enum IWitRandomnessLegacy.RandomizeStatus", "name": "", "type": "uint8" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } ], "name": "isRandomized", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint32", "name": "range", "type": "uint32" }, { "internalType": "uint256", "name": "nonce", "type": "uint256" }, { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } ], "name": "random", "outputs": [ { "internalType": "uint32", "name": "", "type": "uint32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "randomize", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "payable", "type": "function" }, { "inputs": [], "name": "witnet", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "witnetQuerySLA", "outputs": [ { "components": [ { "internalType": "uint8", "name": "committeeSize", "type": "uint8" }, { "internalType": "uint64", "name": "witnessingFeeNanoWit", "type": "uint64" } ], "internalType": "struct IWitRandomnessLegacy.RandomizeQueryParams", "name": "", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "witnetRadHash", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.8.30+commit.73712a01\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmTxGasPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmRandomizeFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"witnetQueryId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"committeeSize\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"witnessingFeeNanoWit\",\"type\":\"uint64\"}],\"indexed\":false,\"internalType\":\"struct IWitRandomnessLegacy.RandomizeQueryParams\",\"name\":\"witnetQuerySLA\",\"type\":\"tuple\"}],\"name\":\"Randomizing\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"}],\"name\":\"estimateRandomizeFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"fetchRandomnessAfter\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"fetchRandomnessAfterProof\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"witnetResultRandomness\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"witnetResultTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"witnetResultTallyHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"witnetResultFinalityBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastRandomizeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"getRandomizeData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"witnetQueryId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevRandomizeBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nextRandomizeBlock\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"getRandomizeNextBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"getRandomizePrevBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"getRandomizeStatus\",\"outputs\":[{\"internalType\":\"enum IWitRandomnessLegacy.RandomizeStatus\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"isRandomized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"range\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"name\":\"random\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"randomize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"witnet\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"witnetQuerySLA\",\"outputs\":[{\"components\":[{\"internalType\":\"uint8\",\"name\":\"committeeSize\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"witnessingFeeNanoWit\",\"type\":\"uint64\"}],\"internalType\":\"struct IWitRandomnessLegacy.RandomizeQueryParams\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"witnetRadHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Witnet Foundation.\",\"kind\":\"dev\",\"methods\":{\"fetchRandomnessAfter(uint256)\":{\"details\":\"Reverts if:i. no `randomize()` was requested on neither the given block, nor afterwards.ii. the first non-errored `randomize()` request found on or after the given block is not solved yet.iii. all `randomize()` requests that took place on or after the given block were solved with errors.\",\"params\":{\"blockNumber\":\"Block number from which the search will start.\"}},\"fetchRandomnessAfterProof(uint256)\":{\"details\":\"Reverts if:i. no `randomize()` was requested on neither the given block, nor afterwards.ii. the first non-errored `randomize()` request found on or after the given block is not solved yet.iii. all `randomize()` requests that took place on or after the given block were solved with errors.\",\"params\":{\"blockNumber\":\"Block number from which the search will start.\"},\"returns\":{\"witnetResultFinalityBlock\":\"EVM block number from which the provided randomness can be considered to be final.\",\"witnetResultRandomness\":\"Random value provided by the Witnet blockchain and used for solving randomness after given block.\",\"witnetResultTallyHash\":\"Hash of the witnessing commit/reveal act that took place on the Witnet blockchain.\",\"witnetResultTimestamp\":\"Timestamp at which the randomness value was generated by the Witnet blockchain.\"}},\"getRandomizeData(uint256)\":{\"details\":\"Returns zero values if no randomize request was actually posted on the given block.\",\"returns\":{\"nextRandomizeBlock\":\"Block number in which a randomize request got posted just after this one, 0 if none.\",\"prevRandomizeBlock\":\"Block number in which a randomize request got posted just before this one. 0 if none.\",\"witnetQueryId\":\"Identifier of the underlying Witnet query created on the given block number. \"}},\"getRandomizeNextBlock(uint256)\":{\"params\":{\"blockNumber\":\"Block number from which the search will start.\"},\"returns\":{\"_0\":\"Number of the first block found after the given one, or `0` otherwise.\"}},\"getRandomizePrevBlock(uint256)\":{\"params\":{\"blockNumber\":\"Block number from which the search will start.\"},\"returns\":{\"_0\":\"First block found before the given one, or `0` otherwise.\"}},\"getRandomizeStatus(uint256)\":{\"details\":\"Possible values:- 0 -> Void: no randomize request was actually posted on or after the given block number.- 1 -> Awaiting: a randomize request was found but it's not yet solved by the Witnet blockchain.- 2 -> Ready: a successfull randomize value was reported and ready to be read.- 3 -> Error: all randomize resolutions after the given block were solved with errors.- 4 -> Finalizing: a randomize resolution has been reported from the Witnet blockchain, but it's not yet final. \"},\"random(uint32,uint256,uint256)\":{\"details\":\"Fails under same conditions as `getRandomnessAfter(uint256)` does.\",\"params\":{\"blockNumber\":\"Block number from which the search for the first randomize request solved aftewards will start.\",\"nonce\":\"Nonce value enabling multiple random numbers from the same randomness value.\",\"range\":\"Range within which the uniformly-distributed random number will be generated.\"}},\"randomize()\":{\"details\":\"Only one randomness request per block will be actually posted to the Witnet Oracle. Unused funds will be transfered back to the `msg.sender`. \",\"returns\":{\"_0\":\"Funds actually paid as randomize fee. \"}}},\"title\":\"The Wit/Randomness appliance interface.\",\"version\":1},\"userdoc\":{\"events\":{\"Randomizing(uint256,uint256,uint256,uint256,(uint8,uint64))\":{\"notice\":\"Emitted every time a new randomize is requested.\"}},\"kind\":\"user\",\"methods\":{\"estimateRandomizeFee(uint256)\":{\"notice\":\"Returns amount of wei required to be paid as a fee when requesting randomization with a transaction gas price as the one given.\"},\"fetchRandomnessAfter(uint256)\":{\"notice\":\"Retrieves the result of keccak256-hashing the given block number with the randomness value generated by the Witnet Oracle blockchain in response to the first non-errored randomize request solved after such block number.\"},\"fetchRandomnessAfterProof(uint256)\":{\"notice\":\"Retrieves the actual random value, unique hash and timestamp of the witnessing commit/reveal act that tookplace in the Witnet Oracle blockchain in response to the first non-errored randomize requestsolved after the given block number.\"},\"getLastRandomizeBlock()\":{\"notice\":\"Returns last block number on which a randomize was requested.\"},\"getRandomizeData(uint256)\":{\"notice\":\"Retrieves metadata related to the randomize request that got posted to the Witnet Oracle contract on the given block number.\"},\"getRandomizeNextBlock(uint256)\":{\"notice\":\"Returns the number of the next block in which a randomize request was posted after the given one. \"},\"getRandomizePrevBlock(uint256)\":{\"notice\":\"Returns the number of the previous block in which a randomize request was posted before the given one.\"},\"getRandomizeStatus(uint256)\":{\"notice\":\"Gets current status of the first non-errored randomize request posted on or after the given block number.\"},\"isRandomized(uint256)\":{\"notice\":\"Returns `true` only if a successfull resolution from the Witnet blockchain is found for the first non-errored randomize request posted on or after the given block number.\"},\"random(uint32,uint256,uint256)\":{\"notice\":\"Generates a pseudo-random number uniformly distributed within the range [0 .. _range), by using the given `nonce` and the randomness returned by `getRandomnessAfter(blockNumber)`. \"},\"randomize()\":{\"notice\":\"Requests the Witnet oracle to generate an EVM-agnostic and trustless source of randomness. \"},\"witnet()\":{\"notice\":\"Returns address of the Witnet Oracle bridging contract being used for solving randomness requests.\"},\"witnetQuerySLA()\":{\"notice\":\"Returns the SLA parameters required for the Witnet Oracle blockchain to fulfill when solving randomness requests:- number of witnessing nodes contributing to randomness generation- reward in $nanoWIT received per witnessing node in the Witnet blockchain\"},\"witnetRadHash()\":{\"notice\":\"Returns the unique identifier of the Witnet-compliant data request being used for solving randomness.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/interfaces/legacy/IWitRandomnessLegacy.sol\":\"IWitRandomnessLegacy\"},\"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/interfaces/legacy/IWitRandomnessLegacy.sol\":{\"keccak256\":\"0x6efed45a64d1440b6f855130d30c93d34ced38d9fcd390a15e27f33c347ae05d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18de98643262a56af0c74897c856c426d8680fd144eb43d9e73e7e25d3185b3e\",\"dweb:/ipfs/QmcgfoVbVNVTgXfAEvztTczNw1t6YgxDaQrZi4ZXw4EA8N\"]},\"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 <0.9.0;\r\n\r\nimport \"../../WitOracle.sol\";\r\n\r\n/// @title The Wit/Randomness appliance interface.\r\n/// @author Witnet Foundation.\r\ninterface IWitRandomnessLegacy {\r\n\r\n /// Randomization status for some specified block number.\r\n enum RandomizeStatus {\r\n Void,\r\n Awaiting,\r\n Ready,\r\n Error,\r\n Finalizing\r\n }\r\n \r\n /// Emitted every time a new randomize is requested.\r\n event Randomizing(\r\n uint256 blockNumber, \r\n uint256 evmTxGasPrice,\r\n uint256 evmRandomizeFee,\r\n uint256 witnetQueryId, \r\n RandomizeQueryParams witnetQuerySLA\r\n );\r\n\r\n /// Randomize parameters\r\n struct RandomizeQueryParams {\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 /// @notice Fee in $nanoWIT paid to every node in the Witnet blockchain involved in solving the data request.\r\n uint64 witnessingFeeNanoWit;\r\n }\r\n \r\n /// @notice Returns amount of wei required to be paid as a fee when requesting randomization with a \r\n /// transaction gas price as the one given.\r\n function estimateRandomizeFee(uint256 evmGasPrice) external view returns (uint256);\r\n\r\n /// @notice Retrieves the result of keccak256-hashing the given block number with the randomness value \r\n /// @notice generated by the Witnet Oracle blockchain in response to the first non-errored randomize request solved \r\n /// @notice after such block number.\r\n /// @dev Reverts if:\r\n /// @dev i. no `randomize()` was requested on neither the given block, nor afterwards.\r\n /// @dev ii. the first non-errored `randomize()` request found on or after the given block is not solved yet.\r\n /// @dev iii. all `randomize()` requests that took place on or after the given block were solved with errors.\r\n /// @param blockNumber Block number from which the search will start.\r\n function fetchRandomnessAfter(uint256 blockNumber) external view returns (bytes32);\r\n\r\n /// @notice Retrieves the actual random value, unique hash and timestamp of the witnessing commit/reveal act that took\r\n /// @notice place in the Witnet Oracle blockchain in response to the first non-errored randomize request\r\n /// @notice solved after the given block number.\r\n /// @dev Reverts if:\r\n /// @dev i. no `randomize()` was requested on neither the given block, nor afterwards.\r\n /// @dev ii. the first non-errored `randomize()` request found on or after the given block is not solved yet.\r\n /// @dev iii. all `randomize()` requests that took place on or after the given block were solved with errors.\r\n /// @param blockNumber Block number from which the search will start.\r\n /// @return witnetResultRandomness Random value provided by the Witnet blockchain and used for solving randomness after given block.\r\n /// @return witnetResultTimestamp Timestamp at which the randomness value was generated by the Witnet blockchain.\r\n /// @return witnetResultTallyHash Hash of the witnessing commit/reveal act that took place on the Witnet blockchain.\r\n /// @return witnetResultFinalityBlock EVM block number from which the provided randomness can be considered to be final.\r\n function fetchRandomnessAfterProof(uint256 blockNumber) external view returns (\r\n bytes32 witnetResultRandomness,\r\n uint64 witnetResultTimestamp, \r\n bytes32 witnetResultTallyHash,\r\n uint256 witnetResultFinalityBlock\r\n ); \r\n\r\n /// @notice Returns last block number on which a randomize was requested.\r\n function getLastRandomizeBlock() external view returns (uint256);\r\n\r\n /// @notice Retrieves metadata related to the randomize request that got posted to the \r\n /// @notice Witnet Oracle contract on the given block number.\r\n /// @dev Returns zero values if no randomize request was actually posted on the given block.\r\n /// @return witnetQueryId Identifier of the underlying Witnet query created on the given block number. \r\n /// @return prevRandomizeBlock Block number in which a randomize request got posted just before this one. 0 if none.\r\n /// @return nextRandomizeBlock Block number in which a randomize request got posted just after this one, 0 if none.\r\n function getRandomizeData(uint256 blockNumber) external view returns (\r\n uint256 witnetQueryId,\r\n uint256 prevRandomizeBlock, \r\n uint256 nextRandomizeBlock\r\n );\r\n \r\n /// @notice Returns the number of the next block in which a randomize request was posted after the given one. \r\n /// @param blockNumber Block number from which the search will start.\r\n /// @return Number of the first block found after the given one, or `0` otherwise.\r\n function getRandomizeNextBlock(uint256 blockNumber) external view returns (uint256); \r\n\r\n /// @notice Returns the number of the previous block in which a randomize request was posted before the given one.\r\n /// @param blockNumber Block number from which the search will start.\r\n /// @return First block found before the given one, or `0` otherwise.\r\n function getRandomizePrevBlock(uint256 blockNumber) external view returns (uint256);\r\n\r\n /// @notice Gets current status of the first non-errored randomize request posted on or after the given block number.\r\n /// @dev Possible values:\r\n /// @dev - 0 -> Void: no randomize request was actually posted on or after the given block number.\r\n /// @dev - 1 -> Awaiting: a randomize request was found but it's not yet solved by the Witnet blockchain.\r\n /// @dev - 2 -> Ready: a successfull randomize value was reported and ready to be read.\r\n /// @dev - 3 -> Error: all randomize resolutions after the given block were solved with errors.\r\n /// @dev - 4 -> Finalizing: a randomize resolution has been reported from the Witnet blockchain, but it's not yet final. \r\n function getRandomizeStatus(uint256 blockNumber) external view returns (RandomizeStatus);\r\n\r\n /// @notice Returns `true` only if a successfull resolution from the Witnet blockchain is found for the first \r\n /// @notice non-errored randomize request posted on or after the given block number.\r\n function isRandomized(uint256 blockNumber) external view returns (bool);\r\n\r\n /// @notice Generates a pseudo-random number uniformly distributed within the range [0 .. _range), by using \r\n /// @notice the given `nonce` and the randomness returned by `getRandomnessAfter(blockNumber)`. \r\n /// @dev Fails under same conditions as `getRandomnessAfter(uint256)` does.\r\n /// @param range Range within which the uniformly-distributed random number will be generated.\r\n /// @param nonce Nonce value enabling multiple random numbers from the same randomness value.\r\n /// @param blockNumber Block number from which the search for the first randomize request solved aftewards will start.\r\n function random(uint32 range, uint256 nonce, uint256 blockNumber) external view returns (uint32);\r\n\r\n /// @notice Requests the Witnet oracle to generate an EVM-agnostic and trustless source of randomness. \r\n /// @dev Only one randomness request per block will be actually posted to the Witnet Oracle. \r\n /// @dev Unused funds will be transfered back to the `msg.sender`. \r\n /// @return Funds actually paid as randomize fee. \r\n function randomize() external payable returns (uint256);\r\n\r\n /// @notice Returns address of the Witnet Oracle bridging contract being used for solving randomness requests.\r\n function witnet() external view returns (address);\r\n\r\n /// @notice Returns the SLA parameters required for the Witnet Oracle blockchain to fulfill \r\n /// @notice when solving randomness requests:\r\n /// @notice - number of witnessing nodes contributing to randomness generation\r\n /// @notice - reward in $nanoWIT received per witnessing node in the Witnet blockchain\r\n function witnetQuerySLA() external view returns (RandomizeQueryParams memory);\r\n\r\n /// @notice Returns the unique identifier of the Witnet-compliant data request being used for solving randomness.\r\n function witnetRadHash() external view returns (bytes32);\r\n}\r\n", "sourcePath": "C:\\Users\\guill\\github\\guidiaz\\witnet-solidity-bridge\\contracts\\interfaces\\legacy\\IWitRandomnessLegacy.sol", "ast": { "absolutePath": "project:/contracts/interfaces/legacy/IWitRandomnessLegacy.sol", "exportedSymbols": { "Bech32": [ 31372 ], "IWitAppliance": [ 26514 ], "IWitOracle": [ 26581 ], "IWitOracleAppliance": [ 26593 ], "IWitOracleQueriable": [ 26795 ], "IWitOracleQueriableEvents": [ 26892 ], "IWitOracleRadonRegistry": [ 27394 ], "IWitRandomnessLegacy": [ 29984 ], "Secp256k1": [ 32535 ], "WitOracle": [ 678 ], "Witnet": [ 40741 ], "WitnetBuffer": [ 42631 ], "WitnetCBOR": [ 44174 ] }, "id": 29985, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 29834, "literals": [ "solidity", ">=", "0.8", ".0", "<", "0.9", ".0" ], "nodeType": "PragmaDirective", "src": "35:31:109" }, { "absolutePath": "project:/contracts/WitOracle.sol", "file": "../../WitOracle.sol", "id": 29835, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 29985, "sourceUnit": 679, "src": "70:29:109", "symbolAliases": [], "unitAlias": "" }, { "abstract": false, "baseContracts": [], "canonicalName": "IWitRandomnessLegacy", "contractDependencies": [], "contractKind": "interface", "documentation": { "id": 29836, "nodeType": "StructuredDocumentation", "src": "103:84:109", "text": "@title The Wit/Randomness appliance interface.\n @author Witnet Foundation." }, "fullyImplemented": false, "id": 29984, "linearizedBaseContracts": [ 29984 ], "name": "IWitRandomnessLegacy", "nameLocation": "197:20:109", "nodeType": "ContractDefinition", "nodes": [ { "canonicalName": "IWitRandomnessLegacy.RandomizeStatus", "documentation": { "id": 29837, "nodeType": "StructuredDocumentation", "src": "227:57:109", "text": "Randomization status for some specified block number." }, "id": 29843, "members": [ { "id": 29838, "name": "Void", "nameLocation": "322:4:109", "nodeType": "EnumValue", "src": "322:4:109" }, { "id": 29839, "name": "Awaiting", "nameLocation": "337:8:109", "nodeType": "EnumValue", "src": "337:8:109" }, { "id": 29840, "name": "Ready", "nameLocation": "356:5:109", "nodeType": "EnumValue", "src": "356:5:109" }, { "id": 29841, "name": "Error", "nameLocation": "372:5:109", "nodeType": "EnumValue", "src": "372:5:109" }, { "id": 29842, "name": "Finalizing", "nameLocation": "388:10:109", "nodeType": "EnumValue", "src": "388:10:109" } ], "name": "RandomizeStatus", "nameLocation": "295:15:109", "nodeType": "EnumDefinition", "src": "290:115:109" }, { "anonymous": false, "documentation": { "id": 29844, "nodeType": "StructuredDocumentation", "src": "417:52:109", "text": "Emitted every time a new randomize is requested." }, "eventSelector": "8cb766b09215126141c41df86fd488fe4745f22f3c995c3ad9aaf4c07195b946", "id": 29857, "name": "Randomizing", "nameLocation": "481:11:109", "nodeType": "EventDefinition", "parameters": { "id": 29856, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 29846, "indexed": false, "mutability": "mutable", "name": "blockNumber", "nameLocation": "511:11:109", "nodeType": "VariableDeclaration", "scope": 29857, "src": "503:19:109", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 29845, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "503:7:109", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 29848, "indexed": false, "mutability": "mutable", "name": "evmTxGasPrice", "nameLocation": "542:13:109", "nodeType": "VariableDeclaration", "scope": 29857, "src": "534:21:109", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 29847, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "534:7:109", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 29850, "indexed": false, "mutability": "mutable", "name": "evmRandomizeFee", "nameLocation": "574:15:109", "nodeType": "VariableDeclaration", "scope": 29857, "src": "566:23:109", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 29849, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "566:7:109", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 29852, "indexed": false, "mutability": "mutable", "name": "witnetQueryId", "nameLocation": "608:13:109", "nodeType": "VariableDeclaration", "scope": 29857, "src": "600:21:109", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 29851, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "600:7:109", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" }, { "constant": false, "id": 29855, "indexed": false, "mutability": "mutable", "name": "witnetQuerySLA", "nameLocation": "654:14:109", "nodeType": "VariableDeclaration", "scope": 29857, "src": "633:35:109", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_struct$_RandomizeQueryParams_$29865_memory_ptr", "typeString": "struct IWitRandomnessLegacy.RandomizeQueryParams" }, "typeName": { "id": 29854, "nodeType": "UserDefinedTypeName", "pathNode": { "id": 29853, "name": "RandomizeQueryParams", "nameLocations": [ "633:20:109" ], "nodeType": "IdentifierPath", "referencedDeclaration": 29865, "src": "633:20:109" }, "referencedDeclaration": 29865, "src": "633:20:109", "typeDescriptions": { "typeIdentifier": "t_struct$_RandomizeQueryParams_$29865_storage_ptr", "typeString": "struct IWitRandomnessLegacy.RandomizeQueryParams" } }, "visibility": "internal" } ], "src": "492:183:109" }, "src": "475:201:109" }, { "canonicalName": "IWitRandomnessLegacy.RandomizeQueryParams", "documentation": { "id": 29858, "nodeType": "StructuredDocumentation", "src": "684:24:109", "text": "Randomize parameters" }, "id": 29865, "members": [ { "constant": false, "id": 29861, "mutability": "mutable", "name": "committeeSize", "nameLocation": "873:13:109", "nodeType": "VariableDeclaration", "scope": 29865, "src": "865:21:109", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 29860, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "865:5:109", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "visibility": "internal" }, { "constant": false, "id": 29864, "mutability": "mutable", "name": "witnessingFeeNanoWit", "nameLocation": "1024:20:109", "nodeType": "VariableDeclaration", "scope": 29865, "src": "1016:28:109", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" }, "typeName": { "id": 29863, "name": "uint64", "nodeType": "ElementaryTypeName", "src": "1016:6:109", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "visibility": "internal" } ], "name": "RandomizeQueryParams", "nameLocation": "721:20:109", "nodeType": "StructDefinition", "scope": 29984, "src": "714:338:109", "visibility": "public" }, { "documentation": { "id": 29866, "nodeType": "StructuredDocumentation", "src": "1063:149:109", "text": "@notice Returns amount of wei required to be paid as a fee when requesting randomization with a \n transaction gas price as the one given." }, "functionSelector": "a60ee268", "id": 29873, "implemented": false, "kind": "function", "modifiers": [], "name": "estimateRandomizeFee", "nameLocation": "1227:20:109", "nodeType": "FunctionDefinition", "parameters": { "id": 29869, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 29868, "mutability": "mutable", "name": "evmGasPrice", "nameLocation": "1256:11:109", "nodeType": "VariableDeclaration", "scope": 29873, "src": "1248:19:109", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 29867, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1248:7:109", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "1247:21:109" }, "returnParameters": { "id": 29872, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 29871, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 29873, "src": "1292:7:109", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 29870, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "1292:7:109", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "visibility": "internal" } ], "src": "1291:9:109" }, "scope": 29984, "src": "1218:83:109", "stateMutability": "view", "virtual": false, "visibility": "external" }, { "documentation": { "id": 29874, "nodeType": "StructuredDocumentation", "src": "1309:699:109", "text": "@notice Retrieves the result of keccak256-hashing the given block number with the randomness value \n @notice generated by the Witnet Oracle blockchain in response to the first non-errored randomize request solved \n @notice after such block number.\n @dev Reverts if:\n @dev i. no `randomize()` was requested on neither the given block, nor afterwards.\n @dev ii. the first non-errored `randomize()` request found on or after the given block is not solved yet.\n @dev iii. all `randomize()` requests that took place on or after the given block were solved with errors.\n @param blockNumber Block number from which the search will start." }, "functionSelector": "82b1c174", "id": 29881, "implemented": false, "kind": "function", "modifiers": [], "name": "fetchRandomnessAfter", "nameLocation": "2023:20:109", "nodeType": "FunctionDefinition", "parameters": { "id": 29877, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 29876, "mutability": "mutable", "name": "blockNumber", "nameLocation": "2052:11:109", "nodeType": "VariableDeclaration", "scope": 29881, "src": "2044:19:109", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" },