witnet-solidity-bridge
Version:
Witnet Solidity Bridge contracts for EVM-compatible chains
965 lines • 171 kB
JSON
{
"contractName": "WitnetRandomnessRequestConsumer",
"abi": [
{
"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": "witnetQueryId",
"type": "uint256"
},
{
"internalType": "uint64",
"name": "witnetResultTimestamp",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "witnetResultTallyHash",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "witnetEvmFinalityBlock",
"type": "uint256"
},
{
"internalType": "enum Witnet.ResultErrorCodes",
"name": "errorCode",
"type": "uint8"
},
{
"components": [
{
"components": [
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "cursor",
"type": "uint256"
}
],
"internalType": "struct WitnetBuffer.Buffer",
"name": "buffer",
"type": "tuple"
},
{
"internalType": "uint8",
"name": "initialByte",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "majorType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "additionalInformation",
"type": "uint8"
},
{
"internalType": "uint64",
"name": "len",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "tag",
"type": "uint64"
}
],
"internalType": "struct WitnetCBOR.CBOR",
"name": "errorArgs",
"type": "tuple"
}
],
"name": "reportWitnetQueryError",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "witnetQueryId",
"type": "uint256"
},
{
"internalType": "uint64",
"name": "witnetResultTimestamp",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "witnetResultTallyHash",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "witnetEvmFinalityBlock",
"type": "uint256"
},
{
"components": [
{
"components": [
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "cursor",
"type": "uint256"
}
],
"internalType": "struct WitnetBuffer.Buffer",
"name": "buffer",
"type": "tuple"
},
{
"internalType": "uint8",
"name": "initialByte",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "majorType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "additionalInformation",
"type": "uint8"
},
{
"internalType": "uint64",
"name": "len",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "tag",
"type": "uint64"
}
],
"internalType": "struct WitnetCBOR.CBOR",
"name": "witnetResultCborValue",
"type": "tuple"
}
],
"name": "reportWitnetQueryResult",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_from",
"type": "address"
}
],
"name": "reportableFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "witnet",
"outputs": [
{
"internalType": "contract WitnetOracle",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":\"witnetQueryId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"witnetResultTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"witnetResultTallyHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"witnetEvmFinalityBlock\",\"type\":\"uint256\"},{\"internalType\":\"enum Witnet.ResultErrorCodes\",\"name\":\"errorCode\",\"type\":\"uint8\"},{\"components\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"cursor\",\"type\":\"uint256\"}],\"internalType\":\"struct WitnetBuffer.Buffer\",\"name\":\"buffer\",\"type\":\"tuple\"},{\"internalType\":\"uint8\",\"name\":\"initialByte\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"majorType\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"additionalInformation\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"len\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"tag\",\"type\":\"uint64\"}],\"internalType\":\"struct WitnetCBOR.CBOR\",\"name\":\"errorArgs\",\"type\":\"tuple\"}],\"name\":\"reportWitnetQueryError\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"witnetQueryId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"witnetResultTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"witnetResultTallyHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"witnetEvmFinalityBlock\",\"type\":\"uint256\"},{\"components\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"cursor\",\"type\":\"uint256\"}],\"internalType\":\"struct WitnetBuffer.Buffer\",\"name\":\"buffer\",\"type\":\"tuple\"},{\"internalType\":\"uint8\",\"name\":\"initialByte\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"majorType\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"additionalInformation\",\"type\":\"uint8\"},{\"internalType\":\"uint64\",\"name\":\"len\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"tag\",\"type\":\"uint64\"}],\"internalType\":\"struct WitnetCBOR.CBOR\",\"name\":\"witnetResultCborValue\",\"type\":\"tuple\"}],\"name\":\"reportWitnetQueryResult\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"}],\"name\":\"reportableFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"witnet\",\"outputs\":[{\"internalType\":\"contract WitnetOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_baseFeeOverheadPercentage\":\"Percentage over base fee to pay as on every data request.\",\"_callbackGasLimit\":\"Maximum gas to be spent by the IWitnetConsumer's callback methods.\",\"_wrb\":\"Address of the WitnetOracle contract.\"}},\"reportWitnetQueryError(uint256,uint64,bytes32,uint256,uint8,((bytes,uint256),uint8,uint8,uint8,uint64,uint64))\":{\"details\":\"It should revert if called from any other address different to the WitnetOracle being usedby the WitnetConsumer contract. \",\"params\":{\"errorArgs\":\"Error arguments, if any. An empty buffer is to be passed if no error arguments apply.\",\"errorCode\":\"The error code enum identifying the error produced during resolution on the Witnet blockchain.\",\"witnetEvmFinalityBlock\":\"EVM block at which the provided data can be considered to be final.\",\"witnetQueryId\":\"The unique identifier of the Witnet query being reported.\",\"witnetResultTallyHash\":\"Hash of the commit/reveal witnessing act that took place in the Witnet blockahin.\",\"witnetResultTimestamp\":\"Timestamp at which the reported value was captured by the Witnet blockchain. \"}},\"reportWitnetQueryResult(uint256,uint64,bytes32,uint256,((bytes,uint256),uint8,uint8,uint8,uint64,uint64))\":{\"details\":\"It should revert if called from any other address different to the WitnetOracle being usedby the WitnetConsumer contract. \",\"params\":{\"witnetEvmFinalityBlock\":\"EVM block at which the provided data can be considered to be final.\",\"witnetQueryId\":\"The unique identifier of the Witnet query being reported.\",\"witnetResultCborValue\":\"The CBOR-encoded resulting value of the Witnet query being reported.\",\"witnetResultTallyHash\":\"Hash of the commit/reveal witnessing act that took place in the Witnet blockahin.\",\"witnetResultTimestamp\":\"Timestamp at which the reported value was captured by the Witnet blockchain. \"}}},\"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\":{\"reportWitnetQueryError(uint256,uint64,bytes32,uint256,uint8,((bytes,uint256),uint8,uint8,uint8,uint64,uint64))\":{\"notice\":\"Method to be called from the WitnetOracle contract as soon as the given Witnet `queryId`gets reported, if reported WITH errors.\"},\"reportWitnetQueryResult(uint256,uint64,bytes32,uint256,((bytes,uint256),uint8,uint8,uint8,uint64,uint64))\":{\"notice\":\"Method to be called from the WitnetOracle contract as soon as the given Witnet `queryId`gets reported, if reported with no errors.\"},\"reportableFrom(address)\":{\"notice\":\"=============================================================================================================== --- Base implementation of IWitnetConsumer --------------------------------------------------------------------\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/apps/WitnetRandomnessRequestConsumer.sol\":\"WitnetRandomnessRequestConsumer\"},\"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/WitnetRequest.sol\":{\"keccak256\":\"0x5b5e8e9744de10fe86adf97826e3db5c5bcbf357d179a532ef4d7073c7c3af88\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://25bed2c86e46beb6f59024b731b9f3d1ab176312a28b090ad149ddea48841c32\",\"dweb:/ipfs/QmT3aAXfKQ2MTHo4dK1pCyhdvaLYf5TJtgcim5DfbWHjp4\"]},\"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/WitnetRequestTemplate.sol\":{\"keccak256\":\"0x10084f4f493f87d0acd9937fa786bf9e92512bf3670ee0427445d43c2cae973e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2491b8a6ec8f01a53f35f6aa602df8630955000f3dc67e7dc8b61b0b25a71657\",\"dweb:/ipfs/QmXEuPy6pVnSQpbg8G1DuVMKQyVfbTdtsDUrPYCbZNHARD\"]},\"project:/contracts/apps/UsingWitnet.sol\":{\"keccak256\":\"0x3fe6f2f1162bd1c128fb6aad2db81eaa1fdf04b5d15a5eeadf3e44bc81e2d4ef\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://927de4c99298ede8a240305bfd8e9daa5c79a32ed68cef19ece9b7f5bb37860b\",\"dweb:/ipfs/QmeZEbXpCTHegD6H7cVDipyXLYHUE4e3C66XojzYk8CpE4\"]},\"project:/contracts/apps/WitnetConsumer.sol\":{\"keccak256\":\"0xf1bb9a975c8bae03b99feb014e0dfb95640a20cc4a5e5a3037374db687a1e339\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6d6f1708356b2093c6b649f80e47c7a8ddaa07e66c31d32b4f439a8a6d07b209\",\"dweb:/ipfs/Qmd7fFXCaheGUqPfdZ6xv8dAVwUH7DzweE8squCRJ2NrAh\"]},\"project:/contracts/apps/WitnetRandomnessRequestConsumer.sol\":{\"keccak256\":\"0x9755e166bc9e4c800d35fc8571e6e2d4301712004276c24e518aa8daa0036049\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8b18199a5212e7d808a6810ec4b7458fa1c47add380e215b5341ee1b3550261f\",\"dweb:/ipfs/QmYb2Yn4SfkxqUnxeyi2XrgiPa2UAUmN2jjpazXSMTsRvU\"]},\"project:/contracts/interfaces/IWitnetConsumer.sol\":{\"keccak256\":\"0xf90fbcf0a59428c0ac13a3903214656060a95175adfdef8c11a7e16675b849e0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c2606640d3f343051ea18dfb8e136dfdb73ceecd8016c82ddb73d67ad39a30e0\",\"dweb:/ipfs/QmTADVW4M8pge6pGfenFAauEDk4yZEy78o5ksZiKGwP3DT\"]},\"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/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.7.0 <0.9.0;\r\npragma experimental ABIEncoderV2;\r\n\r\nimport \"./WitnetConsumer.sol\";\r\nimport \"../WitnetRequest.sol\";\r\n\r\nabstract contract WitnetRandomnessRequestConsumer\r\n is\r\n WitnetConsumer\r\n{\r\n using Witnet for bytes;\r\n using WitnetCBOR for WitnetCBOR.CBOR;\r\n using WitnetV2 for bytes32;\r\n using WitnetV2 for WitnetV2.RadonSLA;\r\n\r\n bytes32 internal immutable __witnetRandomnessRadHash;\r\n\r\n /// @param _wrb Address of the WitnetOracle contract.\r\n /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request.\r\n /// @param _callbackGasLimit Maximum gas to be spent by the IWitnetConsumer's callback methods.\r\n constructor(\r\n WitnetOracle _wrb, \r\n uint16 _baseFeeOverheadPercentage,\r\n uint24 _callbackGasLimit\r\n )\r\n UsingWitnet(_wrb)\r\n WitnetConsumer(_callbackGasLimit)\r\n {\r\n // On-chain building of the Witnet Randomness Request:\r\n {\r\n WitnetRequestBytecodes _registry = witnet().registry();\r\n // Build own Witnet Randomness Request:\r\n bytes32[] memory _retrievals = new bytes32[](1);\r\n _retrievals[0] = _registry.verifyRadonRetrieval(\r\n Witnet.RadonDataRequestMethods.RNG,\r\n \"\", // no url\r\n \"\", // no body\r\n new string[2][](0), // no headers\r\n hex\"80\" // no retrieval script\r\n );\r\n Witnet.RadonFilter[] memory _filters;\r\n bytes32 _aggregator = _registry.verifyRadonReducer(Witnet.RadonReducer({\r\n opcode: Witnet.RadonReducerOpcodes.Mode,\r\n filters: _filters // no filters\r\n }));\r\n bytes32 _tally = _registry.verifyRadonReducer(Witnet.RadonReducer({\r\n opcode: Witnet.RadonReducerOpcodes.ConcatenateAndHash,\r\n filters: _filters // no filters\r\n }));\r\n __witnetRandomnessRadHash = _registry.verifyRadonRequest(\r\n _retrievals,\r\n _aggregator,\r\n _tally,\r\n 32, // 256 bits of pure entropy ;-)\r\n new string[][](_retrievals.length)\r\n );\r\n }\r\n __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage;\r\n }\r\n\r\n function _witnetEstimateEvmReward() virtual override internal view returns (uint256) {\r\n return _witnetEstimateEvmReward(32);\r\n }\r\n\r\n function _witnetRandomUniformUint32(uint32 _range, uint256 _nonce, bytes32 _seed) internal pure returns (uint32) {\r\n uint256 _number = uint256(\r\n keccak256(\r\n abi.encode(_seed, _nonce)\r\n )\r\n ) & uint256(2 ** 224 - 1);\r\n return uint32((_number * _range) >> 224);\r\n }\r\n\r\n function _witnetReadRandomizeFromResultValue(WitnetCBOR.CBOR calldata cborValue) internal pure returns (bytes32) {\r\n return cborValue.readBytes().toBytes32();\r\n }\r\n\r\n function __witnetRandomize(uint256 _witnetEvmReward) virtual internal returns (uint256) {\r\n return __witnetRandomize(_witnetEvmReward, __witnetDefaultSLA);\r\n }\r\n\r\n function __witnetRandomize(\r\n uint256 _witnetEvmReward,\r\n WitnetV2.RadonSLA memory _witnetQuerySLA\r\n )\r\n virtual internal \r\n returns (uint256 _randomizeId)\r\n {\r\n return __witnet.postRequestWithCallback{\r\n value: _witnetEvmReward\r\n }(\r\n __witnetRandomnessRadHash,\r\n _witnetQuerySLA,\r\n __witnetCallbackGasLimit\r\n );\r\n }\r\n}\r\n",
"sourcePath": "C:\\Users\\guill\\github\\witnet\\witnet-solidity-bridge\\contracts\\apps\\WitnetRandomnessRequestConsumer.sol",
"ast": {
"absolutePath": "project:/contracts/apps/WitnetRandomnessRequestConsumer.sol",
"exportedSymbols": {
"IWitnetConsumer": [
12829
],
"IWitnetOracle": [
13265
],
"IWitnetOracleEvents": [
13315
],
"IWitnetRequestBytecodes": [
13979
],
"IWitnetRequestFactory": [
14002
],
"UsingWitnet": [
1157
],
"Witnet": [
17557
],
"WitnetBuffer": [
19191
],
"WitnetCBOR": [
20734
],
"WitnetConsumer": [
1566
],
"WitnetOracle": [
749
],
"WitnetRandomnessRequestConsumer": [
1992
],
"WitnetRequest": [
826
],
"WitnetRequestBytecodes": [
849
],
"WitnetRequestFactory": [
880
],
"WitnetRequestTemplate": [
1005
],
"WitnetV2": [
23640
]
},
"id": 1993,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1754,
"literals": [
"solidity",
">=",
"0.7",
".0",
"<",
"0.9",
".0"
],
"nodeType": "PragmaDirective",
"src": "35:31:22"
},
{
"id": 1755,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "68:33:22"
},
{
"absolutePath": "project:/contracts/apps/WitnetConsumer.sol",
"file": "./WitnetConsumer.sol",
"id": 1756,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 1993,
"sourceUnit": 1567,
"src": "105:30:22",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "project:/contracts/WitnetRequest.sol",
"file": "../WitnetRequest.sol",
"id": 1757,
"nameLocation": "-1:-1:-1",
"nodeType": "ImportDirective",
"scope": 1993,
"sourceUnit": 827,
"src": "137:30:22",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": true,
"baseContracts": [
{
"baseName": {
"id": 1758,
"name": "WitnetConsumer",
"nameLocations": [
"238:14:22"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 1566,
"src": "238:14:22"
},
"id": 1759,
"nodeType": "InheritanceSpecifier",
"src": "238:14:22"
}
],
"canonicalName": "WitnetRandomnessRequestConsumer",
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": false,
"id": 1992,
"linearizedBaseContracts": [
1992,
1566,
1157,
13315,
12829
],
"name": "WitnetRandomnessRequestConsumer",
"nameLocation": "189:31:22",
"nodeType": "ContractDefinition",
"nodes": [
{
"global": false,
"id": 1762,
"libraryName": {
"id": 1760,
"name": "Witnet",
"nameLocations": [
"267:6:22"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 17557,
"src": "267:6:22"
},
"nodeType": "UsingForDirective",
"src": "261:23:22",
"typeName": {
"id": 1761,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "278:5:22",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
}
},
{
"global": false,
"id": 1766,
"libraryName": {
"id": 1763,
"name": "WitnetCBOR",
"nameLocations": [
"296:10:22"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 20734,
"src": "296:10:22"
},
"nodeType": "UsingForDirective",
"src": "290:37:22",
"typeName": {
"id": 1765,
"nodeType": "UserDefinedTypeName",
"pathNode": {
"id": 1764,
"name": "WitnetCBOR.CBOR",
"nameLocations": [
"311:10:22",
"322:4:22"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 19218,
"src": "311:15:22"
},
"referencedDeclaration": 19218,
"src": "311:15:22",
"typeDescriptions": {
"typeIdentifier": "t_struct$_CBOR_$19218_storage_ptr",
"typeString": "struct WitnetCBOR.CBOR"
}
}
},
{
"global": false,
"id": 1769,
"libraryName": {
"id": 1767,
"name": "WitnetV2",
"nameLocations": [
"339:8:22"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 23640,
"src": "339:8:22"
},
"nodeType": "UsingForDirective",
"src": "333:27:22",
"typeName": {
"id": 1768,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "352:7:22",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
},
{
"global": false,
"id": 1773,
"libraryName": {
"id": 1770,
"name": "WitnetV2",
"nameLocations": [
"372:8:22"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 23640,
"src": "372:8:22"
},
"nodeType": "UsingForDirective",
"src": "366:37:22",
"typeName": {
"id": 1772,
"nodeType": "UserDefinedTypeName",
"pathNode": {
"id": 1771,
"name": "WitnetV2.RadonSLA",
"nameLocations": [
"385:8:22",
"394:8:22"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 23503,
"src": "385:17:22"
},
"referencedDeclaration": 23503,
"src": "385:17:22",
"typeDescriptions": {
"typeIdentifier": "t_struct$_RadonSLA_$23503_storage_ptr",
"typeString": "struct WitnetV2.RadonSLA"
}
}
},
{
"constant": false,
"id": 1775,
"mutability": "immutable",
"name": "__witnetRandomnessRadHash",
"nameLocation": "438:25:22",
"nodeType": "VariableDeclaration",
"scope": 1992,
"src": "411:52:22",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 1774,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "411:7:22",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"visibility": "internal"
},
{
"body": {
"id": 1887,
"nodeType": "Block",
"src": "951:1403:22",
"statements": [
{
"id": 1882,
"nodeType": "Block",
"src": "1026:1248:22",
"statements": [
{
"assignments": [
1794
],
"declarations": [
{
"constant": false,
"id": 1794,
"mutability": "mutable",
"name": "_registry",
"nameLocation": "1064:9:22",
"nodeType": "VariableDeclaration",
"scope": 1882,
"src": "1041:32:22",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetRequestBytecodes_$849",
"typeString": "contract WitnetRequestBytecodes"
},
"typeName": {
"id": 1793,
"nodeType": "UserDefinedTypeName",
"pathNode": {
"id": 1792,
"name": "WitnetRequestBytecodes",
"nameLocations": [
"1041:22:22"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 849,
"src": "1041:22:22"
},
"referencedDeclaration": 849,
"src": "1041:22:22",
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetRequestBytecodes_$849",
"typeString": "contract WitnetRequestBytecodes"
}
},
"visibility": "internal"
}
],
"id": 1799,
"initialValue": {
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 1795,
"name": "witnet",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1086,
"src": "1076:6:22",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_WitnetOracle_$749_$",
"typeString": "function () view returns (contract WitnetOracle)"
}
},
"id": 1796,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1076:8:22",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetOracle_$749",
"typeString": "contract WitnetOracle"
}
},
"id": 1797,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "1085:8:22",
"memberName": "registry",
"nodeType": "MemberAccess",
"referencedDeclaration": 743,
"src": "1076:17:22",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_contract$_WitnetRequestBytecodes_$849_$",
"typeString": "function () view external returns (contract WitnetRequestBytecodes)"
}
},
"id": 1798,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1076:19:22",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_WitnetRequestBytecodes_$849",
"typeString": "contract WitnetRequestBytecodes"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1041:54:22"
},
{
"assignments": [
1804
],
"declarations": [
{
"constant": false,
"id": 1804,
"mutability": "mutable",
"name": "_retrievals",
"nameLocation": "1180:11:22",
"nodeType": "VariableDeclaration",
"scope": 1882,
"src": "1163:28:22",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr",
"typeString": "bytes32[]"
},
"typeName": {
"baseType": {
"id": 1802,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1163:7:22",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 1803,
"nodeType": "ArrayTypeName",
"src": "1163:9:22",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr",
"typeString": "bytes32[]"
}
},
"visibility": "internal"
}
],
"id": 1810,
"initialValue": {
"arguments": [
{
"hexValue": "31",
"id": 1808,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1208:1:22",
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
}
],
"id": 1807,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "NewExpression",
"src": "1194:13:22",
"typeDescriptions": {
"typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_bytes32_$dyn_memory_ptr_$",
"typeString": "function (uint256) pure returns (bytes32[] memory)"
},
"typeName": {
"baseType": {
"id": 1805,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "1198:7:22",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 1806,
"nodeType": "ArrayTypeName",
"src": "1198:9:22",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr",
"typeString": "bytes32[]"
}
}
},
"id": 1809,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "functionCall",
"lValueRequested": false,
"nameLocations": [],
"names": [],
"nodeType": "FunctionCall",
"src": "1194:16:22",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr",
"typeString": "bytes32[] memory"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1163:47:22"
},
{
"expression": {
"id": 1830,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"baseExpression": {
"id": 1811,
"name": "_retrievals",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1804,
"src": "1225:11:22",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr",
"typeString": "bytes32[] memory"
}
},
"id": 1813,
"indexExpression": {
"hexValue": "30",
"id": 1812,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1237:1:22",
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "1225:14:22",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"arguments": [
{
"expression": {
"expression": {
"id": 1816,
"name": "Witnet",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 17557,
"src": "1291:6:22",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_Witnet_$17557_$",
"typeString": "type(library Witnet)"
}
},
"id": 1817,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberLocation": "1298:23:22",
"memberName": "RadonDataRequestMethods",
"nodeType": "MemberAccess",
"referencedDeclaration": 16410,
"src": "1291:30:22",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_enum$_RadonDataRequestMethods_$16410_$",
"typeString": "type(enum Witnet.RadonDataRequestMethods)"
}
},
"id": 1818,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueR