UNPKG

witnet-solidity-bridge

Version:

Witnet Solidity Bridge contracts for EVM-compatible chains

948 lines 46.8 kB
{ "contractName": "WitnetRandomness", "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 WitnetV2.RadonSLA", "name": "witnetQuerySLA", "type": "tuple" } ], "name": "Randomizing", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "id", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmReward", "type": "uint256" }, { "components": [ { "internalType": "uint8", "name": "committeeSize", "type": "uint8" }, { "internalType": "uint64", "name": "witnessingFeeNanoWit", "type": "uint64" } ], "indexed": false, "internalType": "struct WitnetV2.RadonSLA", "name": "witnetSLA", "type": "tuple" } ], "name": "WitnetQuery", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "id", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmGasPrice", "type": "uint256" } ], "name": "WitnetQueryResponse", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "id", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmGasPrice", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmCallbackGas", "type": "uint256" } ], "name": "WitnetQueryResponseDelivered", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "id", "type": "uint256" }, { "indexed": false, "internalType": "bytes", "name": "resultCborBytes", "type": "bytes" }, { "indexed": false, "internalType": "uint256", "name": "evmGasPrice", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmCallbackActualGas", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "evmCallbackRevertReason", "type": "string" } ], "name": "WitnetQueryResponseDeliveryFailed", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "id", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "evmReward", "type": "uint256" } ], "name": "WitnetQueryRewardUpgraded", "type": "event" }, { "inputs": [ { "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 WitnetV2.ResponseStatus", "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": "contract WitnetOracle", "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 WitnetV2.RadonSLA", "name": "", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "witnetRadHash", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "class", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "specs", "outputs": [ { "internalType": "bytes4", "name": "", "type": "bytes4" } ], "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"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 WitnetV2.RadonSLA\",\"name\":\"witnetQuerySLA\",\"type\":\"tuple\"}],\"name\":\"Randomizing\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmReward\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"committeeSize\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"witnessingFeeNanoWit\",\"type\":\"uint64\"}],\"indexed\":false,\"internalType\":\"struct WitnetV2.RadonSLA\",\"name\":\"witnetSLA\",\"type\":\"tuple\"}],\"name\":\"WitnetQuery\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"}],\"name\":\"WitnetQueryResponse\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmCallbackGas\",\"type\":\"uint256\"}],\"name\":\"WitnetQueryResponseDelivered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"resultCborBytes\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmGasPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmCallbackActualGas\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"evmCallbackRevertReason\",\"type\":\"string\"}],\"name\":\"WitnetQueryResponseDeliveryFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"evmReward\",\"type\":\"uint256\"}],\"name\":\"WitnetQueryRewardUpgraded\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"class\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"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 WitnetV2.ResponseStatus\",\"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\":\"specs\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"witnet\",\"outputs\":[{\"internalType\":\"contract WitnetOracle\",\"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 WitnetV2.RadonSLA\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"witnetRadHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"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. \"}}},\"version\":1},\"userdoc\":{\"events\":{\"WitnetQuery(uint256,uint256,(uint8,uint64))\":{\"notice\":\"Emitted every time a new query containing some verified data request is posted to the WRB.\"},\"WitnetQueryResponse(uint256,uint256)\":{\"notice\":\"Emitted when a query with no callback gets reported into the WRB.\"},\"WitnetQueryResponseDelivered(uint256,uint256,uint256)\":{\"notice\":\"Emitted when a query with a callback gets successfully reported into the WRB.\"},\"WitnetQueryResponseDeliveryFailed(uint256,bytes,uint256,uint256,string)\":{\"notice\":\"Emitted when a query with a callback cannot get reported into the WRB.\"},\"WitnetQueryRewardUpgraded(uint256,uint256)\":{\"notice\":\"Emitted when the reward of some not-yet reported query is upgraded.\"}},\"kind\":\"user\",\"methods\":{\"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/WitnetRandomness.sol\":\"WitnetRandomness\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"project:/contracts/WitnetOracle.sol\":{\"keccak256\":\"0x84ef8d2ebcba273e4bc23a5ee414a1213df55d1b4e496197a146031fea3a4874\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c4a6e31964ed08c4c9dfe5279b4ffe9eeba6e759f15901e080e174e98e96a7f5\",\"dweb:/ipfs/QmTghzVFf2EHnfnHejgFGRBjanXYcstK9ftVaYmHWJfk8w\"]},\"project:/contracts/WitnetRandomness.sol\":{\"keccak256\":\"0xa18727bf1e426ea2cd9c51e29f20090d2e305bd4548225b612deac8a175eb290\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://358755b23533fd4e59c26de21a5996a494867ff9324f5a8969674cc50f0de371\",\"dweb:/ipfs/QmSbLdscuJTortmR4LoCriKbGTSepUgMuxptN9xCsFuFJ1\"]},\"project:/contracts/WitnetRequestBytecodes.sol\":{\"keccak256\":\"0x2a79d919dd79c0e3f857e6bee08368ad0b463188aced4a52de29270ed0f5f3d2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://290d6013ee9f75fedbbb7726527a637ea2ae7a5da0ad118ecc43b298846f0bb0\",\"dweb:/ipfs/QmU8AZtPyctrrvxdmH297p595ZMS6DgcD6djSFKNxAqYMs\"]},\"project:/contracts/WitnetRequestFactory.sol\":{\"keccak256\":\"0x3c66f27d7c1db0e662c37d98005c4cbd871ceb75e97079d7bf673fb75d59c858\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://52adb318b870d0825718125e94fdbdd0e968ced09926420e2543b0ca4c6eb579\",\"dweb:/ipfs/QmYack87Q2UTfQb8KLLEPFBrMJgN2o6PaPqPNSc95McPVH\"]},\"project:/contracts/interfaces/IWitnetOracle.sol\":{\"keccak256\":\"0x5dbb04fce5e05675325232a735c46617378982b48dac2138aca0c6cc95e6e4d5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7447a70455478239500e16aebe5dce6676dc86307d22f662761d8e9f7c5d1276\",\"dweb:/ipfs/QmVkvA4Mt6G1JXxE8ebxKGAjT1WvNbp5QMKg9sUKdrJjhv\"]},\"project:/contracts/interfaces/IWitnetOracleEvents.sol\":{\"keccak256\":\"0x0442f474f253dc1f6bd6a4f153c3adb2abe5f6f0f24c76d1baf666185e61e659\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://535e8efcfc5693669d9bd2b6f62e6fc65aca19b7de355a27152e4362b410540d\",\"dweb:/ipfs/QmVZRXgku1cZewhoucebaiBKAyUjF2dmEzYrzGvjPzbwN9\"]},\"project:/contracts/interfaces/IWitnetRandomness.sol\":{\"keccak256\":\"0xe1dece4459bee43e03cbc83e3feb455de406e633c778ac70e3da5d0c65402d68\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8d79acbdbddc0882e6067d4722184423102b78fa1ca9fd94e4d0b9c6dd9f4485\",\"dweb:/ipfs/QmVs5it4bV2cqZPfdCejmHh3SybxciuQoKE8pswUWqPc1R\"]},\"project:/contracts/interfaces/IWitnetRandomnessEvents.sol\":{\"keccak256\":\"0x3d5510777da725c0772a04bc40a967c07713139bc50bb732462baccc1acfb0eb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://481f334e116fa761e2d9fdc668cf9278c8d192f0b0511066637dab6011fac908\",\"dweb:/ipfs/QmS1Vh6Xab5oBmTxLempvGvpAsVfEQthbrg1aWXe2SqRRa\"]},\"project:/contracts/interfaces/IWitnetRequestBytecodes.sol\":{\"keccak256\":\"0x8da168bee9a78442216965976b1f29087f760f37dcb09337283242599ed1cbca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e120623262ee0559913bdae56c0a7921147dfe08ada7ea81061b14e2fc38c5e1\",\"dweb:/ipfs/Qmbxe8XRrH6ZjJHiR6YYzcZV1jnSWwo9iBYz5r6GJ6To5G\"]},\"project:/contracts/interfaces/IWitnetRequestFactory.sol\":{\"keccak256\":\"0x3b19ec4a976745ba2646e7e1886d647ef30ad678460a712c93bbfb4405b57f1f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fa759ae15b7d4da622a81d50933474910959ac490d8b63ea2e7ed8608859a9c9\",\"dweb:/ipfs/QmRckCu7eBBP5fn9ff6djs7VbdhFc7sxYb2yqDr4go66jV\"]},\"project:/contracts/libs/Witnet.sol\":{\"keccak256\":\"0x65a87375dd79d63a83fb454b7199b6c999bd59c50b3b59d521c5c4d45a7d3cc3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ca865b681d810c2fc5c3672ea6343c3bdf6fd71764ab824d25994744dc85866b\",\"dweb:/ipfs/QmPGcP3xGTNZfsQ9GSKdujNLRVs8dWDdubyUko1rbQqJNv\"]},\"project:/contracts/libs/WitnetBuffer.sol\":{\"keccak256\":\"0xa14570492eb5a313ddbacae0185c850ec99c67211eb33989a5e21d31bf06a150\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e83c11edb49cab6a767c0b685825bc22ece0d3d2897e0d54fe1923df5cc76ba5\",\"dweb:/ipfs/QmdLDgCc3tnKbgRrXwfNzsg6uUDirNmjvBB8V3iMmnD69a\"]},\"project:/contracts/libs/WitnetCBOR.sol\":{\"keccak256\":\"0xb346547ff731163beea2c657c52675cdf7936691d566a76a045577cf9c34ade0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6d4b5b6424a033584b41f1204d635db98fda9ca9bd2a614c9d82539a3e4e6529\",\"dweb:/ipfs/QmW6Qy3wWpzHSECYaCPaf9LWGfPqWDKVoP2kPSNNQu7LMQ\"]},\"project:/contracts/libs/WitnetV2.sol\":{\"keccak256\":\"0xb276a6da373bfbe9cd942dd7e59979cda898215d1e36ab3df95a6d6cc6ff770f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bc4890876b9bc64f501ccdd48408bb63724865cb2ce8d2057f6b318540adce7c\",\"dweb:/ipfs/QmPMHPdbCsKBavhiLcaDgQ9EjNSvwwzv8TKffotcCv1ctP\"]}},\"version\":1}", "bytecode": "0x", "deployedBytecode": "0x", "immutableReferences": {}, "generatedSources": [], "deployedGeneratedSources": [], "sourceMap": "", "deployedSourceMap": "", "source": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity >=0.8.0 <0.9.0;\r\n\r\nimport \"./interfaces/IWitnetOracleEvents.sol\";\r\nimport \"./interfaces/IWitnetRandomness.sol\";\r\nimport \"./interfaces/IWitnetRandomnessEvents.sol\";\r\n\r\nabstract contract WitnetRandomness\r\n is\r\n IWitnetOracleEvents,\r\n IWitnetRandomness,\r\n IWitnetRandomnessEvents\r\n{\r\n function class() virtual external view returns (string memory);\r\n function specs() virtual external view returns (bytes4);\r\n}\r\n", "sourcePath": "C:\\Users\\guill\\github\\witnet\\witnet-solidity-bridge\\contracts\\WitnetRandomness.sol", "ast": { "absolutePath": "project:/contracts/WitnetRandomness.sol", "exportedSymbols": { "IWitnetOracle": [ 13265 ], "IWitnetOracleEvents": [ 13315 ], "IWitnetRandomness": [ 13639 ], "IWitnetRandomnessEvents": [ 13696 ], "IWitnetRequestBytecodes": [ 13979 ], "IWitnetRequestFactory": [ 14002 ], "Witnet": [ 17557 ], "WitnetBuffer": [ 19191 ], "WitnetCBOR": [ 20734 ], "WitnetOracle": [ 749 ], "WitnetRandomness": [ 794 ], "WitnetRequestBytecodes": [ 849 ], "WitnetRequestFactory": [ 880 ], "WitnetV2": [ 23640 ] }, "id": 795, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 774, "literals": [ "solidity", ">=", "0.8", ".0", "<", "0.9", ".0" ], "nodeType": "PragmaDirective", "src": "35:31:11" }, { "absolutePath": "project:/contracts/interfaces/IWitnetOracleEvents.sol", "file": "./interfaces/IWitnetOracleEvents.sol", "id": 775, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 795, "sourceUnit": 13316, "src": "70:46:11", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "project:/contracts/interfaces/IWitnetRandomness.sol", "file": "./interfaces/IWitnetRandomness.sol", "id": 776, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 795, "sourceUnit": 13640, "src": "118:44:11", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "project:/contracts/interfaces/IWitnetRandomnessEvents.sol", "file": "./interfaces/IWitnetRandomnessEvents.sol", "id": 777, "nameLocation": "-1:-1:-1", "nodeType": "ImportDirective", "scope": 795, "sourceUnit": 13697, "src": "164:50:11", "symbolAliases": [], "unitAlias": "" }, { "abstract": true, "baseContracts": [ { "baseName": { "id": 778, "name": "IWitnetOracleEvents", "nameLocations": [ "270:19:11" ], "nodeType": "IdentifierPath", "referencedDeclaration": 13315, "src": "270:19:11" }, "id": 779, "nodeType": "InheritanceSpecifier", "src": "270:19:11" }, { "baseName": { "id": 780, "name": "IWitnetRandomness", "nameLocations": [ "300:17:11" ], "nodeType": "IdentifierPath", "referencedDeclaration": 13639, "src": "300:17:11" }, "id": 781, "nodeType": "InheritanceSpecifier", "src": "300:17:11" }, { "baseName": { "id": 782, "name": "IWitnetRandomnessEvents", "nameLocations": [ "328:23:11" ], "nodeType": "IdentifierPath", "referencedDeclaration": 13696, "src": "328:23:11" }, "id": 783, "nodeType": "InheritanceSpecifier", "src": "328:23:11" } ], "canonicalName": "WitnetRandomness", "contractDependencies": [], "contractKind": "contract", "fullyImplemented": false, "id": 794, "linearizedBaseContracts": [ 794, 13696, 13639, 13315 ], "name": "WitnetRandomness", "nameLocation": "236:16:11", "nodeType": "ContractDefinition", "nodes": [ { "functionSelector": "bff852fa", "id": 788, "implemented": false, "kind": "function", "modifiers": [], "name": "class", "nameLocation": "369:5:11", "nodeType": "FunctionDefinition", "parameters": { "id": 784, "nodeType": "ParameterList", "parameters": [], "src": "374:2:11" }, "returnParameters": { "id": 787, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 786, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 788, "src": "408:13:11", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_string_memory_ptr", "typeString": "string" }, "typeName": { "id": 785, "name": "string", "nodeType": "ElementaryTypeName", "src": "408:6:11", "typeDescriptions": { "typeIdentifier": "t_string_storage_ptr", "typeString": "string" } }, "visibility": "internal" } ], "src": "407:15:11" }, "scope": 794, "src": "360:63:11", "stateMutability": "view", "virtual": true, "visibility": "external" }, { "functionSelector": "adb7c3f7", "id": 793, "implemented": false, "kind": "function", "modifiers": [], "name": "specs", "nameLocation": "438:5:11", "nodeType": "FunctionDefinition", "parameters": { "id": 789, "nodeType": "ParameterList", "parameters": [], "src": "443:2:11" }, "returnParameters": { "id": 792, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 791, "mutability": "mutable", "name": "", "nameLocation": "-1:-1:-1", "nodeType": "VariableDeclaration", "scope": 793, "src": "477:6:11", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "typeName": { "id": 790, "name": "bytes4", "nodeType": "ElementaryTypeName", "src": "477:6:11", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "visibility": "internal" } ], "src": "476:8:11" }, "scope": 794, "src": "429:56:11", "stateMutability": "view", "virtual": true, "visibility": "external" } ], "scope": 795, "src": "218:270:11", "usedErrors": [], "usedEvents": [ 13278, 13285, 13294, 13307, 13314, 13695 ] } ], "src": "35:455:11" }, "compiler": { "name": "solc", "version": "0.8.25+commit.b61c2a91.Emscripten.clang" }, "networks": { "322": { "events": {}, "links": {}, "address": "0xC0FFEE98AD1434aCbDB894BbB752e138c1006fAB" }, "11155111": { "events": {}, "links": {}, "address": "0xC0FFEE98AD1434aCbDB894BbB752e138c1006fAB" } }, "schemaVersion": "3.4.16", "updatedAt": "2024-12-05T09:36:04.155Z", "devdoc": { "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. " } } }, "version": 1 }, "userdoc": { "events": { "WitnetQuery(uint256,uint256,(uint8,uint64))": { "notice": "Emitted every time a new query containing some verified data request is posted to the WRB." }, "WitnetQueryResponse(uint256,uint256)": { "notice": "Emitted when a query with no callback gets reported into the WRB." }, "WitnetQueryResponseDelivered(uint256,uint256,uint256)": { "notice": "Emitted when a query with a callback gets successfully reported into the WRB." }, "WitnetQueryResponseDeliveryFailed(uint256,bytes,uint256,uint256,string)": { "notice": "Emitted when a query with a callback cannot get reported into the WRB." }, "WitnetQueryRewardUpgraded(uint256,uint256)": { "notice": "Emitted when the reward of some not-yet reported query is upgraded." } }, "kind": "user", "methods": { "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 } }