From e97024e2bef184f62d4d23334919a9d9a283cf6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Tue, 30 Jul 2024 19:31:05 +0200 Subject: [PATCH 01/39] refactor: Witnet.RadonDataRequestMethods -> Witnet.RadonRetrievalMethods --- .../apps/WitnetRandomnessRequestConsumer.sol | 2 +- .../WitnetRequestBytecodesDefault.sol | 12 ++++---- contracts/libs/Witnet.sol | 28 +++++++------------ contracts/libs/WitnetEncodingLib.sol | 10 +++---- test/TestWitnetEncodingLib.sol | 4 +-- 5 files changed, 24 insertions(+), 32 deletions(-) diff --git a/contracts/apps/WitnetRandomnessRequestConsumer.sol b/contracts/apps/WitnetRandomnessRequestConsumer.sol index c71680ef..c59a5d18 100644 --- a/contracts/apps/WitnetRandomnessRequestConsumer.sol +++ b/contracts/apps/WitnetRandomnessRequestConsumer.sol @@ -34,7 +34,7 @@ abstract contract WitnetRandomnessRequestConsumer // Build own Witnet Randomness Request: bytes32[] memory _retrievals = new bytes32[](1); _retrievals[0] = _registry.verifyRadonRetrieval( - Witnet.RadonDataRequestMethods.RNG, + Witnet.RadonRetrievalMethods.RNG, "", // no url "", // no body new string[2][](0), // no headers diff --git a/contracts/core/defaults/WitnetRequestBytecodesDefault.sol b/contracts/core/defaults/WitnetRequestBytecodesDefault.sol index 07c41458..72b4340e 100644 --- a/contracts/core/defaults/WitnetRequestBytecodesDefault.sol +++ b/contracts/core/defaults/WitnetRequestBytecodesDefault.sol @@ -22,7 +22,7 @@ contract WitnetRequestBytecodesDefault using Witnet for string; using WitnetV2 for WitnetV2.RadonSLA; - using WitnetEncodingLib for Witnet.RadonDataRequestMethods; + using WitnetEncodingLib for Witnet.RadonRetrievalMethods; using WitnetEncodingLib for Witnet.RadonRetrieval; using WitnetEncodingLib for Witnet.RadonRetrieval[]; using WitnetEncodingLib for Witnet.RadonReducer; @@ -233,7 +233,7 @@ contract WitnetRequestBytecodesDefault returns (Witnet.RadonRetrieval memory _source) { _source = __database().retrievals[_hash]; - if (_source.method == Witnet.RadonDataRequestMethods.Unknown) { + if (_source.method == Witnet.RadonRetrievalMethods.Unknown) { revert UnknownRadonRetrieval(_hash); } } @@ -243,7 +243,7 @@ contract WitnetRequestBytecodesDefault override returns (uint8) { - if (__database().retrievals[_hash].method == Witnet.RadonDataRequestMethods.Unknown) { + if (__database().retrievals[_hash].method == Witnet.RadonRetrievalMethods.Unknown) { revert UnknownRadonRetrieval(_hash); } return __database().retrievals[_hash].argsCount; @@ -254,7 +254,7 @@ contract WitnetRequestBytecodesDefault override returns (Witnet.RadonDataTypes) { - if (__database().retrievals[_hash].method == Witnet.RadonDataRequestMethods.Unknown) { + if (__database().retrievals[_hash].method == Witnet.RadonRetrievalMethods.Unknown) { revert UnknownRadonRetrieval(_hash); } return __database().retrievals[_hash].resultDataType; @@ -324,7 +324,7 @@ contract WitnetRequestBytecodesDefault } function verifyRadonRetrieval( - Witnet.RadonDataRequestMethods _requestMethod, + Witnet.RadonRetrievalMethods _requestMethod, string calldata _requestURL, string calldata _requestBody, string[2][] memory _requestHeaders, @@ -344,7 +344,7 @@ contract WitnetRequestBytecodesDefault // should it be a new data source: if ( - __database().retrievals[hash].method == Witnet.RadonDataRequestMethods.Unknown + __database().retrievals[hash].method == Witnet.RadonRetrievalMethods.Unknown ) { // compose data source and save it in storage: __database().retrievals[hash] = Witnet.RadonRetrieval({ diff --git a/contracts/libs/Witnet.sol b/contracts/libs/Witnet.sol index a31618bc..7715ddb0 100644 --- a/contracts/libs/Witnet.sol +++ b/contracts/libs/Witnet.sol @@ -274,16 +274,6 @@ library Witnet { || self == ResultErrorCodes.BridgeOversizedTallyResult ); } - - - /// Possible Radon data request methods that can be used within a Radon Retrieval. - enum RadonDataRequestMethods { - /* 0 */ Unknown, - /* 1 */ HttpGet, - /* 2 */ RNG, - /* 3 */ HttpPost, - /* 4 */ HttpHead - } /// Possible types either processed by Witnet Radon Scripts or included within results to Witnet Data Requests. enum RadonDataTypes { @@ -350,19 +340,21 @@ library Witnet { /// Structure containing all the parameters that fully describe a Witnet Radon Retrieval within a Witnet Data Request. struct RadonRetrieval { uint8 argsCount; - RadonDataRequestMethods method; - RadonDataTypes resultDataType; + RadonRetrievalMethods method; + RadonDataTypes dataType; string url; string body; string[2][] headers; - bytes script; + bytes radonScript; } - /// Structure containing the Retrieve-Attestation-Delivery parts of a Witnet Data Request. - struct RadonRAD { - RadonRetrieval[] retrieve; - RadonReducer aggregate; - RadonReducer tally; + /// Possible Radon retrieval methods that can be used within a Radon Retrieval. + enum RadonRetrievalMethods { + /* 0 */ Unknown, + /* 1 */ HttpGet, + /* 2 */ RNG, + /* 3 */ HttpPost, + /* 4 */ HttpHead } /// Structure containing the Service Level Aggreement parameters of a Witnet Data Request. diff --git a/contracts/libs/WitnetEncodingLib.sol b/contracts/libs/WitnetEncodingLib.sol index 6967464b..ff261455 100644 --- a/contracts/libs/WitnetEncodingLib.sol +++ b/contracts/libs/WitnetEncodingLib.sol @@ -317,7 +317,7 @@ library WitnetEncodingLib { } function validate( - Witnet.RadonDataRequestMethods method, + Witnet.RadonRetrievalMethods method, string memory url, string memory body, string[2][] memory headers, @@ -329,11 +329,11 @@ library WitnetEncodingLib { if (!( bytes(url).length > 0 && ( - method == Witnet.RadonDataRequestMethods.HttpGet - || method == Witnet.RadonDataRequestMethods.HttpPost - || method == Witnet.RadonDataRequestMethods.HttpHead + method == Witnet.RadonRetrievalMethods.HttpGet + || method == Witnet.RadonRetrievalMethods.HttpPost + || method == Witnet.RadonRetrievalMethods.HttpHead ) - || method == Witnet.RadonDataRequestMethods.RNG + || method == Witnet.RadonRetrievalMethods.RNG && bytes(url).length == 0 && headers.length == 0 && script.length >= 1 diff --git a/test/TestWitnetEncodingLib.sol b/test/TestWitnetEncodingLib.sol index 64628a4a..c4a60938 100644 --- a/test/TestWitnetEncodingLib.sol +++ b/test/TestWitnetEncodingLib.sol @@ -86,7 +86,7 @@ contract TestWitnetEncodingLib { function testEncodeRadonRetrievalUrlOnly() external { Witnet.RadonRetrieval memory source; - source.method = Witnet.RadonDataRequestMethods.HttpGet; + source.method = Witnet.RadonRetrievalMethods.HttpGet; source.url = "https://data.messar.io/api/v1/assets/\\0\\/metrics/market-data?fields=market_data/price_\\1\\"; source.script = hex"861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b"; bytes memory bytecode = WitnetEncodingLib.encode(source); @@ -100,7 +100,7 @@ contract TestWitnetEncodingLib { function testEncodeRadonRetrievalUrlBodyHeaders() external { Witnet.RadonRetrieval memory source; - source.method = Witnet.RadonDataRequestMethods.HttpPost; + source.method = Witnet.RadonRetrievalMethods.HttpPost; source.url = "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3"; source.body = "{\"query\":\"{pool(id:\\\"0xc2a856c3aff2110c1171b8f942256d40e980c726\\\"){token1Price}}\"}"; source.headers = new string[2][](2); From 0e5ab1b7b30a2603bc51754a4614e0e86b2bf043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Tue, 30 Jul 2024 19:38:42 +0200 Subject: [PATCH 02/39] refactor: Witnet.Radon* --- contracts/libs/Witnet.sol | 12 ++++++++++-- contracts/libs/WitnetEncodingLib.sol | 22 +++++++++++----------- test/TestWitnetEncodingLib.sol | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/contracts/libs/Witnet.sol b/contracts/libs/Witnet.sol index 7715ddb0..fcdd52d8 100644 --- a/contracts/libs/Witnet.sol +++ b/contracts/libs/Witnet.sol @@ -297,7 +297,7 @@ library Witnet { /// within a Witnet Data Request resolution workflow. struct RadonFilter { RadonFilterOpcodes opcode; - bytes args; + bytes cborArgs; } /// Filtering methods currently supported on the Witnet blockchain. @@ -337,6 +337,14 @@ library Witnet { /* 0x0B */ ConcatenateAndHash } + + /// Structure containing the Retrieve-Attestation-Delivery parts of a Witnet-compliant Data Request. + struct RadonRequest { + RadonRetrieval[] retrieve; + RadonReducer aggregate; + RadonReducer tally; + } + /// Structure containing all the parameters that fully describe a Witnet Radon Retrieval within a Witnet Data Request. struct RadonRetrieval { uint8 argsCount; @@ -357,7 +365,7 @@ library Witnet { /* 4 */ HttpHead } - /// Structure containing the Service Level Aggreement parameters of a Witnet Data Request. + /// Structure containing the SLA security parameters of a Witnet-compliant Data Request. struct RadonSLA { uint8 numWitnesses; uint8 minConsensusPercentage; diff --git a/contracts/libs/WitnetEncodingLib.sol b/contracts/libs/WitnetEncodingLib.sol index ff261455..19c16b82 100644 --- a/contracts/libs/WitnetEncodingLib.sol +++ b/contracts/libs/WitnetEncodingLib.sol @@ -154,10 +154,10 @@ library WitnetEncodingLib { ); } bytes memory _encodedScript; - if (source.script.length > 0) { + if (source.radonScript.length > 0) { _encodedScript = abi.encodePacked( - encode(uint64(source.script.length), bytes1(0x1a)), - source.script + encode(uint64(source.radonScript.length), bytes1(0x1a)), + source.radonScript ); } bytes memory _encodedBody; @@ -253,10 +253,10 @@ library WitnetEncodingLib { { bytecode = abi.encodePacked( encode(uint64(filter.opcode), bytes1(0x08)), - filter.args.length > 0 + filter.cborArgs.length > 0 ? abi.encodePacked( - encode(uint64(filter.args.length), bytes1(0x12)), - filter.args + encode(uint64(filter.cborArgs.length), bytes1(0x12)), + filter.cborArgs ) : bytes("") ); return abi.encodePacked( @@ -310,7 +310,7 @@ library WitnetEncodingLib { { self.url = WitnetBuffer.replace(self.url, args); self.body = WitnetBuffer.replace(self.body, args); - self.script = replaceCborStringsFromBytes(self.script, args); + self.radonScript = replaceCborStringsFromBytes(self.radonScript, args); for (uint _ix = 0 ; _ix < self.headers.length; _ix ++) { self.headers[_ix][1] = WitnetBuffer.replace(self.headers[_ix][1], args); } @@ -390,15 +390,15 @@ library WitnetEncodingLib { filter.opcode == Witnet.RadonFilterOpcodes.StandardDeviation ) { // check filters that require arguments - if (filter.args.length == 0) { - revert UnsupportedRadonFilterArgs(uint8(filter.opcode), filter.args); + if (filter.cborArgs.length == 0) { + revert UnsupportedRadonFilterArgs(uint8(filter.opcode), filter.cborArgs); } } else if ( filter.opcode == Witnet.RadonFilterOpcodes.Mode ) { // check filters that don't require any arguments - if (filter.args.length > 0) { - revert UnsupportedRadonFilterArgs(uint8(filter.opcode), filter.args); + if (filter.cborArgs.length > 0) { + revert UnsupportedRadonFilterArgs(uint8(filter.opcode), filter.cborArgs); } } else { // reject unsupported opcodes diff --git a/test/TestWitnetEncodingLib.sol b/test/TestWitnetEncodingLib.sol index c4a60938..3e016a49 100644 --- a/test/TestWitnetEncodingLib.sol +++ b/test/TestWitnetEncodingLib.sol @@ -74,7 +74,7 @@ contract TestWitnetEncodingLib { reducer.opcode = Witnet.RadonReducerOpcodes.Mode; reducer.filters = new Witnet.RadonFilter[](1); reducer.filters[0].opcode = Witnet.RadonFilterOpcodes.StandardDeviation; - reducer.filters[0].args = hex"fa40200000"; + reducer.filters[0].cborArgs = hex"fa40200000"; bytes memory bytecode = WitnetEncodingLib.encode(reducer); // emit Log(bytecode); Assert.equal( From b59090fc9fb8f35b7fff8455d18fd9910e7f6d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Tue, 30 Jul 2024 20:25:24 +0200 Subject: [PATCH 03/39] refactor: merge WitnetV2.* into Witnet.* --- contracts/apps/UsingWitnet.sol | 8 +- contracts/apps/UsingWitnetRequest.sol | 2 +- contracts/apps/UsingWitnetRequestTemplate.sol | 2 +- .../apps/WitnetRandomnessRequestConsumer.sol | 6 +- contracts/apps/WitnetRequestConsumer.sol | 2 +- .../apps/WitnetRequestTemplateConsumer.sol | 2 +- .../customs/WitnetOracleTrustableObscuro.sol | 2 +- .../customs/WitnetOracleTrustableOvm2.sol | 8 +- .../defaults/WitnetOracleTrustableBase.sol | 60 +++++----- .../core/defaults/WitnetPriceFeedsDefault.sol | 46 ++++---- .../WitnetRequestBytecodesDefault.sol | 8 +- contracts/data/WitnetOracleDataLib.sol | 58 +++++----- contracts/data/WitnetRequestBytecodesData.sol | 2 +- contracts/interfaces/IWitnetFeeds.sol | 10 +- contracts/interfaces/IWitnetFeedsAdmin.sol | 4 +- contracts/interfaces/IWitnetOracle.sol | 26 +++-- contracts/interfaces/IWitnetOracleEvents.sol | 2 +- .../interfaces/IWitnetOracleReporter.sol | 2 +- contracts/interfaces/IWitnetPriceSolver.sol | 4 +- .../interfaces/IWitnetRandomnessAdmin.sol | 2 +- .../interfaces/IWitnetRandomnessEvents.sol | 2 +- contracts/libs/Witnet.sol | 100 +++++++++++++--- contracts/libs/WitnetEncodingLib.sol | 4 +- contracts/libs/WitnetErrorsLib.sol | 12 +- contracts/libs/WitnetV2.sol | 109 ------------------ test/TestWitnetEncodingLib.sol | 4 +- test/TestWitnetV2.sol | 24 ++-- test/witnet_bytecodes.test.js | 28 ++--- 28 files changed, 252 insertions(+), 287 deletions(-) delete mode 100644 contracts/libs/WitnetV2.sol diff --git a/contracts/apps/UsingWitnet.sol b/contracts/apps/UsingWitnet.sol index 11ef2a7b..008ab22f 100644 --- a/contracts/apps/UsingWitnet.sol +++ b/contracts/apps/UsingWitnet.sol @@ -17,7 +17,7 @@ abstract contract UsingWitnet /// @dev Default Security-Level Agreement parameters to be fulfilled by the Witnet blockchain /// @dev when solving a data request. - WitnetV2.RadonSLA internal __witnetDefaultSLA; + Witnet.RadonSLA internal __witnetDefaultSLA; /// @dev Percentage over base fee to pay on every data request, /// @dev as to deal with volatility of evmGasPrice and evmWitPrice during the live time of @@ -32,7 +32,7 @@ abstract contract UsingWitnet "UsingWitnet: uncompliant WitnetOracle" ); __witnet = _wrb; - __witnetDefaultSLA = WitnetV2.RadonSLA({ + __witnetDefaultSLA = Witnet.RadonSLA({ // Number of nodes in the Witnet blockchain that will take part in solving the data request: committeeSize: 10, // Fee in $nanoWIT paid to every node in the Witnet blockchain involved in solving the data request: @@ -60,7 +60,7 @@ abstract contract UsingWitnet internal view returns (bool) { - return __witnet.getQueryStatus(_id) == WitnetV2.QueryStatus.Reported; + return __witnet.getQueryStatus(_id) == Witnet.QueryStatus.Reported; } /// @notice Estimate the minimum reward required for posting a data request, using `tx.gasprice` as a reference. @@ -78,7 +78,7 @@ abstract contract UsingWitnet function _witnetCheckQueryResponseStatus(uint256 _witnetQueryId) internal view - returns (WitnetV2.ResponseStatus) + returns (Witnet.ResponseStatus) { return __witnet.getQueryResponseStatus(_witnetQueryId); } diff --git a/contracts/apps/UsingWitnetRequest.sol b/contracts/apps/UsingWitnetRequest.sol index cf8541f0..45c353b9 100644 --- a/contracts/apps/UsingWitnetRequest.sol +++ b/contracts/apps/UsingWitnetRequest.sol @@ -45,7 +45,7 @@ abstract contract UsingWitnetRequest function __witnetRequestData( uint256 _witnetEvmReward, - WitnetV2.RadonSLA memory _witnetQuerySLA + Witnet.RadonSLA memory _witnetQuerySLA ) virtual internal returns (uint256) { diff --git a/contracts/apps/UsingWitnetRequestTemplate.sol b/contracts/apps/UsingWitnetRequestTemplate.sol index 1823bdce..4e25ec0b 100644 --- a/contracts/apps/UsingWitnetRequestTemplate.sol +++ b/contracts/apps/UsingWitnetRequestTemplate.sol @@ -59,7 +59,7 @@ abstract contract UsingWitnetRequestTemplate function __witnetRequestData( uint256 _witnetEvmReward, string[][] memory _witnetRequestArgs, - WitnetV2.RadonSLA memory _witnetQuerySLA + Witnet.RadonSLA memory _witnetQuerySLA ) virtual internal returns (uint256) { diff --git a/contracts/apps/WitnetRandomnessRequestConsumer.sol b/contracts/apps/WitnetRandomnessRequestConsumer.sol index c59a5d18..b8b911ef 100644 --- a/contracts/apps/WitnetRandomnessRequestConsumer.sol +++ b/contracts/apps/WitnetRandomnessRequestConsumer.sol @@ -11,9 +11,9 @@ abstract contract WitnetRandomnessRequestConsumer WitnetConsumer { using Witnet for bytes; + using Witnet for bytes32; + using Witnet for Witnet.RadonSLA; using WitnetCBOR for WitnetCBOR.CBOR; - using WitnetV2 for bytes32; - using WitnetV2 for WitnetV2.RadonSLA; bytes32 internal immutable __witnetRandomnessRadHash; @@ -83,7 +83,7 @@ abstract contract WitnetRandomnessRequestConsumer function __witnetRandomize( uint256 _witnetEvmReward, - WitnetV2.RadonSLA memory _witnetQuerySLA + Witnet.RadonSLA memory _witnetQuerySLA ) virtual internal returns (uint256 _randomizeId) diff --git a/contracts/apps/WitnetRequestConsumer.sol b/contracts/apps/WitnetRequestConsumer.sol index f0098aa0..684eacb6 100644 --- a/contracts/apps/WitnetRequestConsumer.sol +++ b/contracts/apps/WitnetRequestConsumer.sol @@ -42,7 +42,7 @@ abstract contract WitnetRequestConsumer function __witnetRequestData( uint256 _witnetEvmReward, - WitnetV2.RadonSLA memory _witnetQuerySLA + Witnet.RadonSLA memory _witnetQuerySLA ) virtual override internal returns (uint256) diff --git a/contracts/apps/WitnetRequestTemplateConsumer.sol b/contracts/apps/WitnetRequestTemplateConsumer.sol index 28b179fa..55526442 100644 --- a/contracts/apps/WitnetRequestTemplateConsumer.sol +++ b/contracts/apps/WitnetRequestTemplateConsumer.sol @@ -43,7 +43,7 @@ abstract contract WitnetRequestTemplateConsumer function __witnetRequestData( uint256 _witnetEvmReward, string[][] memory _witnetRequestArgs, - WitnetV2.RadonSLA memory _witnetQuerySLA + Witnet.RadonSLA memory _witnetQuerySLA ) virtual override internal returns (uint256) diff --git a/contracts/core/customs/WitnetOracleTrustableObscuro.sol b/contracts/core/customs/WitnetOracleTrustableObscuro.sol index 34418f09..b010fb7f 100644 --- a/contracts/core/customs/WitnetOracleTrustableObscuro.sol +++ b/contracts/core/customs/WitnetOracleTrustableObscuro.sol @@ -64,7 +64,7 @@ contract WitnetOracleTrustableObscuro public view virtual override onlyRequester(_queryId) - returns (WitnetV2.Response memory _response) + returns (Witnet.Response memory _response) { return WitnetOracleTrustableBase.getQueryResponse(_queryId); } diff --git a/contracts/core/customs/WitnetOracleTrustableOvm2.sol b/contracts/core/customs/WitnetOracleTrustableOvm2.sol index cab27a42..683cb136 100644 --- a/contracts/core/customs/WitnetOracleTrustableOvm2.sol +++ b/contracts/core/customs/WitnetOracleTrustableOvm2.sol @@ -21,7 +21,7 @@ contract WitnetOracleTrustableOvm2 is WitnetOracleTrustableDefault { - using WitnetV2 for WitnetV2.RadonSLA; + using Witnet for Witnet.RadonSLA; function class() virtual override public view returns (string memory) { return type(WitnetOracleTrustableOvm2).name; @@ -118,8 +118,8 @@ contract WitnetOracleTrustableOvm2 returns (uint256 _revenues, uint256 _expenses) { for (uint _ix = 0; _ix < _witnetQueryIds.length; _ix ++) { - if (WitnetOracleDataLib.seekQueryStatus(_witnetQueryIds[_ix]) == WitnetV2.QueryStatus.Posted) { - WitnetV2.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryIds[_ix]); + if (WitnetOracleDataLib.seekQueryStatus(_witnetQueryIds[_ix]) == Witnet.QueryStatus.Posted) { + Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryIds[_ix]); if (__request.gasCallback > 0) { _expenses += WitnetOracleTrustableDefault.estimateBaseFeeWithCallback( _reportTxGasPrice, @@ -129,7 +129,7 @@ contract WitnetOracleTrustableOvm2 if (__request.witnetRAD != bytes32(0)) { _expenses += WitnetOracleTrustableDefault.estimateBaseFee( _reportTxGasPrice, - registry.lookupRadonRequestResultMaxSize(__request.witnetRAD) + __registry.lookupRadonRequestResultMaxSize(__request.witnetRAD) ); } else { // todo: improve profit estimation accuracy if reporting on deleted query diff --git a/contracts/core/defaults/WitnetOracleTrustableBase.sol b/contracts/core/defaults/WitnetOracleTrustableBase.sol index 2936218b..27559d71 100644 --- a/contracts/core/defaults/WitnetOracleTrustableBase.sol +++ b/contracts/core/defaults/WitnetOracleTrustableBase.sol @@ -29,9 +29,9 @@ abstract contract WitnetOracleTrustableBase using Witnet for bytes; using Witnet for Witnet.Result; using WitnetCBOR for WitnetCBOR.CBOR; - using WitnetV2 for WitnetV2.RadonSLA; - using WitnetV2 for WitnetV2.Request; - using WitnetV2 for WitnetV2.Response; + using Witnet for Witnet.RadonSLA; + using Witnet for Witnet.Request; + using Witnet for Witnet.Response; bytes4 public immutable override specs = type(IWitnetOracle).interfaceId; WitnetRequestBytecodes immutable public override registry; @@ -57,15 +57,15 @@ abstract contract WitnetOracleTrustableBase _; } - modifier checkSLA(WitnetV2.RadonSLA calldata sla) { + modifier checkSLA(Witnet.RadonSLA calldata sla) { _require( - WitnetV2.isValid(sla), + Witnet.isValid(sla), "invalid SLA" ); _; } /// Asserts the given query is currently in the given status. - modifier inStatus(uint256 _queryId, WitnetV2.QueryStatus _status) { + modifier inStatus(uint256 _queryId, Witnet.QueryStatus _status) { if (WitnetOracleDataLib.seekQueryStatus(_queryId) != _status) { _revert(WitnetOracleDataLib.notInStatusRevertMessage(_status)); } else { @@ -256,9 +256,9 @@ abstract contract WitnetOracleTrustableBase function fetchQueryResponse(uint256 _witnetQueryId) virtual override external - inStatus(_witnetQueryId, WitnetV2.QueryStatus.Finalized) + inStatus(_witnetQueryId, Witnet.QueryStatus.Finalized) onlyRequester(_witnetQueryId) - returns (WitnetV2.Response memory _response) + returns (Witnet.Response memory _response) { _response = WitnetOracleDataLib.seekQuery(_witnetQueryId).response; delete __storage().queries[_witnetQueryId]; @@ -268,7 +268,7 @@ abstract contract WitnetOracleTrustableBase function getQuery(uint256 _witnetQueryId) public view virtual override - returns (WitnetV2.Query memory) + returns (Witnet.Query memory) { return __storage().queries[_witnetQueryId]; } @@ -287,7 +287,7 @@ abstract contract WitnetOracleTrustableBase function getQueryRequest(uint256 _witnetQueryId) external view override - returns (WitnetV2.Request memory) + returns (Witnet.Request memory) { return WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); } @@ -298,7 +298,7 @@ abstract contract WitnetOracleTrustableBase function getQueryResponse(uint256 _witnetQueryId) public view virtual override - returns (WitnetV2.Response memory) + returns (Witnet.Response memory) { return WitnetOracleDataLib.seekQueryResponse(_witnetQueryId); } @@ -311,7 +311,7 @@ abstract contract WitnetOracleTrustableBase /// @param _witnetQueryId The unique query identifier. function getQueryResponseStatus(uint256 _witnetQueryId) virtual override public view - returns (WitnetV2.ResponseStatus) + returns (Witnet.ResponseStatus) { return WitnetOracleDataLib.seekQueryResponseStatus(_witnetQueryId); } @@ -333,7 +333,7 @@ abstract contract WitnetOracleTrustableBase public view returns (Witnet.ResultError memory) { - WitnetV2.ResponseStatus _status = WitnetOracleDataLib.seekQueryResponseStatus(_witnetQueryId); + Witnet.ResponseStatus _status = WitnetOracleDataLib.seekQueryResponseStatus(_witnetQueryId); try WitnetErrorsLib.asResultError(_status, WitnetOracleDataLib.seekQueryResponse(_witnetQueryId).resultCborBytes) returns (Witnet.ResultError memory _resultError) { @@ -357,7 +357,7 @@ abstract contract WitnetOracleTrustableBase function getQueryStatus(uint256 _witnetQueryId) external view override - returns (WitnetV2.QueryStatus) + returns (Witnet.QueryStatus) { return WitnetOracleDataLib.seekQueryStatus(_witnetQueryId); } @@ -365,9 +365,9 @@ abstract contract WitnetOracleTrustableBase function getQueryStatusBatch(uint256[] calldata _witnetQueryIds) external view override - returns (WitnetV2.QueryStatus[] memory _status) + returns (Witnet.QueryStatus[] memory _status) { - _status = new WitnetV2.QueryStatus[](_witnetQueryIds.length); + _status = new Witnet.QueryStatus[](_witnetQueryIds.length); for (uint _ix = 0; _ix < _witnetQueryIds.length; _ix ++) { _status[_ix] = WitnetOracleDataLib.seekQueryStatus(_witnetQueryIds[_ix]); } @@ -394,7 +394,7 @@ abstract contract WitnetOracleTrustableBase /// @return _witnetQueryId Unique query identifier. function postRequest( bytes32 _queryRAD, - WitnetV2.RadonSLA calldata _querySLA + Witnet.RadonSLA calldata _querySLA ) virtual override external payable @@ -428,7 +428,7 @@ abstract contract WitnetOracleTrustableBase /// @return _witnetQueryId Unique query identifier. function postRequestWithCallback( bytes32 _queryRAD, - WitnetV2.RadonSLA calldata _querySLA, + Witnet.RadonSLA calldata _querySLA, uint24 _queryCallbackGasLimit ) virtual override @@ -467,7 +467,7 @@ abstract contract WitnetOracleTrustableBase /// @return _witnetQueryId Unique query identifier. function postRequestWithCallback( bytes calldata _queryUnverifiedBytecode, - WitnetV2.RadonSLA calldata _querySLA, + Witnet.RadonSLA calldata _querySLA, uint24 _queryCallbackGasLimit ) virtual override @@ -496,9 +496,9 @@ abstract contract WitnetOracleTrustableBase function upgradeQueryEvmReward(uint256 _witnetQueryId) external payable virtual override - inStatus(_witnetQueryId, WitnetV2.QueryStatus.Posted) + inStatus(_witnetQueryId, Witnet.QueryStatus.Posted) { - WitnetV2.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); + Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); __request.evmReward += uint72(_getMsgValue()); emit WitnetQueryRewardUpgraded(_witnetQueryId, __request.evmReward); } @@ -521,8 +521,8 @@ abstract contract WitnetOracleTrustableBase returns (uint256 _revenues, uint256 _expenses) { for (uint _ix = 0; _ix < _witnetQueryIds.length; _ix ++) { - if (WitnetOracleDataLib.seekQueryStatus(_witnetQueryIds[_ix]) == WitnetV2.QueryStatus.Posted) { - WitnetV2.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryIds[_ix]); + if (WitnetOracleDataLib.seekQueryStatus(_witnetQueryIds[_ix]) == Witnet.QueryStatus.Posted) { + Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryIds[_ix]); _revenues += __request.evmReward; if (__request.gasCallback > 0) { _expenses += estimateBaseFeeWithCallback(_txGasPrice, __request.gasCallback); @@ -566,7 +566,7 @@ abstract contract WitnetOracleTrustableBase ) external override onlyReporters - inStatus(_witnetQueryId, WitnetV2.QueryStatus.Posted) + inStatus(_witnetQueryId, Witnet.QueryStatus.Posted) returns (uint256) { // results cannot be empty: @@ -603,7 +603,7 @@ abstract contract WitnetOracleTrustableBase external override onlyReporters - inStatus(_witnetQueryId, WitnetV2.QueryStatus.Posted) + inStatus(_witnetQueryId, Witnet.QueryStatus.Posted) returns (uint256) { // validate timestamp @@ -642,11 +642,11 @@ abstract contract WitnetOracleTrustableBase for ( uint _i = 0; _i < _batchResults.length; _i ++) { if ( WitnetOracleDataLib.seekQueryStatus(_batchResults[_i].queryId) - != WitnetV2.QueryStatus.Posted + != Witnet.QueryStatus.Posted ) { emit BatchReportError( _batchResults[_i].queryId, - WitnetOracleDataLib.notInStatusRevertMessage(WitnetV2.QueryStatus.Posted) + WitnetOracleDataLib.notInStatusRevertMessage(Witnet.QueryStatus.Posted) ); } else if ( uint256(_batchResults[_i].queryResultTimestamp) > block.timestamp @@ -738,7 +738,7 @@ abstract contract WitnetOracleTrustableBase returns (uint256 _witnetQueryId) { _witnetQueryId = ++ __storage().nonce; //__newQueryId(_radHash, _packedSLA); - WitnetV2.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); + Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); _require(__request.requester == address(0), "already posted"); { __request.requester = msg.sender; @@ -759,7 +759,7 @@ abstract contract WitnetOracleTrustableBase returns (uint256 _evmReward) { // read requester address and whether a callback was requested: - WitnetV2.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); + Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); // read query EVM reward: _evmReward = __request.evmReward; @@ -940,7 +940,7 @@ abstract contract WitnetOracleTrustableBase ) virtual internal { - WitnetOracleDataLib.seekQuery(_witnetQueryId).response = WitnetV2.Response({ + WitnetOracleDataLib.seekQuery(_witnetQueryId).response = Witnet.Response({ reporter: msg.sender, finality: uint64(block.number), resultTimestamp: _witnetQueryResultTimestamp, diff --git a/contracts/core/defaults/WitnetPriceFeedsDefault.sol b/contracts/core/defaults/WitnetPriceFeedsDefault.sol index db7a18cd..c09ad591 100644 --- a/contracts/core/defaults/WitnetPriceFeedsDefault.sol +++ b/contracts/core/defaults/WitnetPriceFeedsDefault.sol @@ -23,8 +23,8 @@ contract WitnetPriceFeedsDefault { using Witnet for bytes; using Witnet for Witnet.Result; - using WitnetV2 for WitnetV2.Response; - using WitnetV2 for WitnetV2.RadonSLA; + using Witnet for Witnet.Response; + using Witnet for Witnet.RadonSLA; function class() virtual override(WitnetFeeds, WitnetUpgradableBase) public view returns (string memory) { return type(WitnetPriceFeedsDefault).name; @@ -93,7 +93,7 @@ contract WitnetPriceFeedsDefault _owner = abi.decode(_initData, (address)); _transferOwnership(_owner); // settle default Radon SLA upon first initialization - __defaultRadonSLA = WitnetV2.RadonSLA({ + __defaultRadonSLA = Witnet.RadonSLA({ committeeSize: 10, witnessingFeeNanoWit: 2 * 10 ** 8 // 0.2 $WIT }); @@ -214,7 +214,7 @@ contract WitnetPriceFeedsDefault public view returns (Witnet.RadonSLA memory) { - return __defaultRadonSLA.toV1(); + return __defaultRadonSLA; } function estimateUpdateBaseFee(uint256 _evmGasPrice) @@ -250,14 +250,14 @@ contract WitnetPriceFeedsDefault function latestUpdateRequest(bytes4 feedId) override external view - returns (WitnetV2.Request memory) + returns (Witnet.Request memory) { return witnet.getQueryRequest(latestUpdateQueryId(feedId)); } function latestUpdateResponse(bytes4 feedId) override external view - returns (WitnetV2.Response memory) + returns (Witnet.Response memory) { return witnet.getQueryResponse(latestUpdateQueryId(feedId)); } @@ -271,7 +271,7 @@ contract WitnetPriceFeedsDefault function latestUpdateResponseStatus(bytes4 feedId) override public view - returns (WitnetV2.ResponseStatus) + returns (Witnet.ResponseStatus) { return _checkQueryResponseStatus(latestUpdateQueryId(feedId)); } @@ -285,7 +285,7 @@ contract WitnetPriceFeedsDefault __record.radHash != 0, "WitnetPriceFeeds: no RAD hash" ); - return registry().bytecodeOf(__record.radHash); + return _registry().bytecodeOf(__record.radHash); } function lookupWitnetRadHash(bytes4 feedId) @@ -318,7 +318,7 @@ contract WitnetPriceFeedsDefault return __requestUpdate(feedId, __defaultRadonSLA); } - function requestUpdate(bytes4 feedId, WitnetV2.RadonSLA calldata updateSLA) + function requestUpdate(bytes4 feedId, Witnet.RadonSLA calldata updateSLA) public payable virtual override returns (uint256 _usedFunds) @@ -414,7 +414,7 @@ contract WitnetPriceFeedsDefault __baseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - function settleDefaultRadonSLA(WitnetV2.RadonSLA calldata defaultSLA) + function settleDefaultRadonSLA(Witnet.RadonSLA calldata defaultSLA) override public onlyOwner { @@ -562,7 +562,7 @@ contract WitnetPriceFeedsDefault { uint _queryId = _lastValidQueryId(feedId); if (_queryId > 0) { - WitnetV2.Response memory _lastValidResponse = lastValidResponse(feedId); + Witnet.Response memory _lastValidResponse = lastValidResponse(feedId); Witnet.Result memory _latestResult = _lastValidResponse.resultCborBytes.toWitnetResult(); return IWitnetPriceSolver.Price({ value: _latestResult.asUint(), @@ -650,11 +650,11 @@ contract WitnetPriceFeedsDefault return ( int(_latestPrice.value), _latestPrice.timestamp, - _latestPrice.status == WitnetV2.ResponseStatus.Ready + _latestPrice.status == Witnet.ResponseStatus.Ready ? 200 : ( - _latestPrice.status == WitnetV2.ResponseStatus.Awaiting - || _latestPrice.status == WitnetV2.ResponseStatus.Finalizing + _latestPrice.status == Witnet.ResponseStatus.Awaiting + || _latestPrice.status == Witnet.ResponseStatus.Finalizing ) ? 404 : 400 ); } @@ -665,12 +665,12 @@ contract WitnetPriceFeedsDefault function _checkQueryResponseStatus(uint _queryId) internal view - returns (WitnetV2.ResponseStatus) + returns (Witnet.ResponseStatus) { if (_queryId > 0) { return witnet.getQueryResponseStatus(_queryId); } else { - return WitnetV2.ResponseStatus.Ready; + return Witnet.ResponseStatus.Ready; } } @@ -689,7 +689,7 @@ contract WitnetPriceFeedsDefault uint _latestUpdateQueryId = latestUpdateQueryId(feedId); if ( _latestUpdateQueryId > 0 - && witnet.getQueryResponseStatus(_latestUpdateQueryId) == WitnetV2.ResponseStatus.Ready + && witnet.getQueryResponseStatus(_latestUpdateQueryId) == Witnet.ResponseStatus.Ready ) { return _latestUpdateQueryId; } else { @@ -710,7 +710,7 @@ contract WitnetPriceFeedsDefault } } - function __requestUpdate(bytes4[] memory _deps, WitnetV2.RadonSLA memory sla) + function __requestUpdate(bytes4[] memory _deps, Witnet.RadonSLA memory sla) virtual internal returns (uint256 _usedFunds) { @@ -720,7 +720,7 @@ contract WitnetPriceFeedsDefault } } - function __requestUpdate(bytes4 feedId, WitnetV2.RadonSLA memory querySLA) + function __requestUpdate(bytes4 feedId, Witnet.RadonSLA memory querySLA) virtual internal returns (uint256 _usedFunds) { @@ -732,11 +732,11 @@ contract WitnetPriceFeedsDefault "WitnetPriceFeeds: insufficient reward" ); uint _latestId = __feed.latestUpdateQueryId; - WitnetV2.ResponseStatus _latestStatus = _checkQueryResponseStatus(_latestId); - if (_latestStatus == WitnetV2.ResponseStatus.Awaiting) { + Witnet.ResponseStatus _latestStatus = _checkQueryResponseStatus(_latestId); + if (_latestStatus == Witnet.ResponseStatus.Awaiting) { // latest update is still pending, so just increase the reward // accordingly to current tx gasprice: - WitnetV2.Request memory _request = witnet.getQueryRequest(_latestId); + Witnet.Request memory _request = witnet.getQueryRequest(_latestId); int _deltaReward = int(int72(_request.evmReward)) - int(_usedFunds); if (_deltaReward > 0) { _usedFunds = uint(_deltaReward); @@ -753,7 +753,7 @@ contract WitnetPriceFeedsDefault } } else { // Check if latest update ended successfully: - if (_latestStatus == WitnetV2.ResponseStatus.Ready) { + if (_latestStatus == Witnet.ResponseStatus.Ready) { // If so, remove previous last valid query from the WRB: if (__feed.lastValidQueryId > 0) { witnet.fetchQueryResponse(__feed.lastValidQueryId); diff --git a/contracts/core/defaults/WitnetRequestBytecodesDefault.sol b/contracts/core/defaults/WitnetRequestBytecodesDefault.sol index 72b4340e..cb457b76 100644 --- a/contracts/core/defaults/WitnetRequestBytecodesDefault.sol +++ b/contracts/core/defaults/WitnetRequestBytecodesDefault.sol @@ -20,13 +20,13 @@ contract WitnetRequestBytecodesDefault { using Witnet for bytes; using Witnet for string; - using WitnetV2 for WitnetV2.RadonSLA; + using Witnet for Witnet.RadonSLA; using WitnetEncodingLib for Witnet.RadonRetrievalMethods; using WitnetEncodingLib for Witnet.RadonRetrieval; using WitnetEncodingLib for Witnet.RadonRetrieval[]; using WitnetEncodingLib for Witnet.RadonReducer; - using WitnetEncodingLib for Witnet.RadonSLA; + using WitnetEncodingLib for Witnet.RadonSLAv1; using WitnetEncodingLib for Witnet.RadonDataTypes; function class() @@ -159,7 +159,7 @@ contract WitnetRequestBytecodesDefault return __database().radsBytecode[_radHash]; } - function bytecodeOf(bytes32 _radHash, WitnetV2.RadonSLA calldata _sla) + function bytecodeOf(bytes32 _radHash, Witnet.RadonSLA calldata _sla) override external view returns (bytes memory) { @@ -171,7 +171,7 @@ contract WitnetRequestBytecodesDefault ); } - function bytecodeOf(bytes calldata _radBytecode, WitnetV2.RadonSLA calldata _sla) + function bytecodeOf(bytes calldata _radBytecode, Witnet.RadonSLA calldata _sla) override external pure returns (bytes memory) { diff --git a/contracts/data/WitnetOracleDataLib.sol b/contracts/data/WitnetOracleDataLib.sol index a76370a1..81fa04ae 100644 --- a/contracts/data/WitnetOracleDataLib.sol +++ b/contracts/data/WitnetOracleDataLib.sol @@ -3,13 +3,13 @@ pragma solidity >=0.7.0 <0.9.0; import "../WitnetRequestBytecodes.sol"; -import "../libs/WitnetV2.sol"; +import "../libs/Witnet.sol"; /// @title Witnet Request Board base data model library /// @author The Witnet Foundation. library WitnetOracleDataLib { - using WitnetV2 for WitnetV2.Request; + using Witnet for Witnet.Request; bytes32 internal constant _WITNET_ORACLE_DATA_SLOTHASH = /* keccak256("io.witnet.boards.data") */ @@ -17,7 +17,7 @@ library WitnetOracleDataLib { struct Storage { uint256 nonce; - mapping (uint => WitnetV2.Query) queries; + mapping (uint => Witnet.Query) queries; mapping (address => bool) reporters; } @@ -37,55 +37,55 @@ library WitnetOracleDataLib { } /// Gets query storage by query id. - function seekQuery(uint256 _queryId) internal view returns (WitnetV2.Query storage) { + function seekQuery(uint256 _queryId) internal view returns (Witnet.Query storage) { return data().queries[_queryId]; } /// Gets the Witnet.Request part of a given query. - function seekQueryRequest(uint256 _queryId) internal view returns (WitnetV2.Request storage) { + function seekQueryRequest(uint256 _queryId) internal view returns (Witnet.Request storage) { return data().queries[_queryId].request; } /// Gets the Witnet.Result part of a given query. - function seekQueryResponse(uint256 _queryId) internal view returns (WitnetV2.Response storage) { + function seekQueryResponse(uint256 _queryId) internal view returns (Witnet.Response storage) { return data().queries[_queryId].response; } - function seekQueryStatus(uint256 queryId) internal view returns (WitnetV2.QueryStatus) { - WitnetV2.Query storage __query = data().queries[queryId]; + function seekQueryStatus(uint256 queryId) internal view returns (Witnet.QueryStatus) { + Witnet.Query storage __query = data().queries[queryId]; if (__query.response.resultTimestamp != 0) { if (block.number >= __query.response.finality) { - return WitnetV2.QueryStatus.Finalized; + return Witnet.QueryStatus.Finalized; } else { - return WitnetV2.QueryStatus.Reported; + return Witnet.QueryStatus.Reported; } } else if (__query.request.requester != address(0)) { - return WitnetV2.QueryStatus.Posted; + return Witnet.QueryStatus.Posted; } else { - return WitnetV2.QueryStatus.Unknown; + return Witnet.QueryStatus.Unknown; } } - function seekQueryResponseStatus(uint256 queryId) internal view returns (WitnetV2.ResponseStatus) { - WitnetV2.QueryStatus _queryStatus = seekQueryStatus(queryId); - if (_queryStatus == WitnetV2.QueryStatus.Finalized) { + function seekQueryResponseStatus(uint256 queryId) internal view returns (Witnet.ResponseStatus) { + Witnet.QueryStatus _queryStatus = seekQueryStatus(queryId); + if (_queryStatus == Witnet.QueryStatus.Finalized) { bytes storage __cborValues = data().queries[queryId].response.resultCborBytes; if (__cborValues.length > 0) { // determine whether stored result is an error by peeking the first byte return (__cborValues[0] == bytes1(0xd8) - ? WitnetV2.ResponseStatus.Error - : WitnetV2.ResponseStatus.Ready + ? Witnet.ResponseStatus.Error + : Witnet.ResponseStatus.Ready ); } else { // the result is final but delivered to the requesting address - return WitnetV2.ResponseStatus.Delivered; + return Witnet.ResponseStatus.Delivered; } - } else if (_queryStatus == WitnetV2.QueryStatus.Posted) { - return WitnetV2.ResponseStatus.Awaiting; - } else if (_queryStatus == WitnetV2.QueryStatus.Reported) { - return WitnetV2.ResponseStatus.Finalizing; + } else if (_queryStatus == Witnet.QueryStatus.Posted) { + return Witnet.ResponseStatus.Awaiting; + } else if (_queryStatus == Witnet.QueryStatus.Reported) { + return Witnet.ResponseStatus.Finalizing; } else { - return WitnetV2.ResponseStatus.Void; + return Witnet.ResponseStatus.Void; } } @@ -98,8 +98,8 @@ library WitnetOracleDataLib { { bytecodes = new bytes[](queryIds.length); for (uint _ix = 0; _ix < queryIds.length; _ix ++) { - if (seekQueryStatus(queryIds[_ix]) != WitnetV2.QueryStatus.Unknown) { - WitnetV2.Request storage __request = data().queries[queryIds[_ix]].request; + if (seekQueryStatus(queryIds[_ix]) != Witnet.QueryStatus.Unknown) { + Witnet.Request storage __request = data().queries[queryIds[_ix]].request; if (__request.witnetRAD != bytes32(0)) { bytecodes[_ix] = registry.bytecodeOf( __request.witnetRAD, @@ -115,12 +115,12 @@ library WitnetOracleDataLib { } } - function notInStatusRevertMessage(WitnetV2.QueryStatus self) public pure returns (string memory) { - if (self == WitnetV2.QueryStatus.Posted) { + function notInStatusRevertMessage(Witnet.QueryStatus self) public pure returns (string memory) { + if (self == Witnet.QueryStatus.Posted) { return "query not in Posted status"; - } else if (self == WitnetV2.QueryStatus.Reported) { + } else if (self == Witnet.QueryStatus.Reported) { return "query not in Reported status"; - } else if (self == WitnetV2.QueryStatus.Finalized) { + } else if (self == Witnet.QueryStatus.Finalized) { return "query not in Finalized status"; } else { return "bad mood"; diff --git a/contracts/data/WitnetRequestBytecodesData.sol b/contracts/data/WitnetRequestBytecodesData.sol index 0fa8d36f..c9fde48a 100644 --- a/contracts/data/WitnetRequestBytecodesData.sol +++ b/contracts/data/WitnetRequestBytecodesData.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.0 <0.9.0; -import "../libs/WitnetV2.sol"; +import "../libs/Witnet.sol"; /// @title Witnet Request Board base data model. /// @author The Witnet Foundation. diff --git a/contracts/interfaces/IWitnetFeeds.sol b/contracts/interfaces/IWitnetFeeds.sol index 89e84060..3a815511 100644 --- a/contracts/interfaces/IWitnetFeeds.sol +++ b/contracts/interfaces/IWitnetFeeds.sol @@ -36,12 +36,12 @@ interface IWitnetFeeds { function estimateUpdateBaseFee(uint256 evmGasPrice) external view returns (uint); function lastValidQueryId(bytes4 feedId) external view returns (uint256); - function lastValidResponse(bytes4 feedId) external view returns (WitnetV2.Response memory); + function lastValidResponse(bytes4 feedId) external view returns (Witnet.Response memory); function latestUpdateQueryId(bytes4 feedId) external view returns (uint256); - function latestUpdateRequest(bytes4 feedId) external view returns (WitnetV2.Request memory); - function latestUpdateResponse(bytes4 feedId) external view returns (WitnetV2.Response memory); - function latestUpdateResponseStatus(bytes4 feedId) external view returns (WitnetV2.ResponseStatus); + function latestUpdateRequest(bytes4 feedId) external view returns (Witnet.Request memory); + function latestUpdateResponse(bytes4 feedId) external view returns (Witnet.Response memory); + function latestUpdateResponseStatus(bytes4 feedId) external view returns (Witnet.ResponseStatus); function latestUpdateResultError(bytes4 feedId) external view returns (Witnet.ResultError memory); function lookupWitnetBytecode(bytes4 feedId) external view returns (bytes memory); @@ -49,5 +49,5 @@ interface IWitnetFeeds { function lookupWitnetRetrievals(bytes4 feedId) external view returns (Witnet.RadonRetrieval[] memory); function requestUpdate(bytes4 feedId) external payable returns (uint256 usedFunds); - function requestUpdate(bytes4 feedId, WitnetV2.RadonSLA calldata updateSLA) external payable returns (uint256 usedFunds); + function requestUpdate(bytes4 feedId, Witnet.RadonSLA calldata updateSLA) external payable returns (uint256 usedFunds); } \ No newline at end of file diff --git a/contracts/interfaces/IWitnetFeedsAdmin.sol b/contracts/interfaces/IWitnetFeedsAdmin.sol index bc4c8107..0a6c9009 100644 --- a/contracts/interfaces/IWitnetFeedsAdmin.sol +++ b/contracts/interfaces/IWitnetFeedsAdmin.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.0 <0.9.0; -import "../libs/WitnetV2.sol"; +import "../libs/Witnet.sol"; import "../WitnetRequest.sol"; interface IWitnetFeedsAdmin { @@ -13,7 +13,7 @@ interface IWitnetFeedsAdmin { function owner() external view returns (address); function pendingOwner() external returns (address); function settleBaseFeeOverheadPercentage(uint16) external; - function settleDefaultRadonSLA(WitnetV2.RadonSLA calldata) external; + function settleDefaultRadonSLA(Witnet.RadonSLA calldata) external; function settleFeedRequest(string calldata caption, bytes32 radHash) external; function settleFeedRequest(string calldata caption, WitnetRequest request) external; function settleFeedRequest(string calldata caption, WitnetRequestTemplate template, string[][] calldata) external; diff --git a/contracts/interfaces/IWitnetOracle.sol b/contracts/interfaces/IWitnetOracle.sol index b9825eb5..5dde2b5c 100644 --- a/contracts/interfaces/IWitnetOracle.sol +++ b/contracts/interfaces/IWitnetOracle.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; -import "../libs/WitnetV2.sol"; +import "../libs/Witnet.sol"; interface IWitnetOracle { @@ -27,29 +27,31 @@ interface IWitnetOracle { /// @dev Fails if the query was not in 'Reported' status, or called from an address different to /// @dev the one that actually posted the given request. /// @param queryId The unique query identifier. - function fetchQueryResponse(uint256 queryId) external returns (WitnetV2.Response memory); + function fetchQueryResponse(uint256 queryId) external returns (Witnet.Response memory); /// @notice Gets the whole Query data contents, if any, no matter its current status. - function getQuery(uint256 queryId) external view returns (WitnetV2.Query memory); + function getQuery(uint256 queryId) external view returns (Witnet.Query memory); /// @notice Gets the current EVM reward the report can claim, if not done yet. function getQueryEvmReward(uint256 queryId) external view returns (uint256); /// @notice Retrieves the RAD hash and SLA parameters of the given query. /// @param queryId The unique query identifier. - function getQueryRequest(uint256 queryId) external view returns (WitnetV2.Request memory); + function getQueryRequest(uint256 queryId) external view returns (Witnet.Request memory); /// @notice Retrieves the whole `Witnet.Response` record referred to a previously posted Witnet Data Request. /// @param queryId The unique query identifier. - function getQueryResponse(uint256 queryId) external view returns (WitnetV2.Response memory); + function getQueryResponse(uint256 queryId) external view returns (Witnet.Response memory); /// @notice Returns query's result current status from a requester's point of view: /// @notice - 0 => Void: the query is either non-existent or deleted; /// @notice - 1 => Awaiting: the query has not yet been reported; /// @notice - 2 => Ready: the query response was finalized, and contains a result with no erros. /// @notice - 3 => Error: the query response was finalized, and contains a result with errors. + /// @notice - 4 => Finalizing: some result to the query has been reported, but cannot yet be considered finalized. + /// @notice - 5 => Delivered: at least one response, either successful or with errors, was delivered to the requesting contract. /// @param queryId The unique query identifier. - function getQueryResponseStatus(uint256 queryId) external view returns (WitnetV2.ResponseStatus); + function getQueryResponseStatus(uint256 queryId) external view returns (Witnet.ResponseStatus); /// @notice Retrieves the CBOR-encoded buffer containing the Witnet-provided result to the given query. /// @param queryId The unique query identifier. @@ -60,10 +62,10 @@ interface IWitnetOracle { function getQueryResultError(uint256 queryId) external view returns (Witnet.ResultError memory); /// @notice Gets current status of given query. - function getQueryStatus(uint256 queryId) external view returns (WitnetV2.QueryStatus); + function getQueryStatus(uint256 queryId) external view returns (Witnet.QueryStatus); /// @notice Get current status of all given query ids. - function getQueryStatusBatch(uint256[] calldata queryIds) external view returns (WitnetV2.QueryStatus[] memory); + function getQueryStatusBatch(uint256[] calldata queryIds) external view returns (Witnet.QueryStatus[] memory); /// @notice Returns next query id to be generated by the Witnet Request Board. function getNextQueryId() external view returns (uint256); @@ -80,7 +82,7 @@ interface IWitnetOracle { /// @return queryId Unique query identifier. function postRequest( bytes32 queryRAD, - WitnetV2.RadonSLA calldata querySLA + Witnet.RadonSLA calldata querySLA ) external payable returns (uint256 queryId); /// @notice Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by @@ -99,7 +101,7 @@ interface IWitnetOracle { /// @return queryId Unique query identifier. function postRequestWithCallback( bytes32 queryRAD, - WitnetV2.RadonSLA calldata querySLA, + Witnet.RadonSLA calldata querySLA, uint24 queryCallbackGasLimit ) external payable returns (uint256 queryId); @@ -119,9 +121,9 @@ interface IWitnetOracle { /// @return queryId Unique query identifier. function postRequestWithCallback( bytes calldata queryUnverifiedBytecode, - WitnetV2.RadonSLA calldata querySLA, + Witnet.RadonSLA calldata querySLA, uint24 queryCallbackGasLimit - ) external payable returns (uint256 queryId); + ) external payable returns (uint256 queryId); /// @notice Increments the reward of a previously posted request by adding the transaction value to it. /// @param queryId The unique query identifier. diff --git a/contracts/interfaces/IWitnetOracleEvents.sol b/contracts/interfaces/IWitnetOracleEvents.sol index 81da5ac9..408b40f5 100644 --- a/contracts/interfaces/IWitnetOracleEvents.sol +++ b/contracts/interfaces/IWitnetOracleEvents.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; -import "../libs/WitnetV2.sol"; +import "../libs/Witnet.sol"; interface IWitnetOracleEvents { diff --git a/contracts/interfaces/IWitnetOracleReporter.sol b/contracts/interfaces/IWitnetOracleReporter.sol index 4a248c2d..79b9e297 100644 --- a/contracts/interfaces/IWitnetOracleReporter.sol +++ b/contracts/interfaces/IWitnetOracleReporter.sol @@ -2,7 +2,7 @@ pragma solidity >=0.7.0 <0.9.0; -import "../libs/WitnetV2.sol"; +import "../libs/Witnet.sol"; /// @title The Witnet Request Board Reporter interface. /// @author The Witnet Foundation. diff --git a/contracts/interfaces/IWitnetPriceSolver.sol b/contracts/interfaces/IWitnetPriceSolver.sol index b495cd73..9169edd8 100644 --- a/contracts/interfaces/IWitnetPriceSolver.sol +++ b/contracts/interfaces/IWitnetPriceSolver.sol @@ -2,14 +2,14 @@ pragma solidity >=0.8.0 <0.9.0; -import "../libs/WitnetV2.sol"; +import "../libs/Witnet.sol"; interface IWitnetPriceSolver { struct Price { uint value; uint timestamp; bytes32 tallyHash; - WitnetV2.ResponseStatus status; + Witnet.ResponseStatus status; } function class() external pure returns (string memory); function delegator() external view returns (address); diff --git a/contracts/interfaces/IWitnetRandomnessAdmin.sol b/contracts/interfaces/IWitnetRandomnessAdmin.sol index 51999352..bef12dcb 100644 --- a/contracts/interfaces/IWitnetRandomnessAdmin.sol +++ b/contracts/interfaces/IWitnetRandomnessAdmin.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.0 <0.9.0; -import "../libs/WitnetV2.sol"; +import "../libs/Witnet.sol"; interface IWitnetRandomnessAdmin { function acceptOwnership() external; diff --git a/contracts/interfaces/IWitnetRandomnessEvents.sol b/contracts/interfaces/IWitnetRandomnessEvents.sol index 456fcedb..e7360d22 100644 --- a/contracts/interfaces/IWitnetRandomnessEvents.sol +++ b/contracts/interfaces/IWitnetRandomnessEvents.sol @@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../libs/WitnetV2.sol"; +import "../libs/Witnet.sol"; /// @title The Witnet Randomness generator interface. /// @author Witnet Foundation. diff --git a/contracts/libs/Witnet.sol b/contracts/libs/Witnet.sol index fcdd52d8..ac1c361b 100644 --- a/contracts/libs/Witnet.sol +++ b/contracts/libs/Witnet.sol @@ -15,7 +15,6 @@ library Witnet { struct Query { Request request; Response response; - address from; // Address from which the request was posted. } /// Possible status of a Witnet query. @@ -23,24 +22,36 @@ library Witnet { Unknown, Posted, Reported, - Deleted + Finalized } /// Data kept in EVM-storage for every Request posted to the Witnet Request Board. struct Request { - address addr; // Address of the (deprecated) IWitnetRequest contract containing Witnet data request raw bytecode. - bytes32 slaHash; // Radon SLA hash of the Witnet data request. - bytes32 radHash; // Radon radHash of the Witnet data request. - uint256 gasprice; // Minimum gas price the DR resolver should pay on the solving tx. - uint256 reward; // Escrowed reward to be paid to the DR resolver. + address requester; // EVM address from which the request was posted. + uint24 gasCallback; // Max callback gas limit upon response, if a callback is required. + uint72 evmReward; // EVM amount in wei eventually to be paid to the legit result reporter. + bytes witnetBytecode; // Optional: Witnet Data Request bytecode to be solved by the Witnet blockchain. + bytes32 witnetRAD; // Optional: Previously verified hash of the Witnet Data Request to be solved. + RadonSLA witnetSLA; // Minimum Service-Level parameters to be committed by the Witnet blockchain. } - /// Data kept in EVM-storage containing the Witnet-provided response metadata and CBOR-encoded result. + /// Response metadata and result as resolved by the Witnet blockchain. struct Response { - address reporter; // Address from which the result was reported. - uint256 timestamp; // Timestamp of the Witnet-provided result. - bytes32 drTxHash; // Hash of the Witnet transaction that solved the queried Data Request. - bytes cborBytes; // Witnet-provided result CBOR-bytes to the queried Data Request. + address reporter; // EVM address from which the Data Request result was reported. + uint64 finality; // EVM block number at which the reported data will be considered to be finalized. + uint32 resultTimestamp; // Unix timestamp (seconds) at which the data request was resolved in the Witnet blockchain. + bytes32 resultTallyHash; // Unique hash of the commit/reveal act in the Witnet blockchain that resolved the data request. + bytes resultCborBytes; // CBOR-encode result to the request, as resolved in the Witnet blockchain. + } + + /// Response status from a requester's point of view. + enum ResponseStatus { + Void, + Awaiting, + Ready, + Error, + Finalizing, + Delivered } /// Data struct containing the Witnet-provided result to a Data Request. @@ -365,8 +376,20 @@ library Witnet { /* 4 */ HttpHead } - /// Structure containing the SLA security parameters of a Witnet-compliant Data Request. struct RadonSLA { + /// @notice Number of nodes in the Witnet blockchain that will take part in solving the data request. + uint8 committeeSize; + + /// @notice Fee in $nanoWIT paid to every node in the Witnet blockchain involved in solving the data request. + /// @dev Witnet nodes participating as witnesses will have to stake as collateral 100x this amount. + uint64 witnessingFeeNanoWit; + + /// @notice Maximum size accepted for the CBOR-encoded buffer containing successfull Tally Result values. + //uint16 maxTallyResultSize; + } + + /// Structure containing the SLA security parameters of a Witnet-compliant Data Request. + struct RadonSLAv1 { uint8 numWitnesses; uint8 minConsensusPercentage; uint64 witnessReward; @@ -699,6 +722,55 @@ library Witnet { return result.value.readUintArray(); } + + /// =============================================================================================================== + /// --- 'Witnet.RadonSLA' helper methods ------------------------------------------------------------------------ + + function equalOrGreaterThan(RadonSLA memory a, RadonSLA memory b) + internal pure returns (bool) + { + return (a.committeeSize >= b.committeeSize); + } + + function isValid(RadonSLA calldata sla) internal pure returns (bool) { + return ( + sla.witnessingFeeNanoWit > 0 + && sla.committeeSize > 0 && sla.committeeSize <= 127 + ); + } + + function toV1(RadonSLA memory self) internal pure returns (Witnet.RadonSLAv1 memory) { + return Witnet.RadonSLAv1({ + numWitnesses: self.committeeSize, + minConsensusPercentage: 51, + witnessReward: self.witnessingFeeNanoWit, + witnessCollateral: self.witnessingFeeNanoWit * 100, + minerCommitRevealFee: self.witnessingFeeNanoWit / self.committeeSize + }); + } + + function nanoWitTotalFee(RadonSLA storage self) internal view returns (uint64) { + return self.witnessingFeeNanoWit * (self.committeeSize + 3); + } + + + /// =============================================================================================================== + /// --- P-RNG generators ------------------------------------------------------------------------------------------ + + /// Generates a pseudo-random uint32 number uniformly distributed within the range `[0 .. range)`, based on + /// the given `nonce` and `seed` values. + function randomUniformUint32(uint32 range, uint256 nonce, bytes32 seed) + internal pure + returns (uint32) + { + uint256 _number = uint256( + keccak256( + abi.encode(seed, nonce) + ) + ) & uint256(2 ** 224 - 1); + return uint32((_number * range) >> 224); + } + /// =============================================================================================================== /// --- Witnet library private methods ---------------------------------------------------------------------------- @@ -728,4 +800,4 @@ library Witnet { } } } -} \ No newline at end of file +} diff --git a/contracts/libs/WitnetEncodingLib.sol b/contracts/libs/WitnetEncodingLib.sol index 19c16b82..0d5e4b55 100644 --- a/contracts/libs/WitnetEncodingLib.sol +++ b/contracts/libs/WitnetEncodingLib.sol @@ -273,7 +273,7 @@ library WitnetEncodingLib { return encode(uint64(opcode), bytes1(0x10)); } - function encode(Witnet.RadonSLA memory sla) + function encode(Witnet.RadonSLAv1 memory sla) public pure returns (bytes memory) { @@ -433,7 +433,7 @@ library WitnetEncodingLib { // } } - function validate(Witnet.RadonSLA memory sla) + function validate(Witnet.RadonSLAv1 memory sla) public pure { if (sla.witnessReward == 0) { diff --git a/contracts/libs/WitnetErrorsLib.sol b/contracts/libs/WitnetErrorsLib.sol index 9748b775..f8cf48bd 100644 --- a/contracts/libs/WitnetErrorsLib.sol +++ b/contracts/libs/WitnetErrorsLib.sol @@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetV2.sol"; +import "./Witnet.sol"; /// @title A library for interpreting Witnet resolution errors /// @author The Witnet Foundation. @@ -31,21 +31,21 @@ library WitnetErrorsLib { ); } - function asResultError(WitnetV2.ResponseStatus _status, bytes memory _cborBytes) + function asResultError(Witnet.ResponseStatus _status, bytes memory _cborBytes) public pure returns (Witnet.ResultError memory) { if ( - _status == WitnetV2.ResponseStatus.Error - || _status == WitnetV2.ResponseStatus.Ready + _status == Witnet.ResponseStatus.Error + || _status == Witnet.ResponseStatus.Ready ) { return resultErrorFromCborBytes(_cborBytes); - } else if (_status == WitnetV2.ResponseStatus.Finalizing) { + } else if (_status == Witnet.ResponseStatus.Finalizing) { return Witnet.ResultError({ code: Witnet.ResultErrorCodes.Unknown, reason: "WitnetErrorsLib: not yet finalized" }); - } if (_status == WitnetV2.ResponseStatus.Awaiting) { + } if (_status == Witnet.ResponseStatus.Awaiting) { return Witnet.ResultError({ code: Witnet.ResultErrorCodes.Unknown, reason: "WitnetErrorsLib: not yet reported" diff --git a/contracts/libs/WitnetV2.sol b/contracts/libs/WitnetV2.sol deleted file mode 100644 index f895eaa6..00000000 --- a/contracts/libs/WitnetV2.sol +++ /dev/null @@ -1,109 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.8.0 <0.9.0; - -import "./Witnet.sol"; - -library WitnetV2 { - - /// Struct containing both request and response data related to every query posted to the Witnet Request Board - struct Query { - Request request; - Response response; - } - - /// Possible status of a Witnet query. - enum QueryStatus { - Unknown, - Posted, - Reported, - Finalized - } - - /// Data kept in EVM-storage for every Request posted to the Witnet Request Board. - struct Request { - address requester; // EVM address from which the request was posted. - uint24 gasCallback; // Max callback gas limit upon response, if a callback is required. - uint72 evmReward; // EVM amount in wei eventually to be paid to the legit result reporter. - bytes witnetBytecode; // Optional: Witnet Data Request bytecode to be solved by the Witnet blockchain. - bytes32 witnetRAD; // Optional: Previously verified hash of the Witnet Data Request to be solved. - WitnetV2.RadonSLA witnetSLA; // Minimum Service-Level parameters to be committed by the Witnet blockchain. - } - - /// Response metadata and result as resolved by the Witnet blockchain. - struct Response { - address reporter; // EVM address from which the Data Request result was reported. - uint64 finality; // EVM block number at which the reported data will be considered to be finalized. - uint32 resultTimestamp; // Unix timestamp (seconds) at which the data request was resolved in the Witnet blockchain. - bytes32 resultTallyHash; // Unique hash of the commit/reveal act in the Witnet blockchain that resolved the data request. - bytes resultCborBytes; // CBOR-encode result to the request, as resolved in the Witnet blockchain. - } - - /// Response status from a requester's point of view. - enum ResponseStatus { - Void, - Awaiting, - Ready, - Error, - Finalizing, - Delivered - } - - struct RadonSLA { - /// @notice Number of nodes in the Witnet blockchain that will take part in solving the data request. - uint8 committeeSize; - - /// @notice Fee in $nanoWIT paid to every node in the Witnet blockchain involved in solving the data request. - /// @dev Witnet nodes participating as witnesses will have to stake as collateral 100x this amount. - uint64 witnessingFeeNanoWit; - } - - - /// =============================================================================================================== - /// --- 'WitnetV2.RadonSLA' helper methods ------------------------------------------------------------------------ - - function equalOrGreaterThan(RadonSLA memory a, RadonSLA memory b) - internal pure returns (bool) - { - return (a.committeeSize >= b.committeeSize); - } - - function isValid(RadonSLA calldata sla) internal pure returns (bool) { - return ( - sla.witnessingFeeNanoWit > 0 - && sla.committeeSize > 0 && sla.committeeSize <= 127 - ); - } - - function toV1(RadonSLA memory self) internal pure returns (Witnet.RadonSLA memory) { - return Witnet.RadonSLA({ - numWitnesses: self.committeeSize, - minConsensusPercentage: 51, - witnessReward: self.witnessingFeeNanoWit, - witnessCollateral: self.witnessingFeeNanoWit * 100, - minerCommitRevealFee: self.witnessingFeeNanoWit / self.committeeSize - }); - } - - function nanoWitTotalFee(RadonSLA storage self) internal view returns (uint64) { - return self.witnessingFeeNanoWit * (self.committeeSize + 3); - } - - - /// =============================================================================================================== - /// --- P-RNG generators ------------------------------------------------------------------------------------------ - - /// Generates a pseudo-random uint32 number uniformly distributed within the range `[0 .. range)`, based on - /// the given `nonce` and `seed` values. - function randomUniformUint32(uint32 range, uint256 nonce, bytes32 seed) - internal pure - returns (uint32) - { - uint256 _number = uint256( - keccak256( - abi.encode(seed, nonce) - ) - ) & uint256(2 ** 224 - 1); - return uint32((_number * range) >> 224); - } -} diff --git a/test/TestWitnetEncodingLib.sol b/test/TestWitnetEncodingLib.sol index 3e016a49..c1bc9fed 100644 --- a/test/TestWitnetEncodingLib.sol +++ b/test/TestWitnetEncodingLib.sol @@ -53,7 +53,7 @@ contract TestWitnetEncodingLib { function testEncodeRadonSLA() external { bytes memory bytecode = WitnetEncodingLib.encode( - Witnet.RadonSLA({ + Witnet.RadonSLAv1({ numWitnesses: 10, minConsensusPercentage: 51, minerCommitRevealFee: 1000000, @@ -65,7 +65,7 @@ contract TestWitnetEncodingLib { Assert.equal( keccak256(bytecode), keccak256(hex"10c0843d180a20c0843d283330c096b102"), - "bad encode(Witnet.RadonSLA)" + "bad encode(Witnet.RadonSLAv1)" ); } diff --git a/test/TestWitnetV2.sol b/test/TestWitnetV2.sol index 05176be7..98cbd40f 100644 --- a/test/TestWitnetV2.sol +++ b/test/TestWitnetV2.sol @@ -4,14 +4,14 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "truffle/Assert.sol"; -import "../contracts/libs/WitnetV2.sol"; +import "../contracts/libs/Witnet.sol"; contract TestWitnetV2 { - using WitnetV2 for *; + using Witnet for *; - WitnetV2.Request internal __request; - WitnetV2.Response internal __response; + Witnet.Request internal __request; + Witnet.Response internal __response; uint256 internal __finalityBlock; @@ -22,43 +22,43 @@ contract TestWitnetV2 { } function testWitnetRequestPackingWithBytecode() external { - __request = WitnetV2.Request({ + __request = Witnet.Request({ requester: msg.sender, gasCallback: 500000, evmReward: 10 ** 18, witnetBytecode: hex"0aab0412520801123268747470733a2f2f6170692e62696e616e63652e55532f6170692f76332f7469636b65723f73796d626f6c3d4254435553441a1a841877821864696c61737450726963658218571a000f4240185b124d0801122c68747470733a2f2f6170692e62697466696e65782e636f6d2f76312f7075627469636b65722f6274637573641a1b8418778218646a6c6173745f70726963658218571a000f4240185b12480801122d68747470733a2f2f7777772e6269747374616d702e6e65742f6170692f76322f7469636b65722f6274637573641a15841877821864646c6173748218571a000f4240185b12550801123168747470733a2f2f6170692e626974747265782e636f6d2f76332f6d61726b6574732f4254432d5553442f7469636b65721a1e8418778218646d6c6173745472616465526174658218571a000f4240185b12620801123768747470733a2f2f6170692e636f696e626173652e636f6d2f76322f65786368616e67652d72617465733f63757272656e63793d4254431a258618778218666464617461821866657261746573821864635553448218571a000f4240185b12630801123268747470733a2f2f6170692e6b72616b656e2e636f6d2f302f7075626c69632f5469636b65723f706169723d4254435553441a2b87187782186666726573756c7482186668585842545a55534482186161618216008218571a000f4240185b1a0d0a0908051205fa3fc000001003220d0a0908051205fa4020000010031080a3c347180a2080ade20428333080acc7f037", witnetRAD: bytes32(0), - witnetSLA: WitnetV2.RadonSLA({ + witnetSLA: Witnet.RadonSLA({ committeeSize: 7, witnessingFeeNanoWit: 10 ** 9 }) }); } - function testWitnetRequestUnpackingWithBytecode() external returns (WitnetV2.Request memory) { + function testWitnetRequestUnpackingWithBytecode() external returns (Witnet.Request memory) { return __request; } function testWitnetRequestPackingWithRadHash() external { - __request = WitnetV2.Request({ + __request = Witnet.Request({ requester: msg.sender, gasCallback: 500000, evmReward: 10 ** 18, witnetBytecode: hex"", witnetRAD: bytes32(bytes2(0x1234)), - witnetSLA: WitnetV2.RadonSLA({ + witnetSLA: Witnet.RadonSLA({ committeeSize: 7, witnessingFeeNanoWit: 10 ** 9 }) }); } - function testWitnetRequestUnpackingWithRadHash() external returns (WitnetV2.Request memory) { + function testWitnetRequestUnpackingWithRadHash() external returns (Witnet.Request memory) { return __request; } function testWitnetResponsePacking() external { - __response = WitnetV2.Response({ + __response = Witnet.Response({ reporter: msg.sender, finality: uint64(block.number), resultTimestamp: uint32(block.timestamp), @@ -67,7 +67,7 @@ contract TestWitnetV2 { }); } - function testWitnetResponseUnpacking() external returns (WitnetV2.Response memory) { + function testWitnetResponseUnpacking() external returns (Witnet.Response memory) { return __response; } diff --git a/test/witnet_bytecodes.test.js b/test/witnet_bytecodes.test.js index b1f21438..60653abe 100644 --- a/test/witnet_bytecodes.test.js +++ b/test/witnet_bytecodes.test.js @@ -5,7 +5,7 @@ const { expectRevertCustomError } = require("custom-error-test-helper") const WitnetRequestBytecodes = artifacts.require("WitnetRequestBytecodesDefault") const WitnetEncodingLib = artifacts.require("WitnetEncodingLib") -const WitnetV2 = artifacts.require("WitnetV2") +const Witnet = artifacts.require("Witnet") contract("WitnetRequestBytecodes", (accounts) => { const creatorAddress = accounts[0] @@ -106,7 +106,7 @@ contract("WitnetRequestBytecodes", (accounts) => { let btcUsdPriceFeedHash context("verifyRadonRetrieval(..)", async () => { - context("WitnetV2.RadonDataRequestMethods.RNG", async () => { + context("Witnet.RadonRetrievalMethods.RNG", async () => { it("emits appropiate single event when verifying randomness data source for the first time", async () => { const tx = await bytecodes.verifyRadonRetrieval( 2, // requestMethod @@ -152,7 +152,7 @@ contract("WitnetRequestBytecodes", (accounts) => { }) // ... reverts }) - context("WitnetV2.RadonDataRequestMethods.HttpGet", async () => { + context("Witnet.RadonRetrievalMethods.HttpGet", async () => { it( "emits new data provider and source events when verifying a new http-get source for the first time", async () => { const tx = await bytecodes.verifyRadonRetrieval( @@ -203,7 +203,7 @@ contract("WitnetRequestBytecodes", (accounts) => { ) }) }) - context("WitnetV2.RadonDataRequestMethods.HttpPost", async () => { + context("Witnet.RadonRetrievalMethods.HttpPost", async () => { it( "emits new data provider and source events when verifying a new http-post source for the first time", async () => { const tx = await bytecodes.verifyRadonRetrieval( @@ -282,7 +282,7 @@ contract("WitnetRequestBytecodes", (accounts) => { }) it("reverts custom error if verifying radon reducer with unsupported opcode", async () => { await expectRevertCustomError( - WitnetV2, + Witnet, bytecodes.verifyRadonReducer([ 0, // Minimum [], // filters @@ -293,7 +293,7 @@ contract("WitnetRequestBytecodes", (accounts) => { }) it("reverts custom error if verifying radon reducer with at least one unsupported filter", async () => { await expectRevertCustomError( - WitnetV2, + Witnet, bytecodes.verifyRadonReducer([ 5, // AverageMedian [ @@ -307,7 +307,7 @@ contract("WitnetRequestBytecodes", (accounts) => { }) it("reverts custom error if verifying radon reducer with stdev filter but no args", async () => { await expectRevertCustomError( - WitnetV2, + Witnet, bytecodes.verifyRadonReducer([ 2, // Mode [ @@ -466,7 +466,7 @@ contract("WitnetRequestBytecodes", (accounts) => { }) it("reverts if trying to verify radon request w/ incompatible sources", async () => { await expectRevertCustomError( - WitnetV2, + Witnet, bytecodes.verifyRadonRequest( [ // sources binanceTickerHash, @@ -578,7 +578,7 @@ contract("WitnetRequestBytecodes", (accounts) => { }) it("reverts custom error if verifying radon sla with no reward", async () => { await expectRevertCustomError( - WitnetV2, + Witnet, bytecodes.verifyRadonSLA([ 10, 51, @@ -591,7 +591,7 @@ contract("WitnetRequestBytecodes", (accounts) => { }) it("reverts custom error if verifying radon sla with no witnesses", async () => { await expectRevertCustomError( - WitnetV2, + Witnet, bytecodes.verifyRadonSLA([ 0, 51, @@ -604,7 +604,7 @@ contract("WitnetRequestBytecodes", (accounts) => { }) it("reverts custom error if verifying radon sla with too many witnesses", async () => { await expectRevertCustomError( - WitnetV2, + Witnet, bytecodes.verifyRadonSLA([ 500, 51, @@ -617,7 +617,7 @@ contract("WitnetRequestBytecodes", (accounts) => { }) it("reverts custom error if verifying radon sla with quorum out of range", async () => { await expectRevertCustomError( - WitnetV2, + Witnet, bytecodes.verifyRadonSLA([ 10, 50, @@ -628,7 +628,7 @@ contract("WitnetRequestBytecodes", (accounts) => { "RadonSlaConsensusOutOfRange" ) await expectRevertCustomError( - WitnetV2, + Witnet, bytecodes.verifyRadonSLA([ 10, 100, @@ -641,7 +641,7 @@ contract("WitnetRequestBytecodes", (accounts) => { }) it("reverts custom error if verifying radon sla with too low collateral", async () => { await expectRevertCustomError( - WitnetV2, + Witnet, bytecodes.verifyRadonSLA([ 10, 51, From a57018a55254713d5a2fd3449e65124b1de6f4d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Wed, 31 Jul 2024 11:06:53 +0200 Subject: [PATCH 04/39] refactor: IWitnet*Events --- .../defaults/WitnetOracleTrustableBase.sol | 42 ++++++++++++------ .../core/defaults/WitnetPriceFeedsDefault.sol | 15 +++---- contracts/interfaces/IWitnetFeedsEvents.sol | 17 +++++++ contracts/interfaces/IWitnetOracleEvents.sol | 44 ++++++++++++------- .../interfaces/IWitnetRandomnessEvents.sol | 12 ++--- .../IWitnetRequestFactoryEvents.sol | 12 +++++ 6 files changed, 99 insertions(+), 43 deletions(-) create mode 100644 contracts/interfaces/IWitnetFeedsEvents.sol create mode 100644 contracts/interfaces/IWitnetRequestFactoryEvents.sol diff --git a/contracts/core/defaults/WitnetOracleTrustableBase.sol b/contracts/core/defaults/WitnetOracleTrustableBase.sol index 27559d71..e20ddd76 100644 --- a/contracts/core/defaults/WitnetOracleTrustableBase.sol +++ b/contracts/core/defaults/WitnetOracleTrustableBase.sol @@ -391,7 +391,7 @@ abstract contract WitnetOracleTrustableBase /// @dev - insufficient value is paid as reward. /// @param _queryRAD The RAD hash of the data request to be solved by Witnet. /// @param _querySLA The data query SLA to be fulfilled on the Witnet blockchain. - /// @return _witnetQueryId Unique query identifier. + /// @return _queryId Unique query identifier. function postRequest( bytes32 _queryRAD, Witnet.RadonSLA calldata _querySLA @@ -400,13 +400,16 @@ abstract contract WitnetOracleTrustableBase external payable checkReward(estimateBaseFee(_getGasPrice(), _queryRAD)) checkSLA(_querySLA) - returns (uint256 _witnetQueryId) + returns (uint256 _queryId) { - _witnetQueryId = __postRequest(_queryRAD, _querySLA, 0); + _queryId = __postRequest(_queryRAD, _querySLA, 0); // Let Web3 observers know that a new request has been posted emit WitnetQuery( - _witnetQueryId, + _msgSender(), + _getGasPrice(), _getMsgValue(), + _queryId, + _queryRAD, _querySLA ); } @@ -425,7 +428,7 @@ abstract contract WitnetOracleTrustableBase /// @param _queryRAD The RAD hash of the data request to be solved by Witnet. /// @param _querySLA The data query SLA to be fulfilled on the Witnet blockchain. /// @param _queryCallbackGasLimit Maximum gas to be spent when reporting the data request result. - /// @return _witnetQueryId Unique query identifier. + /// @return _queryId Unique query identifier. function postRequestWithCallback( bytes32 _queryRAD, Witnet.RadonSLA calldata _querySLA, @@ -436,16 +439,19 @@ abstract contract WitnetOracleTrustableBase checkCallbackRecipient(msg.sender, _queryCallbackGasLimit) checkReward(estimateBaseFeeWithCallback(_getGasPrice(), _queryCallbackGasLimit)) checkSLA(_querySLA) - returns (uint256 _witnetQueryId) + returns (uint256 _queryId) { - _witnetQueryId = __postRequest( + _queryId = __postRequest( _queryRAD, _querySLA, _queryCallbackGasLimit ); emit WitnetQuery( - _witnetQueryId, + _msgSender(), + _getGasPrice(), _getMsgValue(), + _queryId, + _queryRAD, _querySLA ); } @@ -475,17 +481,20 @@ abstract contract WitnetOracleTrustableBase checkCallbackRecipient(msg.sender, _queryCallbackGasLimit) checkReward(estimateBaseFeeWithCallback(_getGasPrice(), _queryCallbackGasLimit)) checkSLA(_querySLA) - returns (uint256 _witnetQueryId) + returns (uint256 _queryId) { - _witnetQueryId = __postRequest( + _queryId = __postRequest( bytes32(0), _querySLA, _queryCallbackGasLimit ); WitnetOracleDataLib.seekQueryRequest(_witnetQueryId).witnetBytecode = _queryUnverifiedBytecode; emit WitnetQuery( - _witnetQueryId, + _msgSender(), + _getGasPrice(), _getMsgValue(), + _queryId, + _queryUnverifiedBytecode, _querySLA ); } @@ -500,7 +509,12 @@ abstract contract WitnetOracleTrustableBase { Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); __request.evmReward += uint72(_getMsgValue()); - emit WitnetQueryRewardUpgraded(_witnetQueryId, __request.evmReward); + emit WitnetQueryUpgrade( + _witnetQueryId, + _msgSender(), + _getGasPrice(), + __request.evmReward + ); } @@ -792,12 +806,12 @@ abstract contract WitnetOracleTrustableBase // => the callback reverted emit WitnetQueryResponseDeliveryFailed( _witnetQueryId, - _witnetQueryResultCborBytes, _getGasPrice(), _evmCallbackActualGas, bytes(_evmCallbackRevertMessage).length > 0 ? _evmCallbackRevertMessage - : "WitnetOracle: callback exceeded gas limit" + : "WitnetOracle: callback exceeded gas limit", + _witnetQueryResultCborBytes ); } // upon delivery, successfull or not, the audit trail is saved into storage, diff --git a/contracts/core/defaults/WitnetPriceFeedsDefault.sol b/contracts/core/defaults/WitnetPriceFeedsDefault.sol index c09ad591..3e7095ec 100644 --- a/contracts/core/defaults/WitnetPriceFeedsDefault.sol +++ b/contracts/core/defaults/WitnetPriceFeedsDefault.sol @@ -742,11 +742,11 @@ contract WitnetPriceFeedsDefault _usedFunds = uint(_deltaReward); witnet.upgradeQueryEvmReward{value: _usedFunds}(_latestId); // solhint-disable avoid-tx-origin - emit WitnetFeedUpdateRequested( - tx.origin, + emit PullingUpdate( + tx.origin, + _msgSender(), feedId, - _latestId, - _usedFunds + _latestId ); } else { _usedFunds = 0; @@ -772,12 +772,11 @@ contract WitnetPriceFeedsDefault // Update latest query id: __feed.latestUpdateQueryId = _latestId; // solhint-disable avoid-tx-origin: - emit WitnetFeedUpdateRequested( + emit PullingUpdate( tx.origin, + _msgSender(), feedId, - _latestId, - _usedFunds, - querySLA + _latestId ); } } else if (__feed.solver != address(0)) { diff --git a/contracts/interfaces/IWitnetFeedsEvents.sol b/contracts/interfaces/IWitnetFeedsEvents.sol new file mode 100644 index 00000000..129a701b --- /dev/null +++ b/contracts/interfaces/IWitnetFeedsEvents.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.8.0 <0.9.0; + +interface IWitnetFeedsEvents { + + /// A fresh update on the data feed identified as `erc2364Id4` has just been + /// requested and paid for by some `evmSender`, under command of the + /// `evmOrigin` externally owned account. + event PullingUpdate( + address evmOrigin, + address evmSender, + bytes4 erc2362Id4, + uint256 witOracleQueryId + ); + +} diff --git a/contracts/interfaces/IWitnetOracleEvents.sol b/contracts/interfaces/IWitnetOracleEvents.sol index 408b40f5..671d17b1 100644 --- a/contracts/interfaces/IWitnetOracleEvents.sol +++ b/contracts/interfaces/IWitnetOracleEvents.sol @@ -5,39 +5,53 @@ import "../libs/Witnet.sol"; interface IWitnetOracleEvents { - /// Emitted every time a new query containing some verified data request is posted to the WRB. + /// Emitted every time a new query containing some verified data request is posted to the WitnetOracle. event WitnetQuery( - uint256 id, + address evmRequester, + uint256 evmGasPrice, uint256 evmReward, - WitnetV2.RadonSLA witnetSLA + uint256 queryId, + bytes32 queryRadHash, + Witnet.RadonSLA querySLA + ); + + /// Emitted every time a new query containing some unverified data request bytecode is posted to the WRB. + event WitnetQuery( + address evmRequester, + uint256 evmGasPrice, + uint256 evmReward, + uint256 queryId, + bytes queryBytecode, + Witnet.RadonSLA querySLA + ); + + /// Emitted when the reward of some not-yet reported query gets upgraded. + event WitnetQueryUpgrade( + uint256 queryId, + address evmSender, + address evmGasPrice, + uint256 evmReward ); /// Emitted when a query with no callback gets reported into the WRB. event WitnetQueryResponse( - uint256 id, + uint256 queryId, uint256 evmGasPrice ); /// Emitted when a query with a callback gets successfully reported into the WRB. event WitnetQueryResponseDelivered( - uint256 id, + uint256 queryId, uint256 evmGasPrice, uint256 evmCallbackGas ); /// Emitted when a query with a callback cannot get reported into the WRB. event WitnetQueryResponseDeliveryFailed( - uint256 id, - bytes resultCborBytes, + uint256 queryId, uint256 evmGasPrice, uint256 evmCallbackActualGas, - string evmCallbackRevertReason + string evmCallbackRevertReason, + bytes resultCborBytes ); - - /// Emitted when the reward of some not-yet reported query is upgraded. - event WitnetQueryRewardUpgraded( - uint256 id, - uint256 evmReward - ); - } diff --git a/contracts/interfaces/IWitnetRandomnessEvents.sol b/contracts/interfaces/IWitnetRandomnessEvents.sol index e7360d22..8de20ab3 100644 --- a/contracts/interfaces/IWitnetRandomnessEvents.sol +++ b/contracts/interfaces/IWitnetRandomnessEvents.sol @@ -8,11 +8,11 @@ import "../libs/Witnet.sol"; /// @title The Witnet Randomness generator interface. /// @author Witnet Foundation. interface IWitnetRandomnessEvents { + + /// Emitted every time a new randomize is requested. event Randomizing( - uint256 blockNumber, - uint256 evmTxGasPrice, - uint256 evmRandomizeFee, - uint256 witnetQueryId, - WitnetV2.RadonSLA witnetQuerySLA - ); + address evmOrigin, + address evmSender, + uint256 witOracleQueryId + ); } diff --git a/contracts/interfaces/IWitnetRequestFactoryEvents.sol b/contracts/interfaces/IWitnetRequestFactoryEvents.sol new file mode 100644 index 00000000..0347d8d2 --- /dev/null +++ b/contracts/interfaces/IWitnetRequestFactoryEvents.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; + +interface IWitnetRequestFactoryEvents { + + /// Emitted every time a new counter-factual WitnetRequest gets verified and built. + event WitnetRequestBuilt(address request); + + /// Emitted every time a new counter-factual WitnetRequestTemplate gets verified and built. + event WitnetRequestTemplateBuilt(address template, uint256[] argsCount); +} From 3dccd8a3b4c338a1d8c5412e5df31c7cdf2b1cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Wed, 31 Jul 2024 11:28:33 +0200 Subject: [PATCH 05/39] refactor: IWitnet*Appliance --- contracts/WitnetFeeds.sol | 13 +++---- contracts/WitnetOracle.sol | 13 ++----- contracts/WitnetPriceFeeds.sol | 6 +-- contracts/WitnetRandomness.sol | 7 ++-- contracts/WitnetRequestBytecodes.sol | 15 ++++---- contracts/WitnetRequestFactory.sol | 17 ++++----- contracts/apps/WitnetRandomnessV2.sol | 38 +++++++++---------- .../customs/WitnetOracleTrustableObscuro.sol | 2 +- .../defaults/WitnetOracleTrustableBase.sol | 37 ++++++++---------- .../core/defaults/WitnetPriceFeedsDefault.sol | 11 ++++-- .../WitnetRequestBytecodesDefault.sol | 2 +- .../defaults/WitnetRequestFactoryDefault.sol | 7 ++-- contracts/interfaces/IWitnetAppliance.sol | 12 ++++++ contracts/interfaces/IWitnetFeeds.sol | 26 +------------ contracts/interfaces/IWitnetFeedsAdmin.sol | 2 +- contracts/interfaces/IWitnetOracle.sol | 15 ++++++++ .../interfaces/IWitnetOracleAppliance.sol | 13 +++++++ contracts/interfaces/IWitnetRandomness.sol | 5 +-- .../interfaces/IWitnetRandomnessAdmin.sol | 2 +- .../interfaces/IWitnetRequestFactory.sol | 3 +- .../IWitnetRequestFactoryAppliance.sol | 14 +++++++ 21 files changed, 136 insertions(+), 124 deletions(-) create mode 100644 contracts/interfaces/IWitnetAppliance.sol create mode 100644 contracts/interfaces/IWitnetOracleAppliance.sol create mode 100644 contracts/interfaces/IWitnetRequestFactoryAppliance.sol diff --git a/contracts/WitnetFeeds.sol b/contracts/WitnetFeeds.sol index 67e97247..720bc108 100644 --- a/contracts/WitnetFeeds.sol +++ b/contracts/WitnetFeeds.sol @@ -4,7 +4,8 @@ pragma solidity >=0.7.0 <0.9.0; import "./interfaces/IFeeds.sol"; import "./interfaces/IWitnetFeeds.sol"; -import "./interfaces/IWitnetFeedsAdmin.sol"; +import "./interfaces/IWitnetFeedsEvents.sol"; +import "./interfaces/IWitnetOracleAppliance.sol"; import "ado-contracts/contracts/interfaces/IERC2362.sol"; @@ -13,14 +14,12 @@ abstract contract WitnetFeeds IERC2362, IFeeds, IWitnetFeeds, - IWitnetFeedsAdmin, + IWitnetFeedsEvents, + IWitnetOracleAppliance, IWitnetOracleEvents { Witnet.RadonDataTypes immutable public override dataType; - - function class() virtual external view returns (string memory); - function specs() virtual external view returns (bytes4); - function witnet() virtual external view returns (WitnetOracle); + bytes32 immutable internal __prefix; constructor( Witnet.RadonDataTypes _dataType, @@ -31,8 +30,6 @@ abstract contract WitnetFeeds __prefix = Witnet.toBytes32(bytes(_prefix)); } - bytes32 immutable internal __prefix; - function prefix() override public view returns (string memory) { return Witnet.toString(__prefix); } diff --git a/contracts/WitnetOracle.sol b/contracts/WitnetOracle.sol index 42d61897..f3ed5435 100644 --- a/contracts/WitnetOracle.sol +++ b/contracts/WitnetOracle.sol @@ -4,6 +4,8 @@ pragma solidity >=0.7.0 <0.9.0; import "./WitnetRequestBytecodes.sol"; import "./WitnetRequestFactory.sol"; + +import "./interfaces/IWitnetAppliance.sol"; import "./interfaces/IWitnetOracle.sol"; import "./interfaces/IWitnetOracleEvents.sol"; @@ -11,14 +13,7 @@ import "./interfaces/IWitnetOracleEvents.sol"; /// @author The Witnet Foundation. abstract contract WitnetOracle is + IWitnetAppliance, IWitnetOracle, IWitnetOracleEvents -{ - function class() virtual external view returns (string memory) { - return type(WitnetOracle).name; - } - function channel() virtual external view returns (bytes4); - function factory() virtual external view returns (WitnetRequestFactory); - function registry() virtual external view returns (WitnetRequestBytecodes); - function specs() virtual external view returns (bytes4); -} \ No newline at end of file +{} diff --git a/contracts/WitnetPriceFeeds.sol b/contracts/WitnetPriceFeeds.sol index cc9c83e4..2db722cb 100644 --- a/contracts/WitnetPriceFeeds.sol +++ b/contracts/WitnetPriceFeeds.sol @@ -3,20 +3,16 @@ pragma solidity >=0.7.0 <0.9.0; import "./WitnetFeeds.sol"; - import "./interfaces/IWitnetPriceFeeds.sol"; -import "./interfaces/IWitnetPriceSolverDeployer.sol"; /// @title WitnetPriceFeeds: Price Feeds live repository reliant on the Witnet Oracle blockchain. /// @author The Witnet Foundation. abstract contract WitnetPriceFeeds is WitnetFeeds, - IWitnetPriceFeeds, - IWitnetPriceSolverDeployer + IWitnetPriceFeeds { constructor() WitnetFeeds(Witnet.RadonDataTypes.Integer, "Price-") {} - } diff --git a/contracts/WitnetRandomness.sol b/contracts/WitnetRandomness.sol index 1066cd7c..08c8cf1f 100644 --- a/contracts/WitnetRandomness.sol +++ b/contracts/WitnetRandomness.sol @@ -2,16 +2,15 @@ pragma solidity >=0.8.0 <0.9.0; +import "./interfaces/IWitnetOracleAppliance.sol"; import "./interfaces/IWitnetOracleEvents.sol"; import "./interfaces/IWitnetRandomness.sol"; import "./interfaces/IWitnetRandomnessEvents.sol"; abstract contract WitnetRandomness is + IWitnetOracleAppliance, IWitnetOracleEvents, IWitnetRandomness, IWitnetRandomnessEvents -{ - function class() virtual external view returns (string memory); - function specs() virtual external view returns (bytes4); -} +{} diff --git a/contracts/WitnetRequestBytecodes.sol b/contracts/WitnetRequestBytecodes.sol index 15b64715..7439203e 100644 --- a/contracts/WitnetRequestBytecodes.sol +++ b/contracts/WitnetRequestBytecodes.sol @@ -3,14 +3,13 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./interfaces/IWitnetRequestBytecodes.sol"; +import "./interfaces/IWitnetAppliance.sol"; +import "./interfaces/IWitnetRequestRegistry.sol"; +import "./interfaces/IWitnetRequestRegistryEvents.sol"; abstract contract WitnetRequestBytecodes is - IWitnetRequestBytecodes -{ - function class() virtual external view returns (string memory) { - return type(WitnetRequestBytecodes).name; - } - function specs() virtual external view returns (bytes4); -} \ No newline at end of file + IWitnetAppliance, + IWitnetRequestRegistry, + IWitnetRequestRegistryEvents +{} diff --git a/contracts/WitnetRequestFactory.sol b/contracts/WitnetRequestFactory.sol index d222d727..ae869600 100644 --- a/contracts/WitnetRequestFactory.sol +++ b/contracts/WitnetRequestFactory.sol @@ -3,16 +3,15 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetRequestBytecodes.sol"; -import "./WitnetOracle.sol"; +import "./interfaces/IWitnetOracleAppliance.sol"; import "./interfaces/IWitnetRequestFactory.sol"; +import "./interfaces/IWitnetRequestFactoryEvents.sol"; +import "./interfaces/IWitnetRequestRegistryEvents.sol"; abstract contract WitnetRequestFactory is - IWitnetRequestFactory -{ - function class() virtual external view returns (string memory); - function registry() virtual external view returns (WitnetRequestBytecodes); - function specs() virtual external view returns (bytes4); - function witnet() virtual external view returns (WitnetOracle); -} \ No newline at end of file + IWitnetOracleAppliance, + IWitnetRequestFactory, + IWitnetRequestFactoryEvents, + IWitnetRequestRegistryEvents +{} diff --git a/contracts/apps/WitnetRandomnessV2.sol b/contracts/apps/WitnetRandomnessV2.sol index 5780d7c2..7edc1bca 100644 --- a/contracts/apps/WitnetRandomnessV2.sol +++ b/contracts/apps/WitnetRandomnessV2.sol @@ -18,7 +18,7 @@ contract WitnetRandomnessV2 { using Witnet for bytes; using Witnet for Witnet.Result; - using WitnetV2 for WitnetV2.RadonSLA; + using Witnet for Witnet.RadonSLA; struct Randomize { uint256 witnetQueryId; @@ -52,7 +52,7 @@ contract WitnetRandomnessV2 // Build own Witnet Randomness Request: bytes32[] memory _retrievals = new bytes32[](1); _retrievals[0] = _registry.verifyRadonRetrieval( - Witnet.RadonDataRequestMethods.RNG, + Witnet.RadonRetrievalMethods.RNG, "", // no request url "", // no request body new string[2][](0), // no request headers @@ -99,7 +99,7 @@ contract WitnetRandomnessV2 return type(WitnetRandomness).interfaceId; } - function witnet() override (IWitnetRandomness, UsingWitnet) + function witnet() override (IWitnetOracleAppliance, UsingWitnet) public view returns (WitnetOracle) { return UsingWitnet.witnet(); @@ -161,14 +161,14 @@ contract WitnetRandomnessV2 "not randomized" ); - WitnetV2.ResponseStatus _status = __witnet.getQueryResponseStatus(_witnetQueryId); - if (_status == WitnetV2.ResponseStatus.Ready) { + Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_witnetQueryId); + if (_status == Witnet.ResponseStatus.Ready) { return ( __witnet.getQueryResultCborBytes(_witnetQueryId) .toWitnetResult() .asBytes32() ); - } else if (_status == WitnetV2.ResponseStatus.Error) { + } else if (_status == Witnet.ResponseStatus.Error) { uint256 _nextRandomizeBlock = __randomize.nextBlock; _require( _nextRandomizeBlock != 0, @@ -214,15 +214,15 @@ contract WitnetRandomnessV2 "not randomized" ); - WitnetV2.ResponseStatus _status = __witnet.getQueryResponseStatus(_witnetQueryId); - if (_status == WitnetV2.ResponseStatus.Ready) { - WitnetV2.Response memory _witnetQueryResponse = __witnet.getQueryResponse(_witnetQueryId); + Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_witnetQueryId); + if (_status == Witnet.ResponseStatus.Ready) { + Witnet.Response memory _witnetQueryResponse = __witnet.getQueryResponse(_witnetQueryId); _witnetResultTimestamp = _witnetQueryResponse.resultTimestamp; _witnetResultTallyHash = _witnetQueryResponse.resultTallyHash; _witnetResultFinalityBlock = _witnetQueryResponse.finality; _witnetResultRandomness = _witnetQueryResponse.resultCborBytes.toWitnetResult().asBytes32(); - } else if (_status == WitnetV2.ResponseStatus.Error) { + } else if (_status == Witnet.ResponseStatus.Error) { uint256 _nextRandomizeBlock = __randomize.nextBlock; _require( _nextRandomizeBlock != 0, @@ -307,23 +307,23 @@ contract WitnetRandomnessV2 function getRandomizeStatus(uint256 _blockNumber) virtual override public view - returns (WitnetV2.ResponseStatus) + returns (Witnet.ResponseStatus) { if (__storage().randomize_[_blockNumber].witnetQueryId == 0) { _blockNumber = getRandomizeNextBlock(_blockNumber); } uint256 _witnetQueryId = __storage().randomize_[_blockNumber].witnetQueryId; if (_witnetQueryId == 0) { - return WitnetV2.ResponseStatus.Void; + return Witnet.ResponseStatus.Void; } else { - WitnetV2.ResponseStatus _status = __witnet.getQueryResponseStatus(_witnetQueryId); - if (_status == WitnetV2.ResponseStatus.Error) { + Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_witnetQueryId); + if (_status == Witnet.ResponseStatus.Error) { uint256 _nextRandomizeBlock = __storage().randomize_[_blockNumber].nextBlock; if (_nextRandomizeBlock != 0) { return getRandomizeStatus(_nextRandomizeBlock); } else { - return WitnetV2.ResponseStatus.Error; + return Witnet.ResponseStatus.Error; } } else { return _status; @@ -339,7 +339,7 @@ contract WitnetRandomnessV2 returns (bool) { return ( - getRandomizeStatus(_blockNumber) == WitnetV2.ResponseStatus.Ready + getRandomizeStatus(_blockNumber) == Witnet.ResponseStatus.Ready ); } @@ -354,7 +354,7 @@ contract WitnetRandomnessV2 virtual override returns (uint32) { - return WitnetV2.randomUniformUint32( + return Witnet.randomUniformUint32( _range, _nonce, keccak256( @@ -413,7 +413,7 @@ contract WitnetRandomnessV2 function witnetQuerySLA() virtual override external view - returns (WitnetV2.RadonSLA memory) + returns (Witnet.RadonSLA memory) { return __witnetDefaultSLA; } @@ -469,7 +469,7 @@ contract WitnetRandomnessV2 __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - function settleWitnetQuerySLA(WitnetV2.RadonSLA calldata _witnetQuerySLA) + function settleWitnetQuerySLA(Witnet.RadonSLA calldata _witnetQuerySLA) virtual override external onlyOwner diff --git a/contracts/core/customs/WitnetOracleTrustableObscuro.sol b/contracts/core/customs/WitnetOracleTrustableObscuro.sol index b010fb7f..d692142b 100644 --- a/contracts/core/customs/WitnetOracleTrustableObscuro.sol +++ b/contracts/core/customs/WitnetOracleTrustableObscuro.sol @@ -52,7 +52,7 @@ contract WitnetOracleTrustableObscuro public view virtual override onlyRequester(_queryId) - returns (WitnetV2.Query memory) + returns (Witnet.Query memory) { return WitnetOracleTrustableBase.getQuery(_queryId); } diff --git a/contracts/core/defaults/WitnetOracleTrustableBase.sol b/contracts/core/defaults/WitnetOracleTrustableBase.sol index e20ddd76..c43f2f1a 100644 --- a/contracts/core/defaults/WitnetOracleTrustableBase.sol +++ b/contracts/core/defaults/WitnetOracleTrustableBase.sol @@ -33,10 +33,17 @@ abstract contract WitnetOracleTrustableBase using Witnet for Witnet.Request; using Witnet for Witnet.Response; - bytes4 public immutable override specs = type(IWitnetOracle).interfaceId; - WitnetRequestBytecodes immutable public override registry; - - WitnetRequestFactory immutable private __factory; + function channel() virtual override public view returns (bytes4) { + return bytes4(keccak256(abi.encode(address(this), block.chainid))); + } + + function class() + public view + virtual override(IWitnetAppliance, WitnetUpgradableBase) + returns (string memory) + { + return type(WitnetOracleTrustableBase).name; + } modifier checkCallbackRecipient(address _addr, uint24 _callbackGasLimit) { _require( @@ -128,22 +135,6 @@ abstract contract WitnetOracleTrustableBase ))); } - function channel() virtual override public view returns (bytes4) { - return bytes4(keccak256(abi.encode(address(this), block.chainid))); - } - - function class() - public view - virtual override(WitnetOracle, WitnetUpgradableBase) - returns (string memory) - { - return type(WitnetOracleTrustableBase).name; - } - - function factory() virtual override public view returns (WitnetRequestFactory) { - return __factory; - } - // ================================================================================================================ // --- Yet to be implemented virtual methods ---------------------------------------------------------------------- @@ -747,7 +738,11 @@ abstract contract WitnetOracleTrustableBase ))); } - function __postRequest(bytes32 _radHash, WitnetV2.RadonSLA calldata _sla, uint24 _callbackGasLimit) + function __postRequest( + bytes32 _radHash, + Witnet.RadonSLA calldata _sla, + uint24 _callbackGasLimit + ) virtual internal returns (uint256 _witnetQueryId) { diff --git a/contracts/core/defaults/WitnetPriceFeedsDefault.sol b/contracts/core/defaults/WitnetPriceFeedsDefault.sol index 3e7095ec..45650a0b 100644 --- a/contracts/core/defaults/WitnetPriceFeedsDefault.sol +++ b/contracts/core/defaults/WitnetPriceFeedsDefault.sol @@ -8,6 +8,9 @@ import "../WitnetUpgradableBase.sol"; import "../../WitnetPriceFeeds.sol"; import "../../data/WitnetPriceFeedsData.sol"; +import "../../interfaces/IWitnetFeedsAdmin.sol"; +import "../../interfaces/IWitnetPriceSolverDeployer.sol"; + import "../../libs/WitnetPriceFeedsLib.sol"; import "../../patterns/Ownable2Step.sol"; @@ -19,21 +22,23 @@ contract WitnetPriceFeedsDefault Ownable2Step, WitnetPriceFeeds, WitnetPriceFeedsData, - WitnetUpgradableBase + WitnetUpgradableBase, + IWitnetFeedsAdmin, + IWitnetPriceSolverDeployer { using Witnet for bytes; using Witnet for Witnet.Result; using Witnet for Witnet.Response; using Witnet for Witnet.RadonSLA; - function class() virtual override(WitnetFeeds, WitnetUpgradableBase) public view returns (string memory) { + function class() virtual override(IWitnetAppliance, WitnetUpgradableBase) public view returns (string memory) { return type(WitnetPriceFeedsDefault).name; } bytes4 immutable public override specs = type(IWitnetPriceFeeds).interfaceId; WitnetOracle immutable public override witnet; - WitnetV2.RadonSLA private __defaultRadonSLA; + Witnet.RadonSLA private __defaultRadonSLA; uint16 private __baseFeeOverheadPercentage; constructor( diff --git a/contracts/core/defaults/WitnetRequestBytecodesDefault.sol b/contracts/core/defaults/WitnetRequestBytecodesDefault.sol index cb457b76..3cadcf95 100644 --- a/contracts/core/defaults/WitnetRequestBytecodesDefault.sol +++ b/contracts/core/defaults/WitnetRequestBytecodesDefault.sol @@ -31,7 +31,7 @@ contract WitnetRequestBytecodesDefault function class() public view - virtual override(WitnetRequestBytecodes, WitnetUpgradableBase) + virtual override(IWitnetAppliance, WitnetUpgradableBase) returns (string memory) { return type(WitnetRequestBytecodesDefault).name; diff --git a/contracts/core/defaults/WitnetRequestFactoryDefault.sol b/contracts/core/defaults/WitnetRequestFactoryDefault.sol index b5e94849..07048ca2 100644 --- a/contracts/core/defaults/WitnetRequestFactoryDefault.sol +++ b/contracts/core/defaults/WitnetRequestFactoryDefault.sol @@ -21,7 +21,7 @@ contract WitnetRequestFactoryDefault WitnetRequestBytecodes immutable public override(WitnetRequestFactory, WitnetRequestTemplate) registry; /// @notice Reference to the Witnet Request Board that all templates built out from this factory will refer to. - WitnetOracle immutable public override(WitnetRequestFactory, WitnetRequestTemplate) witnet; + WitnetOracle immutable public override witnet; modifier onlyDelegateCalls override(Clonable, Upgradeable) { require( @@ -188,7 +188,7 @@ contract WitnetRequestFactoryDefault } function class() - virtual override(WitnetRequestFactory, WitnetRequestTemplate, WitnetUpgradableBase) + virtual override(IWitnetAppliance, WitnetUpgradableBase) public view returns (string memory) { @@ -205,7 +205,7 @@ contract WitnetRequestFactoryDefault } function specs() - virtual override(WitnetRequestFactory, WitnetRequestTemplate) + virtual override external view returns (bytes4) { @@ -485,7 +485,6 @@ contract WitnetRequestFactoryDefault } else { return __witnetRequestTemplate().retrievals; } - } function tally() diff --git a/contracts/interfaces/IWitnetAppliance.sol b/contracts/interfaces/IWitnetAppliance.sol new file mode 100644 index 00000000..aed9dda9 --- /dev/null +++ b/contracts/interfaces/IWitnetAppliance.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +interface IWitnetAppliance { + + /// @notice Returns the name of the actual contract implementing the logic of this Witnet appliance. + function class() external view returns (string memory); + + /// @notice Returns the ERC-165 id of the minimal functionality expected for this appliance. + function specs() external view returns (bytes4); + +} diff --git a/contracts/interfaces/IWitnetFeeds.sol b/contracts/interfaces/IWitnetFeeds.sol index 3a815511..78fc720e 100644 --- a/contracts/interfaces/IWitnetFeeds.sol +++ b/contracts/interfaces/IWitnetFeeds.sol @@ -5,32 +5,10 @@ pragma solidity >=0.8.0 <0.9.0; import "../WitnetOracle.sol"; import "../WitnetRequestBytecodes.sol"; -interface IWitnetFeeds { +interface IWitnetFeeds { - event WitnetFeedDeleted(bytes4 feedId); - event WitnetFeedSettled(bytes4 feedId, bytes32 radHash); - event WitnetFeedSolverSettled(bytes4 feedId, address solver); - event WitnetRadonSLA(WitnetV2.RadonSLA sla); - - event WitnetFeedUpdateRequested( - address indexed origin, - bytes4 indexed feedId, - uint256 witnetQueryId, - uint256 witnetQueryEvmReward, - WitnetV2.RadonSLA witnetQuerySLA - ); - - event WitnetFeedUpdateRequested( - address indexed origin, - bytes4 indexed feedId, - uint256 witnetQueryId, - uint256 witnetQueryReward - ); - function dataType() external view returns (Witnet.RadonDataTypes); function prefix() external view returns (string memory); - function registry() external view returns (WitnetRequestBytecodes); - function witnet() external view returns (WitnetOracle); function defaultRadonSLA() external view returns (Witnet.RadonSLA memory); function estimateUpdateBaseFee(uint256 evmGasPrice) external view returns (uint); @@ -50,4 +28,4 @@ interface IWitnetFeeds { function requestUpdate(bytes4 feedId) external payable returns (uint256 usedFunds); function requestUpdate(bytes4 feedId, Witnet.RadonSLA calldata updateSLA) external payable returns (uint256 usedFunds); -} \ No newline at end of file +} diff --git a/contracts/interfaces/IWitnetFeedsAdmin.sol b/contracts/interfaces/IWitnetFeedsAdmin.sol index 0a6c9009..27200ac6 100644 --- a/contracts/interfaces/IWitnetFeedsAdmin.sol +++ b/contracts/interfaces/IWitnetFeedsAdmin.sol @@ -16,7 +16,7 @@ interface IWitnetFeedsAdmin { function settleDefaultRadonSLA(Witnet.RadonSLA calldata) external; function settleFeedRequest(string calldata caption, bytes32 radHash) external; function settleFeedRequest(string calldata caption, WitnetRequest request) external; - function settleFeedRequest(string calldata caption, WitnetRequestTemplate template, string[][] calldata) external; + function settleFeedRequest(string calldata caption, IWitnetRequestTemplate template, string[][] calldata) external; function settleFeedSolver (string calldata caption, address solver, string[] calldata deps) external; function transferOwnership(address) external; } \ No newline at end of file diff --git a/contracts/interfaces/IWitnetOracle.sol b/contracts/interfaces/IWitnetOracle.sol index 5dde2b5c..706bcefc 100644 --- a/contracts/interfaces/IWitnetOracle.sol +++ b/contracts/interfaces/IWitnetOracle.sol @@ -3,8 +3,14 @@ pragma solidity >=0.7.0 <0.9.0; import "../libs/Witnet.sol"; +import "../WitnetRequestBytecodes.sol"; +import "../WitnetRequestFactory.sol"; + interface IWitnetOracle { + /// @notice Uniquely identifies the WitnetOracle addrees and the chain on which it's deployed. + function channel() external view returns (bytes4); + /// @notice Estimate the minimum reward required for posting a data request. /// @dev Underestimates if the size of returned data is greater than `resultMaxSize`. /// @param gasPrice Expected gas price to pay upon posting the data request. @@ -21,6 +27,10 @@ interface IWitnetOracle { /// @param gasPrice Expected gas price to pay upon posting the data request. /// @param callbackGasLimit Maximum gas to be spent when reporting the data request result. function estimateBaseFeeWithCallback(uint256 gasPrice, uint24 callbackGasLimit) external view returns (uint256); + + /// @notice Returns the address of the WitnetRequestFactory appliance capable of building compliant data request + /// @notice templates verified into the same WitnetRequestBytecodes instance returned by registry(). + function factory() external view returns (WitnetRequestFactory); /// @notice Retrieves a copy of all Witnet-provable data related to a previously posted request, /// removing the whole query from the WRB storage. @@ -125,6 +135,11 @@ interface IWitnetOracle { uint24 queryCallbackGasLimit ) external payable returns (uint256 queryId); + /// @notice Returns the singleton WitnetRequestBytecodes in which all Witnet-compliant data requests + /// @notice and templates must be previously verified so they can be passed as reference when + /// @notice calling postRequest(bytes32,..) methods. + function registry() external view returns (WitnetRequestBytecodes); + /// @notice Increments the reward of a previously posted request by adding the transaction value to it. /// @param queryId The unique query identifier. function upgradeQueryEvmReward(uint256 queryId) external payable; diff --git a/contracts/interfaces/IWitnetOracleAppliance.sol b/contracts/interfaces/IWitnetOracleAppliance.sol new file mode 100644 index 00000000..a2a9cc85 --- /dev/null +++ b/contracts/interfaces/IWitnetOracleAppliance.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "../WitnetOracle.sol"; +import "./IWitnetAppliance.sol"; + +abstract contract IWitnetOracleAppliance + is + IWitnetAppliance +{ + /// @notice Returns the WitnetOracle address that this appliance is bound to. + function witnet() virtual external view returns (WitnetOracle); +} diff --git a/contracts/interfaces/IWitnetRandomness.sol b/contracts/interfaces/IWitnetRandomness.sol index 70018866..ee0fb433 100644 --- a/contracts/interfaces/IWitnetRandomness.sol +++ b/contracts/interfaces/IWitnetRandomness.sol @@ -94,14 +94,11 @@ interface IWitnetRandomness { /// @return Funds actually paid as randomize fee. function randomize() external payable returns (uint256); - /// @notice Returns address of the Witnet Oracle bridging contract being used for solving randomness requests. - function witnet() external view returns (WitnetOracle); - /// @notice Returns the SLA parameters required for the Witnet Oracle blockchain to fulfill /// @notice when solving randomness requests: /// @notice - number of witnessing nodes contributing to randomness generation /// @notice - reward in $nanoWIT received per witnessing node in the Witnet blockchain - function witnetQuerySLA() external view returns (WitnetV2.RadonSLA memory); + function witnetQuerySLA() external view returns (Witnet.RadonSLA memory); /// @notice Returns the unique identifier of the Witnet-compliant data request being used for solving randomness. function witnetRadHash() external view returns (bytes32); diff --git a/contracts/interfaces/IWitnetRandomnessAdmin.sol b/contracts/interfaces/IWitnetRandomnessAdmin.sol index bef12dcb..7860b526 100644 --- a/contracts/interfaces/IWitnetRandomnessAdmin.sol +++ b/contracts/interfaces/IWitnetRandomnessAdmin.sol @@ -11,5 +11,5 @@ interface IWitnetRandomnessAdmin { function pendingOwner() external returns (address); function transferOwnership(address) external; function settleBaseFeeOverheadPercentage(uint16) external; - function settleWitnetQuerySLA(WitnetV2.RadonSLA calldata) external; + function settleWitnetQuerySLA(Witnet.RadonSLA calldata) external; } \ No newline at end of file diff --git a/contracts/interfaces/IWitnetRequestFactory.sol b/contracts/interfaces/IWitnetRequestFactory.sol index 6a48ff8e..6a761519 100644 --- a/contracts/interfaces/IWitnetRequestFactory.sol +++ b/contracts/interfaces/IWitnetRequestFactory.sol @@ -3,8 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; interface IWitnetRequestFactory { - - event WitnetRequestTemplateBuilt(address template, bool parameterized); + function buildRequestTemplate( bytes32[] memory sourcesIds, diff --git a/contracts/interfaces/IWitnetRequestFactoryAppliance.sol b/contracts/interfaces/IWitnetRequestFactoryAppliance.sol new file mode 100644 index 00000000..299f4343 --- /dev/null +++ b/contracts/interfaces/IWitnetRequestFactoryAppliance.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "./IWitnetOracleAppliance.sol"; +import "../WitnetRequestFactory.sol"; + +abstract contract IWitnetRequestFactoryAppliance + is + IWitnetOracleAppliance, + IWitnetRequestFactoryEvents, + IWitnetRequestRegistryEvents +{ + function factory() virtual external view returns (WitnetRequestFactory); +} From c718a22948068f53c2c44f08fbe715a57c1e9a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Wed, 31 Jul 2024 14:03:57 +0200 Subject: [PATCH 06/39] refactor: *RequestBytecodes* -> *RadonRegistry* --- README.md | 2 +- contracts/WitnetOracle.sol | 2 +- contracts/WitnetRadonRegistry.sol | 15 ++++ contracts/WitnetRequestBytecodes.sol | 15 ---- contracts/WitnetRequestFactory.sol | 6 +- ...56.sol => WitnetRadonRegistryNoSha256.sol} | 10 +-- .../customs/WitnetRequestFactoryCfxCore.sol | 2 +- ...ult.sol => WitnetRadonRegistryDefault.sol} | 28 +++--- .../defaults/WitnetRequestFactoryDefault.sol | 2 +- contracts/data/WitnetOracleDataLib.sol | 4 +- contracts/interfaces/IWitnetFeeds.sol | 2 +- contracts/interfaces/IWitnetOracle.sol | 29 ++++-- contracts/interfaces/IWitnetRadonRegistry.sol | 89 +++++++++++++++++++ .../interfaces/IWitnetRadonRegistryEvents.sol | 16 ++++ ...des.sol => IWitnetRadonRegistryLegacy.sol} | 23 +---- .../IWitnetRequestFactoryAppliance.sol | 4 +- 16 files changed, 174 insertions(+), 75 deletions(-) create mode 100644 contracts/WitnetRadonRegistry.sol delete mode 100644 contracts/WitnetRequestBytecodes.sol rename contracts/core/customs/{WitnetRequestBytecodesNoSha256.sol => WitnetRadonRegistryNoSha256.sol} (60%) rename contracts/core/defaults/{WitnetRequestBytecodesDefault.sol => WitnetRadonRegistryDefault.sol} (94%) create mode 100644 contracts/interfaces/IWitnetRadonRegistry.sol create mode 100644 contracts/interfaces/IWitnetRadonRegistryEvents.sol rename contracts/interfaces/{IWitnetRequestBytecodes.sol => IWitnetRadonRegistryLegacy.sol} (67%) diff --git a/README.md b/README.md index 01aca983..03bf7dc2 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Javacript methods and resources: - `assets.WitnetPriceFeeds` - `assets.WitnetPriceRouteSolver` - `assets.WitnetRequest` - - `assets.WitnetRequestBytecodes` + - `assets.WitnetRadonRegistry` - `assets.WitnetRequestFactory` - `assets.WitnetRequestTemplate` - `assets.WitnetUpgrableBase` diff --git a/contracts/WitnetOracle.sol b/contracts/WitnetOracle.sol index f3ed5435..934e291b 100644 --- a/contracts/WitnetOracle.sol +++ b/contracts/WitnetOracle.sol @@ -2,7 +2,7 @@ pragma solidity >=0.7.0 <0.9.0; -import "./WitnetRequestBytecodes.sol"; +import "./WitnetRadonRegistry.sol"; import "./WitnetRequestFactory.sol"; import "./interfaces/IWitnetAppliance.sol"; diff --git a/contracts/WitnetRadonRegistry.sol b/contracts/WitnetRadonRegistry.sol new file mode 100644 index 00000000..58f085a2 --- /dev/null +++ b/contracts/WitnetRadonRegistry.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; +pragma experimental ABIEncoderV2; + +import "./interfaces/IWitnetAppliance.sol"; +import "./interfaces/IWitnetRadonRegistry.sol"; +import "./interfaces/IWitnetRadonRegistryEvents.sol"; + +abstract contract WitnetRadonRegistry + is + IWitnetAppliance, + IWitnetRadonRegistry, + IWitnetRadonRegistryEvents +{} diff --git a/contracts/WitnetRequestBytecodes.sol b/contracts/WitnetRequestBytecodes.sol deleted file mode 100644 index 7439203e..00000000 --- a/contracts/WitnetRequestBytecodes.sol +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.7.0 <0.9.0; -pragma experimental ABIEncoderV2; - -import "./interfaces/IWitnetAppliance.sol"; -import "./interfaces/IWitnetRequestRegistry.sol"; -import "./interfaces/IWitnetRequestRegistryEvents.sol"; - -abstract contract WitnetRequestBytecodes - is - IWitnetAppliance, - IWitnetRequestRegistry, - IWitnetRequestRegistryEvents -{} diff --git a/contracts/WitnetRequestFactory.sol b/contracts/WitnetRequestFactory.sol index ae869600..86951895 100644 --- a/contracts/WitnetRequestFactory.sol +++ b/contracts/WitnetRequestFactory.sol @@ -4,14 +4,14 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "./interfaces/IWitnetOracleAppliance.sol"; +import "./interfaces/IWitnetRadonRegistryEvents.sol"; import "./interfaces/IWitnetRequestFactory.sol"; import "./interfaces/IWitnetRequestFactoryEvents.sol"; -import "./interfaces/IWitnetRequestRegistryEvents.sol"; abstract contract WitnetRequestFactory is IWitnetOracleAppliance, + IWitnetRadonRegistryEvents, IWitnetRequestFactory, - IWitnetRequestFactoryEvents, - IWitnetRequestRegistryEvents + IWitnetRequestFactoryEvents {} diff --git a/contracts/core/customs/WitnetRequestBytecodesNoSha256.sol b/contracts/core/customs/WitnetRadonRegistryNoSha256.sol similarity index 60% rename from contracts/core/customs/WitnetRequestBytecodesNoSha256.sol rename to contracts/core/customs/WitnetRadonRegistryNoSha256.sol index 719f909a..637cf1fc 100644 --- a/contracts/core/customs/WitnetRequestBytecodesNoSha256.sol +++ b/contracts/core/customs/WitnetRadonRegistryNoSha256.sol @@ -3,18 +3,18 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../defaults/WitnetRequestBytecodesDefault.sol"; +import "../defaults/WitnetRadonRegistryDefault.sol"; -contract WitnetRequestBytecodesNoSha256 +contract WitnetRadonRegistryNoSha256 is - WitnetRequestBytecodesDefault + WitnetRadonRegistryDefault { function class() virtual override public view returns (string memory) { - return type(WitnetRequestBytecodesNoSha256).name; + return type(WitnetRadonRegistryNoSha256).name; } constructor(bool _upgradable, bytes32 _versionTag) - WitnetRequestBytecodesDefault(_upgradable, _versionTag) + WitnetRadonRegistryDefault(_upgradable, _versionTag) {} function _witnetHash(bytes memory chunk) virtual override internal pure returns (bytes32) { diff --git a/contracts/core/customs/WitnetRequestFactoryCfxCore.sol b/contracts/core/customs/WitnetRequestFactoryCfxCore.sol index ed7caf14..93bb4e2e 100644 --- a/contracts/core/customs/WitnetRequestFactoryCfxCore.sol +++ b/contracts/core/customs/WitnetRequestFactoryCfxCore.sol @@ -11,7 +11,7 @@ contract WitnetRequestFactoryCfxCore { constructor( WitnetOracle _witnet, - WitnetRequestBytecodes _registry, + WitnetRadonRegistry _registry, bool _upgradable, bytes32 _versionTag ) diff --git a/contracts/core/defaults/WitnetRequestBytecodesDefault.sol b/contracts/core/defaults/WitnetRadonRegistryDefault.sol similarity index 94% rename from contracts/core/defaults/WitnetRequestBytecodesDefault.sol rename to contracts/core/defaults/WitnetRadonRegistryDefault.sol index 3cadcf95..73a7fd23 100644 --- a/contracts/core/defaults/WitnetRequestBytecodesDefault.sol +++ b/contracts/core/defaults/WitnetRadonRegistryDefault.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.4 <0.9.0; import "../WitnetUpgradableBase.sol"; -import "../../WitnetRequestBytecodes.sol"; +import "../../WitnetRadonRegistry.sol"; import "../../data/WitnetRequestBytecodesData.sol"; import "../../libs/WitnetEncodingLib.sol"; @@ -12,9 +12,9 @@ import "../../libs/WitnetEncodingLib.sol"; /// @dev This contract enables posting requests that Witnet bridges will insert into the Witnet network. /// The result of the requests will be posted back to this contract by the bridge nodes too. /// @author The Witnet Foundation -contract WitnetRequestBytecodesDefault +contract WitnetRadonRegistryDefault is - WitnetRequestBytecodes, + WitnetRadonRegistry, WitnetRequestBytecodesData, WitnetUpgradableBase { @@ -34,10 +34,10 @@ contract WitnetRequestBytecodesDefault virtual override(IWitnetAppliance, WitnetUpgradableBase) returns (string memory) { - return type(WitnetRequestBytecodesDefault).name; + return type(WitnetRadonRegistryDefault).name; } - bytes4 public immutable override specs = type(IWitnetRequestBytecodes).interfaceId; + bytes4 public immutable override specs = type(WitnetRadonRegistry).interfaceId; constructor(bool _upgradable, bytes32 _versionTag) Ownable(address(msg.sender)) @@ -49,7 +49,7 @@ contract WitnetRequestBytecodesDefault {} receive() external payable { - revert("WitnetRequestBytecodes: no transfers"); + revert("WitnetRadonRegistry: no transfers"); } @@ -117,14 +117,14 @@ contract WitnetRequestBytecodesDefault } else { // only owner can initialize: if (msg.sender != _owner) { - revert("WitnetRequestBytecodes: not the owner"); + revert("WitnetRadonRegistry: not the owner"); } } if (__bytecodes().base != address(0)) { // current implementation cannot be initialized more than once: if(__bytecodes().base == base()) { - revert("WitnetRequestBytecodes: already initialized"); + revert("WitnetRadonRegistry: already initialized"); } } __bytecodes().base = base(); @@ -149,7 +149,7 @@ contract WitnetRequestBytecodesDefault // ================================================================================================================ - // --- Implementation of 'IWitnetRequestBytecodes' ----------------------------------------------------------------------- + // --- Implementation of 'IWitnetRadonRegistry' ----------------------------------------------------------------------- function bytecodeOf(bytes32 _radHash) public view @@ -421,12 +421,12 @@ contract WitnetRequestBytecodesDefault // Check that at least one source is provided; if (_retrievalsIds.length == 0) { - revert("WitnetRequestBytecodes: no retrievals"); + revert("WitnetRadonRegistry: no retrievals"); } // Check that number of args arrays matches the number of sources: if ( _retrievalsIds.length != _args.length) { - revert("WitnetRequestBytecodes: args mismatch"); + revert("WitnetRadonRegistry: args mismatch"); } // Check sources and tally reducers: @@ -442,11 +442,11 @@ contract WitnetRequestBytecodesDefault if (_ix == 0) { _resultDataType = _retrievals[0].resultDataType; } else if (_retrievals[_ix].resultDataType != _resultDataType) { - revert("WitnetRequestBytecodes: mismatching retrievals"); + revert("WitnetRadonRegistry: mismatching retrievals"); } // check enough args are provided for each source if (_args[_ix].length < uint(_retrievals[_ix].argsCount)) { - revert("WitnetRequestBytecodes: missing args"); + revert("WitnetRadonRegistry: missing args"); } } @@ -461,7 +461,7 @@ contract WitnetRequestBytecodesDefault _resultMaxSize ); if (_bytecode.length > 65535) { - revert("WitnetRequestBytecodes: too heavy request"); + revert("WitnetRadonRegistry: too heavy request"); } // Calculate radhash and add request metadata and rad bytecode to storage: diff --git a/contracts/core/defaults/WitnetRequestFactoryDefault.sol b/contracts/core/defaults/WitnetRequestFactoryDefault.sol index 07048ca2..2272a411 100644 --- a/contracts/core/defaults/WitnetRequestFactoryDefault.sol +++ b/contracts/core/defaults/WitnetRequestFactoryDefault.sol @@ -4,7 +4,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "../WitnetUpgradableBase.sol"; -import "../../WitnetRequestBytecodes.sol"; +import "../../WitnetRadonRegistry.sol"; import "../../WitnetRequestFactory.sol"; import "../../data/WitnetRequestFactoryData.sol"; import "../../patterns/Clonable.sol"; diff --git a/contracts/data/WitnetOracleDataLib.sol b/contracts/data/WitnetOracleDataLib.sol index 81fa04ae..82a460a5 100644 --- a/contracts/data/WitnetOracleDataLib.sol +++ b/contracts/data/WitnetOracleDataLib.sol @@ -2,7 +2,7 @@ pragma solidity >=0.7.0 <0.9.0; -import "../WitnetRequestBytecodes.sol"; +import "../WitnetRadonRegistry.sol"; import "../libs/Witnet.sol"; /// @title Witnet Request Board base data model library @@ -92,7 +92,7 @@ library WitnetOracleDataLib { // ================================================================================================================ // --- Public functions ------------------------------------------------------------------------------------------- - function extractWitnetDataRequests(WitnetRequestBytecodes registry, uint256[] calldata queryIds) + function extractWitnetDataRequests(WitnetRadonRegistry registry, uint256[] calldata queryIds) public view returns (bytes[] memory bytecodes) { diff --git a/contracts/interfaces/IWitnetFeeds.sol b/contracts/interfaces/IWitnetFeeds.sol index 78fc720e..de32674a 100644 --- a/contracts/interfaces/IWitnetFeeds.sol +++ b/contracts/interfaces/IWitnetFeeds.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.0 <0.9.0; import "../WitnetOracle.sol"; -import "../WitnetRequestBytecodes.sol"; +import "../WitnetRadonRegistry.sol"; interface IWitnetFeeds { diff --git a/contracts/interfaces/IWitnetOracle.sol b/contracts/interfaces/IWitnetOracle.sol index 706bcefc..bc5f6afb 100644 --- a/contracts/interfaces/IWitnetOracle.sol +++ b/contracts/interfaces/IWitnetOracle.sol @@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; import "../libs/Witnet.sol"; -import "../WitnetRequestBytecodes.sol"; +import "../WitnetRadonRegistry.sol"; import "../WitnetRequestFactory.sol"; interface IWitnetOracle { @@ -18,7 +18,7 @@ interface IWitnetOracle { function estimateBaseFee(uint256 gasPrice, uint16 resultMaxSize) external view returns (uint256); /// @notice Estimate the minimum reward required for posting a data request. - /// @dev Fails if the RAD hash was not previously verified on the WitnetRequestBytecodes registry. + /// @dev Fails if the RAD hash was not previously verified on the WitnetRadonRegistry registry. /// @param gasPrice Expected gas price to pay upon posting the data request. /// @param radHash The RAD hash of the data request to be solved by Witnet. function estimateBaseFee(uint256 gasPrice, bytes32 radHash) external view returns (uint256); @@ -29,7 +29,7 @@ interface IWitnetOracle { function estimateBaseFeeWithCallback(uint256 gasPrice, uint24 callbackGasLimit) external view returns (uint256); /// @notice Returns the address of the WitnetRequestFactory appliance capable of building compliant data request - /// @notice templates verified into the same WitnetRequestBytecodes instance returned by registry(). + /// @notice templates verified into the same WitnetRadonRegistry instance returned by registry(). function factory() external view returns (WitnetRequestFactory); /// @notice Retrieves a copy of all Witnet-provable data related to a previously posted request, @@ -84,7 +84,7 @@ interface IWitnetOracle { /// @notice solved by the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be /// @notice transferred to the reporter who relays back the Witnet-provable result to this request. /// @dev Reasons to fail: - /// @dev - the RAD hash was not previously verified by the WitnetRequestBytecodes registry; + /// @dev - the RAD hash was not previously verified by the WitnetRadonRegistry registry; /// @dev - invalid SLA parameters were provided; /// @dev - insufficient value is paid as reward. /// @param queryRAD The RAD hash of the data request to be solved by Witnet. @@ -102,7 +102,7 @@ interface IWitnetOracle { /// @notice will be triggered, and the Witnet audit trail will be saved in storage, but not so the actual CBOR-encoded result. /// @dev Reasons to fail: /// @dev - the caller is not a contract implementing the IWitnetConsumer interface; - /// @dev - the RAD hash was not previously verified by the WitnetRequestBytecodes registry; + /// @dev - the RAD hash was not previously verified by the WitnetRadonRegistry registry; /// @dev - invalid SLA parameters were provided; /// @dev - insufficient value is paid as reward. /// @param queryRAD The RAD hash of the data request to be solved by Witnet. @@ -115,6 +115,13 @@ interface IWitnetOracle { uint24 queryCallbackGasLimit ) external payable returns (uint256 queryId); + function postRequestWithCallbackFrom( + address consumer, + bytes32 queryRAD, + Witnet.RadonSLA calldata querySLA, + uint24 queryCallbackGasLimit + ) external payable returns (uint256 queryId); + /// @notice Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by /// @notice the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the /// @notice reporter who relays back the Witnet-provable result to this request. The Witnet-provable result will be reported @@ -135,10 +142,18 @@ interface IWitnetOracle { uint24 queryCallbackGasLimit ) external payable returns (uint256 queryId); - /// @notice Returns the singleton WitnetRequestBytecodes in which all Witnet-compliant data requests + + function postRequestWithCallback( + address consumer, + bytes calldata queryUnverifiedBytecode, + Witnet.RadonSLA calldata querySLA, + uint24 queryCallbackGasLimit + ) external payable returns (uint256 queryId); + + /// @notice Returns the singleton WitnetRadonRegistry in which all Witnet-compliant data requests /// @notice and templates must be previously verified so they can be passed as reference when /// @notice calling postRequest(bytes32,..) methods. - function registry() external view returns (WitnetRequestBytecodes); + function registry() external view returns (WitnetRadonRegistry); /// @notice Increments the reward of a previously posted request by adding the transaction value to it. /// @param queryId The unique query identifier. diff --git a/contracts/interfaces/IWitnetRadonRegistry.sol b/contracts/interfaces/IWitnetRadonRegistry.sol new file mode 100644 index 00000000..228f253f --- /dev/null +++ b/contracts/interfaces/IWitnetRadonRegistry.sol @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0 <0.9.0; + +import "../libs/Witnet.sol"; + +interface IWitnetRadonRegistry { + + /// Returns the Witnet-compliant RAD bytecode for some Radon Request + /// identified by its unique RAD hash. + function bytecodeOf(bytes32 radHash) external view returns (bytes memory); + + /// Returns the Witnet-compliant DRO bytecode for some data request object + /// made out of the given Radon Request and Radon SLA security parameters. + function bytecodeOf( + bytes32 radHash, + Witnet.RadonSLA calldata sla + ) external view returns (bytes memory); + + /// Returns the Witnet-compliant DRO bytecode for some data request object + /// made out of the given RAD bytecode and Radon SLA security parameters. + function bytecodeOf( + bytes calldata radBytecode, + Witnet.RadonSLA calldata sla + ) external view returns (bytes memory); + + /// Returns the hash of the given Witnet-compliant bytecode. Returned value + /// can be used to trace back in the Witnet blockchain all past resolutions + /// of the given data request payload. + function hashOf(bytes calldata) external view returns (bytes32); + + /// Returns introspective metadata of some previously verified Radon Retrieval + /// (i.e. public data source). Reverts if unknown. + function lookupRadonRetrieval(bytes32 hash) external view returns (Witnet.RadonRetrieval memory); + + /// Returns the number of indexed parameters required to be fulfilled when + /// eventually using the given Radon Retrieval. Reverts if unknown. + function lookupRadonRetrievalArgsCount(bytes32 hash) external view returns (uint8); + + /// Returns the type of the data that would be retrieved by the given Radon Retrieval + /// (i.e. public data source). Reverts if unknown. + function lookupRadonRetrievalDataType(bytes32 hash) external view returns (Witnet.RadonDataTypes); + + /// Returns the Aggregate reducer that is applied to the data extracted from the data sources + /// (i.e. Radon Retrievals) whenever the given Radon Request gets solved on the Witnet blockchain. + /// Reverts if unknown. + function lookupRadonRequestAggregate(bytes32 radHash) external view returns (Witnet.RadonReducer memory); + + /// Returns the deterministic data type returned by successful resolutions of the given Radon Request. + /// Reverts if unknown. + function lookupRadonRequestDataType(bytes32 radHash) external view returns (Witnet.RadonDataTypes); + + /// Returns an array (one or more items) containing the introspective metadata of the given Radon Request's + /// data sources (i.e. Radon Retrievals). Reverts if unknown. + function lookupRadonRequestRetrievals(bytes32 radHash) external view returns (Witnet.RadonRetrieval[] memory); + + /// Returns the Tally reducer that is applied to aggregated values revealed by the witnessing nodes on the + /// Witnet blockchain. Reverts if unknown. + function lookupRadonRequestsTally(bytes32 radHash) external view returns (Witnet.RadonReducer memory); + + /// Verifies and registers the specified Radon Retrieval (i.e. public data source) into this registry contract. + /// Returns a unique retrieval hash that identifies the verified Radon Retrieval. + /// All parameters but the retrieval method are parameterizable by using embedded wildcard \x\ substrings (with x='0'..'9'). + /// Reverts if: + /// - unsupported retrieval method is given; + /// - no URL is provided Http/* requests; + /// - non-empty strings given on RNG reqs. + function verifyRadonRetrieval( + Witnet.RadonRetrievalMethods requestMethod, + string calldata requestURL, + string calldata requestBody, + string[2][] calldata requestHeaders, + bytes calldata requestRadonScript + ) external returns (bytes32 hash); + + /// Verifies and registers the specified Radon Request out of the given data sources (i.e. retrievals), + /// data sources parameters (if required), and the aggregate and tally Radon Reducers. Returns a unique + /// RAD hash that identifies the verified Radon Request. + /// Reverts if: + /// - unverified retrievals are passed; + /// - retrievals return different data types; + /// - ranks of passed args don't match with those required by each given retrieval; + /// - unsupported reducers are passed. + function verifyRadonRequest( + bytes32[] calldata retrievals, + string[][] calldata retrievalsArgs, + Witnet.RadonReducer calldata aggregate, + Witnet.RadonReducer calldata tally + ) external returns (bytes32 radHash); +} diff --git a/contracts/interfaces/IWitnetRadonRegistryEvents.sol b/contracts/interfaces/IWitnetRadonRegistryEvents.sol new file mode 100644 index 00000000..c22822e0 --- /dev/null +++ b/contracts/interfaces/IWitnetRadonRegistryEvents.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; + +import "../libs/Witnet.sol"; + +interface IWitnetRadonRegistryEvents { + + /// Emitted every time a new Radon Retrieval gets successfully verified and + /// stored in the registry. + event NewRadonRetrieval(bytes32 hash, Witnet.RadonRetrieval retrieval); + + /// Emitted every time a new Radon Request gets successfully verified and + /// stored in the registry. + event NewRadonRequest(bytes32 radHash, Witnet.RadonRequest rad); +} diff --git a/contracts/interfaces/IWitnetRequestBytecodes.sol b/contracts/interfaces/IWitnetRadonRegistryLegacy.sol similarity index 67% rename from contracts/interfaces/IWitnetRequestBytecodes.sol rename to contracts/interfaces/IWitnetRadonRegistryLegacy.sol index 558b29ec..d4efd290 100644 --- a/contracts/interfaces/IWitnetRequestBytecodes.sol +++ b/contracts/interfaces/IWitnetRadonRegistryLegacy.sol @@ -1,25 +1,14 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; -import "../libs/WitnetV2.sol"; +import "../libs/Witnet.sol"; -interface IWitnetRequestBytecodes { +interface IWitnetRadonRegistryLegacy { error UnknownRadonRetrieval(bytes32 hash); error UnknownRadonReducer(bytes32 hash); error UnknownRadonRequest(bytes32 hash); - event NewDataProvider(uint256 index); - event NewRadonRetrievalHash(bytes32 hash); - event NewRadonReducerHash(bytes32 hash); - event NewRadHash(bytes32 hash); - - function bytecodeOf(bytes32 radHash) external view returns (bytes memory); - function bytecodeOf(bytes32 radHash, WitnetV2.RadonSLA calldata sla) external view returns (bytes memory); - function bytecodeOf(bytes calldata radBytecode, WitnetV2.RadonSLA calldata sla) external view returns (bytes memory); - - function hashOf(bytes calldata) external view returns (bytes32); - function lookupDataProvider(uint256 index) external view returns (string memory, uint); function lookupDataProviderIndex(string calldata authority) external view returns (uint); function lookupDataProviderSources(uint256 index, uint256 offset, uint256 length) external view returns (bytes32[] memory); @@ -36,14 +25,6 @@ interface IWitnetRequestBytecodes { function lookupRadonRequestSources(bytes32 radHash) external view returns (bytes32[] memory); function lookupRadonRequestSourcesCount(bytes32 radHash) external view returns (uint); function lookupRadonRequestTally(bytes32 radHash) external view returns (Witnet.RadonReducer memory); - - function verifyRadonRetrieval( - Witnet.RadonDataRequestMethods requestMethod, - string calldata requestURL, - string calldata requestBody, - string[2][] calldata requestHeaders, - bytes calldata requestRadonScript - ) external returns (bytes32 hash); function verifyRadonReducer(Witnet.RadonReducer calldata reducer) external returns (bytes32 hash); diff --git a/contracts/interfaces/IWitnetRequestFactoryAppliance.sol b/contracts/interfaces/IWitnetRequestFactoryAppliance.sol index 299f4343..3329e39f 100644 --- a/contracts/interfaces/IWitnetRequestFactoryAppliance.sol +++ b/contracts/interfaces/IWitnetRequestFactoryAppliance.sol @@ -6,9 +6,7 @@ import "../WitnetRequestFactory.sol"; abstract contract IWitnetRequestFactoryAppliance is - IWitnetOracleAppliance, - IWitnetRequestFactoryEvents, - IWitnetRequestRegistryEvents + IWitnetOracleAppliance { function factory() virtual external view returns (WitnetRequestFactory); } From 022945f0e88ccfe5ce000117115638908fe840d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Wed, 31 Jul 2024 14:58:08 +0200 Subject: [PATCH 07/39] refactor: *WitnetRequest* --- contracts/WitnetRequest.sol | 16 ++--- contracts/WitnetRequestTemplate.sol | 36 +++-------- contracts/interfaces/IWitnetRequest.sol | 49 +++++++++++++++ .../interfaces/IWitnetRequestFactory.sol | 61 +++++++++++++++--- .../interfaces/IWitnetRequestTemplate.sol | 63 +++++++++++++++++++ 5 files changed, 179 insertions(+), 46 deletions(-) create mode 100644 contracts/interfaces/IWitnetRequest.sol create mode 100644 contracts/interfaces/IWitnetRequestTemplate.sol diff --git a/contracts/WitnetRequest.sol b/contracts/WitnetRequest.sol index d63ee9f6..a60a8dce 100644 --- a/contracts/WitnetRequest.sol +++ b/contracts/WitnetRequest.sol @@ -3,17 +3,11 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetRequestTemplate.sol"; +import "./interfaces/IWitnetRequest.sol"; +import "./interfaces/IWitnetRequestFactoryAppliance.sol"; abstract contract WitnetRequest is - WitnetRequestTemplate -{ - /// introspection methods - function template() virtual external view returns (WitnetRequestTemplate); - - /// request-exclusive fields - function args() virtual external view returns (string[][] memory); - function bytecode() virtual external view returns (bytes memory); - function radHash() virtual external view returns (bytes32); -} \ No newline at end of file + IWitnetRequestFactoryAppliance, + IWitnetRequest +{} diff --git a/contracts/WitnetRequestTemplate.sol b/contracts/WitnetRequestTemplate.sol index 602fdd3b..be5d0950 100644 --- a/contracts/WitnetRequestTemplate.sol +++ b/contracts/WitnetRequestTemplate.sol @@ -3,33 +3,13 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetRequestBytecodes.sol"; -import "./WitnetOracle.sol"; -import "./WitnetRequestFactory.sol"; +import "./interfaces/IWitnetRequestFactoryAppliance.sol"; +import "./interfaces/IWitnetRequestTemplate.sol"; abstract contract WitnetRequestTemplate -{ - event WitnetRequestBuilt(address indexed request, bytes32 indexed radHash, string[][] args); - - function class() virtual external view returns (string memory); - function factory() virtual external view returns (WitnetRequestFactory); - function registry() virtual external view returns (WitnetRequestBytecodes); - function specs() virtual external view returns (bytes4); - function version() virtual external view returns (string memory); - function witnet() virtual external view returns (WitnetOracle); - - function aggregator() virtual external view returns (bytes32); - function parameterized() virtual external view returns (bool); - function resultDataMaxSize() virtual external view returns (uint16); - function resultDataType() virtual external view returns (Witnet.RadonDataTypes); - function retrievals() virtual external view returns (bytes32[] memory); - function tally() virtual external view returns (bytes32); - - function getRadonAggregator() virtual external view returns (Witnet.RadonReducer memory); - function getRadonRetrievalByIndex(uint256) virtual external view returns (Witnet.RadonRetrieval memory); - function getRadonRetrievalsCount() virtual external view returns (uint256); - function getRadonTally() virtual external view returns (Witnet.RadonReducer memory); - - function buildRequest(string[][] calldata args) virtual external returns (address); - function verifyRadonRequest(string[][] calldata args) virtual external returns (bytes32); -} \ No newline at end of file + is + IWitnetRadonRegistryEvents, + IWitnetRequestFactoryAppliance, + IWitnetRequestFactoryEvents, + IWitnetRequestTemplate +{} diff --git a/contracts/interfaces/IWitnetRequest.sol b/contracts/interfaces/IWitnetRequest.sol new file mode 100644 index 00000000..444a71a4 --- /dev/null +++ b/contracts/interfaces/IWitnetRequest.sol @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; + +import "./IWitnetRequestTemplate.sol"; + +interface IWitnetRequest { + + /// Returns the Witnet-compliant RAD bytecode for the data request (i.e. Radon Request) + /// contained within this WitnetRequest. + function bytecode() external view returns (bytes memory); + + /// Returns the Witnet-compliant RAD hash of the data request (i.e. Radon Request) + /// contained within this WitnetRequest. + function radHash() external view returns (bytes32); + + /// If built out of a WitnetRequestTemplate, returns the array or string values + /// passed as parameters when this WitnetRequest got built. + function getArgs() external view returns (string[][] memory); + + /// Returns the expected data type produced by successful resolutions of the + /// Witnet-compliant data request contained within this WitnetRequest. + function getResultDataType() external view returns (Witnet.RadonDataTypes); + + /// Returns the filters and reducing function to be applied by witnessing nodes + /// on the Witnet blockchain when aggregating data extracted from the public + /// data sources (i.e. Radon Retrievals) as specified within this WitnetRequest. + function getAggregateReducer() external view returns (Witnet.RadonReducer memory); + + /// Returns metadata concerning the data source specified by the given index. + function getRetrievalByIndex(uint256) external view returns (Witnet.RadonRetrieval memory); + + /// Returns the array of one or more data sources (i.e. Radon Retrievals) + /// that compose this WitnetRequest. + function getRetrievals() external view returns (Witnet.RadonRetrieval[] memory); + + /// Returns the slashing filters and reducing function to be applied to the + /// values revealed by the witnessing nodes on the Witnet blockchain that + /// contribute to solve the data request as specified within this WitnetRequest. + function getTallyReducer() external view returns (Witnet.RadonReducer memory); + + /// If built out of a template, returns the address of the WitnetRequestTemplate + /// from which this WitnetRequest instance got built. + function template() external view returns (IWitnetRequestTemplate); + + /// If built out of an upgradable factory, or template, returns the SemVer tag of + /// the actual implementation version at the time when this WitnetRequest got built. + function version() external view returns (string memory); +} diff --git a/contracts/interfaces/IWitnetRequestFactory.sol b/contracts/interfaces/IWitnetRequestFactory.sol index 6a761519..e649d3e0 100644 --- a/contracts/interfaces/IWitnetRequestFactory.sol +++ b/contracts/interfaces/IWitnetRequestFactory.sol @@ -2,14 +2,61 @@ pragma solidity >=0.7.0 <0.9.0; -interface IWitnetRequestFactory { +import "../libs/Witnet.sol"; +interface IWitnetRequestFactory { - function buildRequestTemplate( - bytes32[] memory sourcesIds, - bytes32 aggregatorId, - bytes32 tallyId, - uint16 resultDataMaxSize + /// @notice Builds a Witnet Request instance that will provide the bytecode + /// @notice and RAD hash of some Witnet-compliant data request, provably + /// @notice made out of some previously verified Witnet Radon Retrievals + /// @notice (i.e. data sources), aggregate and tally Witnet Radon Reducers. + /// @dev Reverts if: + /// @dev - unverified retrievals are passed; + /// @dev - any of the given retrievals is parameterized; + /// @dev - retrievals return different data types; + /// @dev - unsupported reducers are passed. + /// @param retrieveHashes Hashes of previously verified data sources. + /// @param aggregate The Radon Reducer to apply on values returned from data sources. + /// @param tally The Radon Reducer to apply on values revealed by witnessing nodes. + function buildWitnetRequest( + bytes32[] calldata retrieveHashes, + Witnet.RadonReducer calldata aggregate, + Witnet.RadonReducer calldata tally + ) external returns (address request); + + /// @notice Builds a Witnet Request Template instance made out of one or more + /// @notice parameterized Witnet Radon Retrievals (i.e. data sources), aggregate + /// @notice and tally Witnet Radon Reducers. + /// @dev Reverts if: + /// @dev - unverified retrievals are passed; + /// @dev - none of given retrievals is parameterized; + /// @dev - retrievals return different data types; + /// @dev - unsupported reducers are passed. + /// @param retrieveHashes Hashes of previously verified data sources. + /// @param aggregate The Radon Reducer to apply on values returned from data sources. + /// @param tally The Radon Reducer to apply on values revealed by witnessing nodes. + function buildWitnetRequestTemplate( + bytes32[] calldata retrieveHashes, + string[][] calldata args, + Witnet.RadonReducer calldata aggregate, + Witnet.RadonReducer calldata tally ) external returns (address template); -} \ No newline at end of file + /// @notice Verifies and registers the specified Witnet Radon Retrieval + /// @notice (i.e. public data sources) into the WitnetRadonRegistry of the + /// @notice WitnetOracle attached to this factory. Returns a hash that uniquely + /// @notice identifies validated data source within the WitnetRadonRegistry. + /// @dev Note: all input parameters but the `requestMethod` are parameterizable + /// @dev by using embedded wildcard `\x\` substrings (being `x='0'..'9'). + /// @dev Reverts if: + /// @dev - unsupported data request method is given; + /// @dev - no URL is provided on Http/* data requests; + /// @dev - non-empty strings given on RNG data requests.. + function verifyWitnetRetrieval( + Witnet.RadonRetrievalMethods requestMethod, + string calldata requestURL, + string calldata requestBody, + string[2][] calldata requestHeaders, + bytes calldata requestRadonScript + ) external returns (bytes32 retrievalHash); +} diff --git a/contracts/interfaces/IWitnetRequestTemplate.sol b/contracts/interfaces/IWitnetRequestTemplate.sol new file mode 100644 index 00000000..d09f6baa --- /dev/null +++ b/contracts/interfaces/IWitnetRequestTemplate.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; + +import "../libs/Witnet.sol"; + +interface IWitnetRequestTemplate { + /// Build a WitnetRequest instance that will provide the bytecode and RAD + /// hash of some Witnet-compliant Radon Request, provably made out of the + /// data sources, aggregate and tally Radon Reducers that compose this WitnetRequestTemplate. + /// Produced addresses are counter-factual to the given values. + /// Reverts if: + /// - the ranks of passed array don't match either the number of this template's + /// data sources, or the number of required parameters by each one of those. + function buildWitnetRequest (string[][] calldata args) external returns (address); + + /// Returns an array of integers telling the number of parameters required + /// by every single data source (i.e. Radon Retrievals) that compose this + /// WitnetRequestTemplate. The length of the returned array tells the number + /// of data sources that compose this instance. + function getArgsCount() external view returns (uint256[] memory); + + /// Returns the expected data type produced by successful resolutions of + /// any WitnetRequest that gets built out of this WitnetRequestTemplate. + function getResultDataType() external view returns (Witnet.RadonDataTypes); + + /// Returns the filters and reducing function to be applied by witnessing + /// nodes on the Witnet blockchain when aggregating data extracted from + /// the public data sources (i.e. Radon Retrievals) of the data requests + /// that get eventually built out of this WitnetRequestTemplate. + function getAggregateReducer() external view returns (Witnet.RadonReducer memory); + + /// Returns metadata concerning the data source specified by the given index. + function getRetrievalByIndex(uint256) external view returns (Witnet.RadonRetrieval memory); + + /// Returns the array of one or more parameterized data sources that compose + /// this WitnetRequestTemplate. + function getRetrievals() external view returns (Witnet.RadonRetrieval[] memory); + + /// Returns the slashing filters and reducing function to be applied to the + /// values revealed by the witnessing nodes on the Witnet blockchain that + /// contribute to solve data requests built out of this WitnetRequestTemplate. + function getTallyReducer() external view returns (Witnet.RadonReducer memory); + + /// Verifies into the bounded WitnetOracle's registry the actual bytecode + /// and RAD hash of the Witnet-compliant Radon Request that gets provably + /// made out of the data sources, aggregate and tally Radon Reducers that + /// compose this WitnetRequestTemplate. While no WitnetRequest instance is + /// actually constructed, the returned value will be accepted as a valid + /// RAD hash on the witnet() contract from now on. + /// Reverts if: + /// - the ranks of passed array don't match either the number of this + /// template's data sources, or the number of required parameters by + /// each one of those. + /// @dev This method requires less gas than buildWitnetRequest(string[][]), and + /// it's usually preferred when parameterized data requests made out of this + /// template are intended to be used just once in lifetime. + function verifyWitnetRequest(string[][] calldata args) external returns (bytes32); + + /// If built out of an upgradable factory, returns the SemVer tag of the + /// factory implementation at the time when this WitnetRequestTemplate got built. + function version() external view returns (string memory); +} From 2c263976b9ec21c2265b5ccbd2da5bf6e25d5f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Thu, 1 Aug 2024 10:11:09 +0200 Subject: [PATCH 08/39] refactor: specs() calculation --- contracts/apps/UsingWitnet.sol | 2 +- contracts/apps/WitnetRandomnessV2.sol | 2 +- contracts/core/defaults/WitnetOracleTrustableBase.sol | 1 + contracts/core/defaults/WitnetPriceFeedsDefault.sol | 2 +- contracts/core/defaults/WitnetRequestFactoryDefault.sol | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/contracts/apps/UsingWitnet.sol b/contracts/apps/UsingWitnet.sol index 008ab22f..b5ff836b 100644 --- a/contracts/apps/UsingWitnet.sol +++ b/contracts/apps/UsingWitnet.sol @@ -28,7 +28,7 @@ abstract contract UsingWitnet /// @param _wrb Address of the WitnetOracle contract. constructor(WitnetOracle _wrb) { require( - _wrb.specs() == type(IWitnetOracle).interfaceId, + _wrb.specs() == type(WitnetOracle).interfaceId, "UsingWitnet: uncompliant WitnetOracle" ); __witnet = _wrb; diff --git a/contracts/apps/WitnetRandomnessV2.sol b/contracts/apps/WitnetRandomnessV2.sol index 7edc1bca..e1f5c352 100644 --- a/contracts/apps/WitnetRandomnessV2.sol +++ b/contracts/apps/WitnetRandomnessV2.sol @@ -44,7 +44,7 @@ contract WitnetRandomnessV2 { _require( address(_witnet) == address(0) - || _witnet.specs() == type(IWitnetOracle).interfaceId, + || _witnet.specs() == type(WitnetOracle).interfaceId, "uncompliant WitnetOracle" ); WitnetRequestBytecodes _registry = witnet().registry(); diff --git a/contracts/core/defaults/WitnetOracleTrustableBase.sol b/contracts/core/defaults/WitnetOracleTrustableBase.sol index c43f2f1a..ecaf6a3d 100644 --- a/contracts/core/defaults/WitnetOracleTrustableBase.sol +++ b/contracts/core/defaults/WitnetOracleTrustableBase.sol @@ -32,6 +32,7 @@ abstract contract WitnetOracleTrustableBase using Witnet for Witnet.RadonSLA; using Witnet for Witnet.Request; using Witnet for Witnet.Response; + bytes4 public immutable override specs = type(WitnetOracle).interfaceId; function channel() virtual override public view returns (bytes4) { return bytes4(keccak256(abi.encode(address(this), block.chainid))); diff --git a/contracts/core/defaults/WitnetPriceFeedsDefault.sol b/contracts/core/defaults/WitnetPriceFeedsDefault.sol index 45650a0b..9cd29203 100644 --- a/contracts/core/defaults/WitnetPriceFeedsDefault.sol +++ b/contracts/core/defaults/WitnetPriceFeedsDefault.sol @@ -35,7 +35,7 @@ contract WitnetPriceFeedsDefault return type(WitnetPriceFeedsDefault).name; } - bytes4 immutable public override specs = type(IWitnetPriceFeeds).interfaceId; + bytes4 immutable public override specs = type(WitnetPriceFeeds).interfaceId; WitnetOracle immutable public override witnet; Witnet.RadonSLA private __defaultRadonSLA; diff --git a/contracts/core/defaults/WitnetRequestFactoryDefault.sol b/contracts/core/defaults/WitnetRequestFactoryDefault.sol index 2272a411..00c0aab1 100644 --- a/contracts/core/defaults/WitnetRequestFactoryDefault.sol +++ b/contracts/core/defaults/WitnetRequestFactoryDefault.sol @@ -308,7 +308,7 @@ contract WitnetRequestFactoryDefault __proxiable().implementation = base(); require(address(registry).code.length > 0, "WitnetRequestFactory: inexistent requests registry"); - require(registry.specs() == type(IWitnetRequestBytecodes).interfaceId, "WitnetRequestFactory: uncompliant requests registry"); + require(registry.specs() == type(WitnetRadonRegistry).interfaceId, "WitnetRequestFactory: uncompliant requests registry"); emit Upgraded(msg.sender, base(), codehash(), version()); } From 4613f736b9af1d5a91ec54f4d20ca9b301298c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Thu, 1 Aug 2024 10:14:08 +0200 Subject: [PATCH 09/39] refactor: *RequestBytecodes* -> *RadonRegistry* on scripts --- migrations/addresses.json | 114 ++++++++++++++++---------------- migrations/constructorArgs.json | 58 ++++++++-------- migrations/scripts/3_core.js | 14 ++-- migrations/scripts/4_proxies.js | 2 +- scripts/verify-core.js | 2 +- scripts/verify-impls.js | 2 +- settings/artifacts.js | 12 ++-- settings/specs.js | 6 +- src/index.js | 2 +- test/witnet_bytecodes.test.js | 22 +++--- 10 files changed, 118 insertions(+), 116 deletions(-) diff --git a/migrations/addresses.json b/migrations/addresses.json index 29e6f937..1bdb7996 100644 --- a/migrations/addresses.json +++ b/migrations/addresses.json @@ -5,7 +5,7 @@ "WitnetProxy": "0xaC3E870BF8D13Dc39f76936b6AF8279eF5a9211F", "WitnetPriceFeeds": "0x1111AbA2164AcdC6D291b08DfB374280035E1111", "WitnetRandomnessV2": "0xC0FFEE98AD1434aCbDB894BbB752e138c1006fAB", - "WitnetRequestBytecodes": "0x000B61Fe075F545fd37767f40391658275900000", + "WitnetRadonRegistry": "0x000B61Fe075F545fd37767f40391658275900000", "WitnetRequestFactory": "0x000DB36997AF1F02209A6F995883B9B699900000" }, "arbitrum:one": { @@ -13,7 +13,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -25,7 +25,7 @@ "WitnetOracleTrustableDefault": "0x85cd7aaF5248fC0568B003EF24FB2a5329C95c28", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x682A7dF2852F3Df2d3B4b84803da69A38ba33180", - "WitnetRequestBytecodesDefault": "0x03604d41a0289cb9325814A6aCA8BaBEf7492B44", + "WitnetRadonRegistryDefault": "0x03604d41a0289cb9325814A6aCA8BaBEf7492B44", "WitnetRequestFactoryDefault": "0x90a7Fc875dac0D453b43BF9E5AeE7dC68091CC24" }, "avalanche:mainnet": { @@ -33,7 +33,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -45,7 +45,7 @@ "WitnetOracleTrustableDefault": "0x5B354083da3c7D034b8b95bE96aC5d114CcdA71f", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "base:sepolia": { @@ -55,7 +55,7 @@ "WitnetOracleTrustableOvm2": "0x9F02CD498b47B928c5a12FdC7cEa36246d27a638", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0xcB61b81a775E56e9Ec8884d2E13352d668294141", - "WitnetRequestBytecodesDefault": "0x730a88594d8287Ec898b2B7fE592aB155bE71590", + "WitnetRadonRegistryDefault": "0x730a88594d8287Ec898b2B7fE592aB155bE71590", "WitnetRequestFactoryDefault": "0xe1CDE456D3eC92640711625E01170A6800773b91" }, "base:mainnet": { @@ -63,7 +63,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -73,7 +73,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0x0D929cFfa089cA99a644E10A7c7fe1C8C62F657f", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -83,7 +83,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x4e6159Aa6c94584Af01Ccc828200c79D350D07E9", + "WitnetRadonRegistryDefault": "0x4e6159Aa6c94584Af01Ccc828200c79D350D07E9", "WitnetRequestFactoryDefault": "0xFbb35731Fd5c35a84176aBccD214538843eAf5db", "WitnetRequestBoardTrustableOvm": "0xA126d29b0803CD0536c5487C831Daf9cB634318D", "WitnetOracleTrustableOvm2": "0xA126d29b0803CD0536c5487C831Daf9cB634318D", @@ -94,7 +94,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -106,7 +106,7 @@ "WitnetOracleTrustableDefault": "", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "celo:mainnet": { @@ -116,7 +116,7 @@ "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04" }, "conflux:core:mainnet": { @@ -126,11 +126,11 @@ "WitnetEncodingLib": "0x80Ea106BE90aB7b4FCac2b3D4aCe4Ea262918188", "WitnetPriceFeedsLib": "0x8Ac628741A0983869d237AF759f39a553aE91e47", "WitnetOracleDataLib": "0x81cfB91911F6C8fa582033149582a63EBa39D0D3", - "WitnetRequestBytecodesDefault": "0x8C6cC510195f2B53abC65340346843Df91F6B940", + "WitnetRadonRegistryDefault": "0x8C6cC510195f2B53abC65340346843Df91F6B940", "WitnetRequestFactoryCfxCore": "0x839d58dE8F143bC01549A7FD62fd508BCA922C8d", "WitnetOracleTrustableDefault": "0x8E6Ddf8bA76350A5fde230a05fc58559A90B878D", "WitnetPriceFeedsDefault": "0x8af4262e9ECb7320a9ffdEe366172EAeA1D60e91", - "WitnetRequestBytecodes": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", + "WitnetRadonRegistry": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", "WitnetRequestFactory": "0x8daDc231C8C810CBbe2d555338bDa94DA648f964", "WitnetOracle": "0x8346D6ba3b7a04923492007cC3A2eE7135Db7463", "WitnetPriceFeeds": "0x8ba3C59e1029cd90010e8C731461ddFC5f49091b", @@ -148,8 +148,8 @@ "WitnetPriceFeedsLib": "0x8Ac628741A0983869d237AF759f39a553aE91e47", "WitnetPriceFeedsDefault": "0x80050098a4fdd72409D6C8Ec72FD50ca460349E9", "WitnetRandomnessV2": "0x897832C89ec306A74f9eC29abfFcaDBfCb11A13B", - "WitnetRequestBytecodes": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", - "WitnetRequestBytecodesDefault": "0x8176457C9620E8bb508aA22062E1967726179Cc9", + "WitnetRadonRegistry": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", + "WitnetRadonRegistryDefault": "0x8176457C9620E8bb508aA22062E1967726179Cc9", "WitnetRequestFactory": "0x8daDc231C8C810CBbe2d555338bDa94DA648f964", "WitnetRequestFactoryCfxCore": "0x8E10530323e534d953D7EC83e075eCAbB38079d8" }, @@ -158,7 +158,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -170,7 +170,7 @@ "WitnetOracleTrustableDefault": "0x1B9D8186e901b6ED7848374e81B79C9eBf74801E", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "cronos:mainnet": { @@ -178,7 +178,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -190,7 +190,7 @@ "WitnetOracleTrustableDefault": "0x44C4C71c31aD14dB5B18520D3801B88aA26427B0", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "dogechain:mainnet": { @@ -198,7 +198,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -208,7 +208,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -220,7 +220,7 @@ "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "ethereum:mainnet": { @@ -228,7 +228,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x751F77190Ce6212899D5848334838D56CF7eEe91", "WitnetOracleDataLib": "0xE89dc301AEe78917018039FEBE72f9FE5aB730D9", - "WitnetRequestBytecodesDefault": "0x4a2f2b2E137DD7D4a61389E07c935B14a562078d", + "WitnetRadonRegistryDefault": "0x4a2f2b2E137DD7D4a61389E07c935B14a562078d", "WitnetRequestFactoryDefault": "0x1a5cc6DeE6c7d873639e3eF49678b581f459bBa1", "WitnetOracleTrustableDefault": "0x7084a8C12100cDBB1995aa1B0393A83A0B868837", "WitnetPriceFeedsDefault": "0xC815f56cC791E41a11DB3f0D2880AdB10316fca6" @@ -241,7 +241,7 @@ "WitnetOracleTrustableDefault": "0xE790FdaEa7f1f4C4Bbd74B3493Cf94E79b24396a", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x327470b70d0cCF47cB89a1f3475DE23Ac2437c9e", - "WitnetRequestBytecodesDefault": "0x34e6465f23aE086e5701A6ca8547aF7c29e0283C", + "WitnetRadonRegistryDefault": "0x34e6465f23aE086e5701A6ca8547aF7c29e0283C", "WitnetRequestFactoryDefault": "0x1869A7137dF26397999AA6DB90c7D6D029d13908" }, "gnosis:testnet": { @@ -251,7 +251,7 @@ "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "kava:mainnet": { @@ -259,7 +259,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -271,7 +271,7 @@ "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "kcc:mainnet": { @@ -279,7 +279,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -291,7 +291,7 @@ "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "klaytn:mainnet": { @@ -299,7 +299,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -311,7 +311,7 @@ "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "mantle:mainnet": { @@ -319,7 +319,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -331,7 +331,7 @@ "WitnetOracleTrustableOvm2": "0x8423ddeb7d86Ce43a9C643bE3A420Ff69825Dd53", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x853DDf69DbEaDA2fc4A521a1dBA5Beb210a5c4d2", - "WitnetRequestBytecodesDefault": "0xD1960cdC1593Bb9CA75263266dAB75EE33163187", + "WitnetRadonRegistryDefault": "0xD1960cdC1593Bb9CA75263266dAB75EE33163187", "WitnetRequestFactoryDefault": "0x9ef37BF321828AD49F3D31Fd9Cd36921ee317190" }, "metis:sepolia": { @@ -341,7 +341,7 @@ "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "meter:mainnet": { @@ -351,11 +351,11 @@ "WitnetEncodingLib": "0xfa52abc94415A334F6C846CA018290CE2755B13D", "WitnetPriceFeedsLib": "0xBD9Ec958409eC6FbaF4d833F7Ea4e3892A406c98", "WitnetOracleDataLib": "0x70d501E01d0EE71F8DD3e533849F5fc454359d6F", - "WitnetRequestBytecodesDefault": "0x14D3AAD34a7aB614Feaf72cc0eAab120E64d032F", + "WitnetRadonRegistryDefault": "0x14D3AAD34a7aB614Feaf72cc0eAab120E64d032F", "WitnetRequestFactoryCfxCore": "0x6Ee46D8db750607ffa5Ec3Eb0DAE969E1916F417", "WitnetOracleTrustableDefault": "0xB11b58238BAf7CBBb608C81e7792cEA29e4E19D0", "WitnetPriceFeedsDefault": "0x7e701068365CFF4f217A32be8059550d8aEdc00D", - "WitnetRequestBytecodes": "0xBa84D2ffA26c8fC7EF2c5Bd4839B4b2E4d56D330", + "WitnetRadonRegistry": "0xBa84D2ffA26c8fC7EF2c5Bd4839B4b2E4d56D330", "WitnetRequestFactory": "0xc5074dde3FEA0347d3B2E8C38e58e6A34FeEf8EF", "WitnetOracle": "0x1f28E4d955eccE989c00b3871446AB22B3Fa9Cc8", "WitnetPriceFeeds": "0x27EF7A3e155F96e68A9988EAdBF8bd3eFdba1438", @@ -368,11 +368,11 @@ "WitnetEncodingLib": "0xA4c9D0f1DE84D190a0478FD9226Ec201Daf509E2", "WitnetPriceFeedsLib": "0x75cC6DA115846D1E577F5C5D5566BD2C15D5d198", "WitnetOracleDataLib": "0xCc0444d867188796254141220744BdfE9Ef6d742", - "WitnetRequestBytecodesDefault": "0x8e1EDea211ed85316Bc7F115972C995b5fA897aF", + "WitnetRadonRegistryDefault": "0x8e1EDea211ed85316Bc7F115972C995b5fA897aF", "WitnetRequestFactoryDefault": "0xC69640F34267C5B9F58f716d1385A481D7dff10D", "WitnetOracleTrustableDefault": "0xb7dd2cD53790a5D87f5cfD265D3bD889ed5FC28d", "WitnetPriceFeedsDefault": "0x89eE40cfb4F7D9f56Ee2E2E9B1580176361D84eC", - "WitnetRequestBytecodes": "0x87E25Ad751306b21F9345494F163122e057B7b53", + "WitnetRadonRegistry": "0x87E25Ad751306b21F9345494F163122e057B7b53", "WitnetRequestFactory": "0xd0b4512F4c9291de4104a1ad7be0c51956044bbC", "WitnetOracle": "0x51e12A16d52DE519f7b13bFeDa42Fb61214d32a0", "WitnetPriceFeeds": "0xD9f5Af15288294678B0863A20F4B83eeeEAa775C", @@ -384,7 +384,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -396,7 +396,7 @@ "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "moonbeam:moonriver": { @@ -404,7 +404,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -416,7 +416,7 @@ "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "okx:x1:sepolia": { @@ -426,7 +426,7 @@ "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", + "WitnetRadonRegistryNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "optimism:mainnet": { @@ -437,7 +437,7 @@ "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04" }, "optimism:sepolia": { @@ -448,7 +448,7 @@ "WitnetOracleTrustableOvm2": "0xc1C158e77A91da158a1A2D0c2A154c68a8C7c0d2", "WitnetPriceFeedsLib": "0x85aa4A0fDa112c47d4216448EE4D49Afd072675e", "WitnetPriceFeedsDefault": "0xA936f7F4909494Ea1F7D898C2759b2324912153d", - "WitnetRequestBytecodesDefault": "0x2D8BCBC4F8c97CC227e770d95d19914324baBF2A", + "WitnetRadonRegistryDefault": "0x2D8BCBC4F8c97CC227e770d95d19914324baBF2A", "WitnetRequestFactoryDefault": "0x3D551165020a4014A8d5b9E4b73D2b3Dbe401546" }, "polygon:amoy": { @@ -458,7 +458,7 @@ "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "polygon:mainnet": { @@ -466,7 +466,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -476,7 +476,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", + "WitnetRadonRegistryNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -488,11 +488,11 @@ "WitnetEncodingLib": "0x416c6e7ff66868375cFF36bA87B8eCBB2CF2Fb08", "WitnetPriceFeedsLib": "0xcaa6dE265EF1545788E9576660Bc6d5ae1Edb0F5", "WitnetOracleDataLib": "0x6F65a0110a2D2Af299a73a4C169CC3d2C41Be505", - "WitnetRequestBytecodesDefault": "", + "WitnetRadonRegistryDefault": "0x1A80B677A9dd6a6762273593FE2797927c4010A4", "WitnetRequestFactoryDefault": "0x71E2e26E5EfF3C05935A497282Fe018963b78F55", "WitnetOracleTrustableReef": "0x7950250D3d2ae1636a7Ca2a8A6ba53e46D1cB573", "WitnetPriceFeedsDefault": "0x8af56567C7F0Deaf8979244d83194816a6ED144F", - "WitnetRequestBytecodes": "0xC4b7a5aD8BAF8fea9DbeB18aB6F77cdf54CF297a", + "WitnetRadonRegistry": "0xC4b7a5aD8BAF8fea9DbeB18aB6F77cdf54CF297a", "WitnetRequestFactory": "0xEBa788A5de67E4B11869558a2414247e8Aa62179", "WitnetOracle": "0x604b98893335CEf7Dc40061731F40aC5C6239907", "WitnetPriceFeeds": "0xA9991dCd62a863f0F0aabF95a6a252d132b5c8D4", @@ -504,7 +504,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", + "WitnetRadonRegistryNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -516,7 +516,7 @@ "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", + "WitnetRadonRegistryNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "syscoin:rollux:testnet": { @@ -524,7 +524,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773", "WitnetOracleTrustableOvm2": "0x9Bd67787019a6474ddE27f9c9A37260c87Da92B5", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" @@ -537,7 +537,7 @@ "WitnetOracleTrustableObscuro": "0x2330f492635c2E7476bB2A3162e69129F6FEaB56", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "ultron:mainnet": { @@ -545,7 +545,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" @@ -555,7 +555,7 @@ "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRequestBytecodesDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" diff --git a/migrations/constructorArgs.json b/migrations/constructorArgs.json index edfdd026..8e4dc30f 100644 --- a/migrations/constructorArgs.json +++ b/migrations/constructorArgs.json @@ -4,41 +4,41 @@ "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31322d61653734633030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRandomnessV2": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000f121b71715e71dded592f1125a06d4ed06f0694d", - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", - "WitnetRequestBytecodesNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" }, "arbitrum:one": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "avalanche:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "base:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "boba:bnb:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "boba:bnb:testnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "boba:eth:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" @@ -47,13 +47,13 @@ "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64383461343832000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "celo:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "conflux:core:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryCfxCore": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db746300000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "0000000000000000000000008dadc231c8c810cbbe2d555338bda94da648f96400000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", @@ -66,7 +66,7 @@ "WitnetRandomnessV2": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000001169bf81ecf738d02fd8d3824dfe02153b334ef7" }, "conflux:espace:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" @@ -75,31 +75,31 @@ "WitnetRequestFactoryCfxCore": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" }, "cronos:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "dogechain:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "elastos:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "ethereum:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000" }, "kava:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" @@ -108,7 +108,7 @@ "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "kcc:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" @@ -117,7 +117,7 @@ "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "klaytn:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" @@ -126,13 +126,13 @@ "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "mantle:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "meter:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryCfxCore": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc8000000000000000000000000ba84d2ffa26c8fc7ef2c5bd4839b4b2e4d56d3300000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000c5074dde3fea0347d3b2e8c38e58e6a34feef8ef000000000000000000000000ba84d2ffa26c8fc7ef2c5bd4839b4b2e4d56d3300000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc80000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", @@ -149,38 +149,40 @@ "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "moonbeam:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "moonbeam:moonriver": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "optimism:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "polygon:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "polygon:zkevm:mainnet": { - "WitnetRequestBytecodesNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, - "reef:mainnet": {}, + "reef:mainnet": { + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d34333966396166000000000000000000000000000000000000" + }, "scroll:mainnet": { - "WitnetRequestBytecodesNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" @@ -192,7 +194,7 @@ "WitnetOracleTrustableObscuro": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "ultron:mainnet": { - "WitnetRequestBytecodesDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" diff --git a/migrations/scripts/3_core.js b/migrations/scripts/3_core.js index 6d2ba98a..8db060f4 100644 --- a/migrations/scripts/3_core.js +++ b/migrations/scripts/3_core.js @@ -14,15 +14,15 @@ module.exports = async function (_, network, [, from]) { const targets = settings.getArtifacts(network) // ========================================================================== - // --- WitnetRequestBytecodes core implementation --------------------------- + // --- WitnetRadonRegistry core implementation --------------------------- await deploy({ network, targets, - from: utils.isDryRun(network) ? from : specs.WitnetRequestBytecodes.from || from, - key: targets.WitnetRequestBytecodes, - libs: specs.WitnetRequestBytecodes.libs, - immutables: specs.WitnetRequestBytecodes.immutables, + from: utils.isDryRun(network) ? from : specs.WitnetRadonRegistry.from || from, + key: targets.WitnetRadonRegistry, + libs: specs.WitnetRadonRegistry.libs, + immutables: specs.WitnetRadonRegistry.immutables, intrinsics: { types: ["bool", "bytes32"], values: [ @@ -46,7 +46,7 @@ module.exports = async function (_, network, [, from]) { types: ["address", "address", "bool", "bytes32"], values: [ /* _witnet */ await determineProxyAddr(from, specs.WitnetOracle?.vanity || 3), - /* _registry */ await determineProxyAddr(from, specs.WitnetRequestBytecodes?.vanity || 1), + /* _registry */ await determineProxyAddr(from, specs.WitnetRadonRegistry?.vanity || 1), /* _upgradable */ true, /* _versionTag */ utils.fromAscii(version), ], @@ -67,7 +67,7 @@ module.exports = async function (_, network, [, from]) { types: ["address", "address", "bool", "bytes32"], values: [ /* _factory */ await determineProxyAddr(from, specs.WitnetRequestFactory?.vanity || 2), - /* _registry */ await determineProxyAddr(from, specs.WitnetRequestBytecodes?.vanity || 1), + /* _registry */ await determineProxyAddr(from, specs.WitnetRadonRegistry?.vanity || 1), /* _upgradable */ true, /* _versionTag */ utils.fromAscii(version), ], diff --git a/migrations/scripts/4_proxies.js b/migrations/scripts/4_proxies.js index 40e0c528..2c461dc8 100644 --- a/migrations/scripts/4_proxies.js +++ b/migrations/scripts/4_proxies.js @@ -17,7 +17,7 @@ module.exports = async function (_, network, [, from, reporter]) { const specs = settings.getSpecs(network) const singletons = [ - "WitnetRequestBytecodes", + "WitnetRadonRegistry", "WitnetRequestFactory", "WitnetOracle", "WitnetPriceFeeds", diff --git a/scripts/verify-core.js b/scripts/verify-core.js index 9858ab3c..b89fe4cf 100644 --- a/scripts/verify-core.js +++ b/scripts/verify-core.js @@ -23,7 +23,7 @@ const addresses = require("../migrations/addresses.json") const singletons = [ "WitnetOracle", "WitnetPriceFeeds", - "WitnetRequestBytecodes", + "WitnetRadonRegistry", "WitnetRequestFactory", ] for (const index in singletons) { diff --git a/scripts/verify-impls.js b/scripts/verify-impls.js index 47317a7b..33fd4160 100644 --- a/scripts/verify-impls.js +++ b/scripts/verify-impls.js @@ -20,7 +20,7 @@ const artifacts = settings.getArtifacts(network) const impls = [ artifacts.WitnetOracle, artifacts.WitnetPriceFeeds, - artifacts.WitnetRequestBytecodes, + artifacts.WitnetRadonRegistry, artifacts.WitnetRequestFactory, ] const constructorArgs = require("../migrations/constructorArgs.json") diff --git a/settings/artifacts.js b/settings/artifacts.js index 0fcceffb..89ba850d 100644 --- a/settings/artifacts.js +++ b/settings/artifacts.js @@ -4,7 +4,7 @@ module.exports = { WitnetOracle: "WitnetOracleTrustableDefault", WitnetPriceFeeds: "WitnetPriceFeedsDefault", WitnetRandomness: "WitnetRandomnessV2", - WitnetRequestBytecodes: "WitnetRequestBytecodesDefault", + WitnetRadonRegistry: "WitnetRadonRegistryDefault", WitnetRequestFactory: "WitnetRequestFactoryDefault", WitnetEncodingLib: "WitnetEncodingLib", WitnetErrorsLib: "WitnetErrorsLib", @@ -36,22 +36,22 @@ module.exports = { WitnetOracle: "WitnetOracleTrustableOvm2", }, "okx:x1:mainnet": { - WitnetRequestBytecodes: "WitnetRequestBytecodesNoSha256", + WitnetRadonRegistry: "WitnetRadonRegistryNoSha256", }, "okx:x1:sepolia": { - WitnetRequestBytecodes: "WitnetRequestBytecodesNoSha256", + WitnetRadonRegistry: "WitnetRadonRegistryNoSha256", }, "polygon:zkevm:goerli": { - WitnetRequestBytecodes: "WitnetRequestBytecodesNoSha256", + WitnetRadonRegistry: "WitnetRadonRegistryNoSha256", }, "polygon:zkevm:mainnet": { - WitnetRequestBytecodes: "WitnetRequestBytecodesNoSha256", + WitnetRadonRegistry: "WitnetRadonRegistryNoSha256", }, reef: { WitnetOracle: "WitnetOracleTrustableReef", }, scroll: { - WitnetRequestBytecodes: "WitnetRequestBytecodesNoSha256", + WitnetRadonRegistry: "WitnetRadonRegistryNoSha256", }, "syscoin:rollux:testnet": { WitnetOracle: "WitnetOracleTrustableOvm2", diff --git a/settings/specs.js b/settings/specs.js index 4ad23d86..2c2b344d 100644 --- a/settings/specs.js +++ b/settings/specs.js @@ -22,7 +22,7 @@ module.exports = { from: "0xF121b71715E71DDeD592F1125a06D4ED06F0694D", vanity: 1060132513, // 0xC0FFEE98AD1434aCbDB894BbB752e138c1006fAB }, - WitnetRequestBytecodes: { + WitnetRadonRegistry: { libs: ["WitnetEncodingLib"], vanity: 6765579443, // 0x000B61Fe075F545fd37767f40391658275900000 }, @@ -45,7 +45,7 @@ module.exports = { from: "0x1169bf81ecf738d02fd8d3824dfe02153b334ef7", vanity: 5, }, - WitnetRequestBytecodes: { + WitnetRadonRegistry: { vanity: 1, }, WitnetRequestFactory: { @@ -67,7 +67,7 @@ module.exports = { from: "0x1169Bf81ecf738d02fd8d3824dfe02153B334eF7", vanity: 5, }, - WitnetRequestBytecodes: { + WitnetRadonRegistry: { vanity: 1, }, WitnetRequestFactory: { diff --git a/src/index.js b/src/index.js index a69152a1..f14dad0b 100644 --- a/src/index.js +++ b/src/index.js @@ -36,7 +36,7 @@ module.exports = { WitnetPriceRouteSolver: require("../artifacts/contracts/interfaces/IWitnetPriceSolver.sol/IWitnetPriceSolver.json"), WitnetRandomness: require("../artifacts/contracts/WitnetRandomness.sol/WitnetRandomness.json"), WitnetRequest: require("../artifacts/contracts/WitnetRequest.sol/WitnetRequest.json"), - WitnetRequestBytecodes: require("../artifacts/contracts/WitnetRequestBytecodes.sol/WitnetRequestBytecodes.json"), + WitnetRadonRegistry: require("../artifacts/contracts/WitnetRadonRegistry.sol/WitnetRadonRegistry.json"), WitnetRequestFactory: require("../artifacts/contracts/WitnetRequestFactory.sol/WitnetRequestFactory.json"), WitnetRequestTemplate: require("../artifacts/contracts/WitnetRequestTemplate.sol/WitnetRequestTemplate.json"), WitnetUpgradableBase: require("../artifacts/contracts/core/WitnetUpgradableBase.sol/WitnetUpgradableBase.json"), diff --git a/test/witnet_bytecodes.test.js b/test/witnet_bytecodes.test.js index 60653abe..0aae5227 100644 --- a/test/witnet_bytecodes.test.js +++ b/test/witnet_bytecodes.test.js @@ -3,11 +3,11 @@ const { expectEvent, expectRevert } = require("@openzeppelin/test-helpers") const { assert } = require("chai") const { expectRevertCustomError } = require("custom-error-test-helper") -const WitnetRequestBytecodes = artifacts.require("WitnetRequestBytecodesDefault") +const WitnetRadonRegistry = artifacts.require("WitnetRadonRegistryDefault") const WitnetEncodingLib = artifacts.require("WitnetEncodingLib") const Witnet = artifacts.require("Witnet") -contract("WitnetRequestBytecodes", (accounts) => { +contract("WitnetRadonRegistry", (accounts) => { const creatorAddress = accounts[0] const firstOwnerAddress = accounts[1] const unprivilegedAddress = accounts[4] @@ -15,8 +15,8 @@ contract("WitnetRequestBytecodes", (accounts) => { let bytecodes before(async () => { - await WitnetRequestBytecodes.link(WitnetEncodingLib, WitnetEncodingLib.address) - bytecodes = await WitnetRequestBytecodes.new( + await WitnetRadonRegistry.link(WitnetEncodingLib, WitnetEncodingLib.address) + bytecodes = await WitnetRadonRegistry.new( true, utils.fromAscii("testing") ) @@ -76,19 +76,19 @@ contract("WitnetRequestBytecodes", (accounts) => { }) it("cannot be initialized more than once", async () => { await expectRevertCustomError( - WitnetRequestBytecodes, + WitnetRadonRegistry, bytecodes.initialize("0x", { from: firstOwnerAddress }), "AlreadyUpgraded" ) await expectRevertCustomError( - WitnetRequestBytecodes, + WitnetRadonRegistry, bytecodes.initialize("0x", { from: unprivilegedAddress }), "OnlyOwner" ) }) }) - context("IWitnetRequestBytecodes", async () => { + context("IWitnetRadonRegistry", async () => { let slaHash let concathashReducerHash @@ -658,7 +658,7 @@ contract("WitnetRequestBytecodes", (accounts) => { context("radon requests", async () => { it("reverts if trying to get bytecode from unknown radon request", async () => { await expectRevertCustomError( - WitnetRequestBytecodes, + WitnetRadonRegistry, bytecodes.bytecodeOf("0x0"), "UnknownRadonRequest" ) @@ -673,7 +673,7 @@ contract("WitnetRequestBytecodes", (accounts) => { context("radon slas", async () => { it("reverts if trying to get bytecode from unknown radon sla", async () => { await expectRevertCustomError( - WitnetRequestBytecodes, + WitnetRadonRegistry, bytecodes.bytecodeOf(btcUsdPriceFeedHash, "0x0"), "UnknownRadonSLA" ) @@ -699,14 +699,14 @@ contract("WitnetRequestBytecodes", (accounts) => { context("hashWeightRewardOf(..)", async () => { it("hashing unknown radon request reverts", async () => { await expectRevertCustomError( - WitnetRequestBytecodes, + WitnetRadonRegistry, bytecodes.hashWeightWitsOf("0x0", slaHash), "UnknownRadonRequest" ) }) it("hashing unknown radon sla reverts", async () => { await expectRevertCustomError( - WitnetRequestBytecodes, + WitnetRadonRegistry, bytecodes.hashWeightWitsOf(btcUsdPriceFeedHash, "0x0"), "UnknownRadonSLA" ) From ee9c3d4c7a282c23eb1d4ad439dda4178bff73e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Thu, 1 Aug 2024 10:31:01 +0200 Subject: [PATCH 10/39] chore: revisit IWitnetFeeds* specs --- .../core/defaults/WitnetPriceFeedsDefault.sol | 8 ++-- contracts/interfaces/IWitnetFeeds.sol | 40 ++++++++++++++++++- contracts/interfaces/IWitnetFeedsAdmin.sol | 6 +++ 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/contracts/core/defaults/WitnetPriceFeedsDefault.sol b/contracts/core/defaults/WitnetPriceFeedsDefault.sol index 9cd29203..3280bc03 100644 --- a/contracts/core/defaults/WitnetPriceFeedsDefault.sol +++ b/contracts/core/defaults/WitnetPriceFeedsDefault.sol @@ -125,7 +125,7 @@ contract WitnetPriceFeedsDefault "WitnetPriceFeeds: inexistent oracle" ); require( - witnet.specs() == type(IWitnetOracle).interfaceId, + witnet.specs() == type(WitnetOracle).interfaceId, "WitnetPriceFeeds: uncompliant oracle" ); emit Upgraded(_owner, base(), codehash(), version()); @@ -222,7 +222,7 @@ contract WitnetPriceFeedsDefault return __defaultRadonSLA; } - function estimateUpdateBaseFee(uint256 _evmGasPrice) + function estimateUpdateRequestFee(uint256 _evmGasPrice) virtual override public view returns (uint) @@ -241,7 +241,7 @@ contract WitnetPriceFeedsDefault function lastValidResponse(bytes4 feedId) override public view - returns (WitnetV2.Response memory) + returns (Witnet.Response memory) { return witnet.getQueryResponse(_lastValidQueryId(feedId)); } @@ -731,7 +731,7 @@ contract WitnetPriceFeedsDefault { Record storage __feed = __records_(feedId); if (__feed.radHash != 0) { - _usedFunds = estimateUpdateBaseFee(tx.gasprice); + _usedFunds = estimateUpdateRequestFee(_getGasPrice()); require( msg.value >= _usedFunds, "WitnetPriceFeeds: insufficient reward" diff --git a/contracts/interfaces/IWitnetFeeds.sol b/contracts/interfaces/IWitnetFeeds.sol index de32674a..fdef096d 100644 --- a/contracts/interfaces/IWitnetFeeds.sol +++ b/contracts/interfaces/IWitnetFeeds.sol @@ -7,25 +7,63 @@ import "../WitnetRadonRegistry.sol"; interface IWitnetFeeds { + /// Primitive data type produced by successful data updates of all supported + /// feeds (e.g. Witnet.RadonDataTypes.Integer in WitnetPriceFeeds). function dataType() external view returns (Witnet.RadonDataTypes); + + /// ERC-2362 caption prefix shared by all supported feeds (e.g. "Price-" in WitnetPriceFeeds). function prefix() external view returns (string memory); + /// Default SLA data security parameters that will be fulfilled on Witnet upon + /// every feed update, if no others are specified by the requester. function defaultRadonSLA() external view returns (Witnet.RadonSLA memory); - function estimateUpdateBaseFee(uint256 evmGasPrice) external view returns (uint); + /// Estimates the minimum EVM fee required to be paid upon requesting a data + /// update with the given the _evmGasPrice value. + function estimateUpdateRequestFee(uint256 evmGasPrice) external view returns (uint); + + /// Returns the query id (in the context of the WitnetOracle addressed by witnet()) + /// that solved the most recently updated value for the given feed. function lastValidQueryId(bytes4 feedId) external view returns (uint256); + + /// Returns the actual response from the Witnet oracle blockchain to the last + /// successful update for the given data feed. function lastValidResponse(bytes4 feedId) external view returns (Witnet.Response memory); + /// Returns the Witnet query id of the latest update attempt for the given data feed. function latestUpdateQueryId(bytes4 feedId) external view returns (uint256); + + /// Returns the actual request queried to the the Witnet oracle blockchain on the latest + /// update attempt for the given data feed. function latestUpdateRequest(bytes4 feedId) external view returns (Witnet.Request memory); + + /// Returns the response from the Witnet oracle blockchain to the latest update attempt + /// for the given data feed. function latestUpdateResponse(bytes4 feedId) external view returns (Witnet.Response memory); + + /// Tells the current response status of the latest update attempt for the given data feed. function latestUpdateResponseStatus(bytes4 feedId) external view returns (Witnet.ResponseStatus); + + /// Describes the error returned from the Witnet oracle blockchain in response to the latest + /// update attempt for the given data feed, if any. function latestUpdateResultError(bytes4 feedId) external view returns (Witnet.ResultError memory); + /// Returns the Witnet-compliant bytecode of the data retrieving script to be solved by + /// the Witnet oracle blockchain upon every update of the given data feed. function lookupWitnetBytecode(bytes4 feedId) external view returns (bytes memory); + + /// Returns the RAD hash that uniquely identifies the data retrieving script that gets solved + /// by the Witnet oracle blockchain upon every update of the given data feed. function lookupWitnetRadHash(bytes4 feedId) external view returns (bytes32); + + /// Returns the list of actual data sources and offchain computations for the given data feed. function lookupWitnetRetrievals(bytes4 feedId) external view returns (Witnet.RadonRetrieval[] memory); + /// Triggers a fresh update on the Witnet oracle blockchain for the given data feed, + /// using the defaultRadonSLA() security parameters. function requestUpdate(bytes4 feedId) external payable returns (uint256 usedFunds); + + /// Triggers a fresh update for the given data feed, requiring also the SLA data security parameters + /// that will have to be fulfilled on Witnet. function requestUpdate(bytes4 feedId, Witnet.RadonSLA calldata updateSLA) external payable returns (uint256 usedFunds); } diff --git a/contracts/interfaces/IWitnetFeedsAdmin.sol b/contracts/interfaces/IWitnetFeedsAdmin.sol index 27200ac6..0761c956 100644 --- a/contracts/interfaces/IWitnetFeedsAdmin.sol +++ b/contracts/interfaces/IWitnetFeedsAdmin.sol @@ -6,6 +6,12 @@ import "../libs/Witnet.sol"; import "../WitnetRequest.sol"; interface IWitnetFeedsAdmin { + + event WitnetFeedDeleted(bytes4 feedId); + event WitnetFeedSettled(bytes4 feedId, bytes32 radHash); + event WitnetFeedSolverSettled(bytes4 feedId, address solver); + event WitnetRadonSLA(Witnet.RadonSLA sla); + function acceptOwnership() external; function baseFeeOverheadPercentage() external view returns (uint16); function deleteFeed(string calldata caption) external; From c6bfd3c727237aebf3e79f7cebb7967c6083edb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sat, 3 Aug 2024 12:05:57 +0200 Subject: [PATCH 11/39] refactor: WitnetRadonRegistry and core artifacts interdependencies --- contracts/WitnetRequest.sol | 4 +- contracts/WitnetRequestTemplate.sol | 6 +- contracts/apps/UsingWitnet.sol | 6 +- contracts/apps/UsingWitnetRequest.sol | 9 - contracts/apps/UsingWitnetRequestTemplate.sol | 16 +- contracts/apps/WitnetConsumer.sol | 11 +- .../apps/WitnetRandomnessRequestConsumer.sol | 27 +- contracts/apps/WitnetRandomnessV2.sol | 99 +-- contracts/apps/WitnetRequestConsumer.sol | 14 +- .../apps/WitnetRequestTemplateConsumer.sol | 14 +- .../customs/WitnetOracleTrustableObscuro.sol | 4 +- .../customs/WitnetOracleTrustableOvm2.sol | 4 +- .../customs/WitnetOracleTrustableReef.sol | 4 +- .../customs/WitnetRequestFactoryCfxCore.sol | 3 +- .../defaults/WitnetOracleTrustableBase.sol | 44 +- .../defaults/WitnetOracleTrustableDefault.sol | 8 +- .../core/defaults/WitnetPriceFeedsDefault.sol | 88 +- .../defaults/WitnetRadonRegistryDefault.sol | 424 +++++----- .../defaults/WitnetRequestFactoryDefault.sol | 798 +++++++++--------- ...esData.sol => WitnetRadonRegistryData.sol} | 27 +- contracts/data/WitnetRequestFactoryData.sol | 37 +- contracts/interfaces/IWitnetFeedsAdmin.sol | 4 +- contracts/interfaces/IWitnetOracleEvents.sol | 2 +- contracts/interfaces/IWitnetRadonRegistry.sol | 87 +- .../interfaces/IWitnetRadonRegistryEvents.sol | 12 +- .../interfaces/IWitnetRadonRegistryLegacy.sol | 20 +- contracts/interfaces/IWitnetRequest.sol | 37 +- .../interfaces/IWitnetRequestFactory.sol | 5 +- .../IWitnetRequestFactoryAppliance.sol | 12 - .../IWitnetRequestFactoryEvents.sol | 2 +- .../interfaces/IWitnetRequestTemplate.sol | 40 +- contracts/libs/Witnet.sol | 4 +- contracts/libs/WitnetEncodingLib.sol | 12 +- contracts/mocks/WitnetMockedOracle.sol | 18 +- ...odes.sol => WitnetMockedRadonRegistry.sol} | 10 +- .../mocks/WitnetMockedRequestFactory.sol | 1 - migrations/scripts/3_core.js | 3 +- test/TestWitnetEncodingLib.sol | 6 +- 38 files changed, 918 insertions(+), 1004 deletions(-) rename contracts/data/{WitnetRequestBytecodesData.sol => WitnetRadonRegistryData.sol} (77%) delete mode 100644 contracts/interfaces/IWitnetRequestFactoryAppliance.sol rename contracts/mocks/{WitnetMockedRequestBytecodes.sol => WitnetMockedRadonRegistry.sol} (52%) diff --git a/contracts/WitnetRequest.sol b/contracts/WitnetRequest.sol index a60a8dce..aa1c666f 100644 --- a/contracts/WitnetRequest.sol +++ b/contracts/WitnetRequest.sol @@ -3,11 +3,11 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; +import "./interfaces/IWitnetOracleAppliance.sol"; import "./interfaces/IWitnetRequest.sol"; -import "./interfaces/IWitnetRequestFactoryAppliance.sol"; abstract contract WitnetRequest is - IWitnetRequestFactoryAppliance, + IWitnetOracleAppliance, IWitnetRequest {} diff --git a/contracts/WitnetRequestTemplate.sol b/contracts/WitnetRequestTemplate.sol index be5d0950..74a08beb 100644 --- a/contracts/WitnetRequestTemplate.sol +++ b/contracts/WitnetRequestTemplate.sol @@ -3,13 +3,15 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./interfaces/IWitnetRequestFactoryAppliance.sol"; +import "./interfaces/IWitnetOracleAppliance.sol"; +import "./interfaces/IWitnetRadonRegistryEvents.sol"; +import "./interfaces/IWitnetRequestFactoryEvents.sol"; import "./interfaces/IWitnetRequestTemplate.sol"; abstract contract WitnetRequestTemplate is + IWitnetOracleAppliance, IWitnetRadonRegistryEvents, - IWitnetRequestFactoryAppliance, IWitnetRequestFactoryEvents, IWitnetRequestTemplate {} diff --git a/contracts/apps/UsingWitnet.sol b/contracts/apps/UsingWitnet.sol index b5ff836b..10103bf4 100644 --- a/contracts/apps/UsingWitnet.sol +++ b/contracts/apps/UsingWitnet.sol @@ -64,15 +64,13 @@ abstract contract UsingWitnet } /// @notice Estimate the minimum reward required for posting a data request, using `tx.gasprice` as a reference. - /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. - /// @param _resultMaxSize Maximum expected size of returned data (in bytes). - function _witnetEstimateEvmReward(uint16 _resultMaxSize) + function _witnetEstimateBaseFee() virtual internal view returns (uint256) { return ( (100 + __witnetBaseFeeOverheadPercentage) - * __witnet.estimateBaseFee(tx.gasprice, _resultMaxSize) + * __witnet.estimateBaseFee(tx.gasprice) ) / 100; } diff --git a/contracts/apps/UsingWitnetRequest.sol b/contracts/apps/UsingWitnetRequest.sol index 45c353b9..0cb561f7 100644 --- a/contracts/apps/UsingWitnetRequest.sol +++ b/contracts/apps/UsingWitnetRequest.sol @@ -10,7 +10,6 @@ abstract contract UsingWitnetRequest WitnetRequest immutable public dataRequest; bytes32 immutable internal __witnetRequestRadHash; - uint16 immutable internal __witnetQueryResultMaxSize; /// @param _witnetRequest Address of the WitnetRequest contract containing the actual data request. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. @@ -25,18 +24,10 @@ abstract contract UsingWitnetRequest "UsingWitnetRequest: uncompliant WitnetRequest" ); dataRequest = _witnetRequest; - __witnetQueryResultMaxSize = _witnetRequest.resultDataMaxSize(); __witnetRequestRadHash = _witnetRequest.radHash(); __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - function _witnetEstimateEvmReward() - virtual internal view - returns (uint256) - { - return _witnetEstimateEvmReward(__witnetQueryResultMaxSize); - } - function __witnetRequestData(uint256 _witnetEvmReward) virtual internal returns (uint256) { diff --git a/contracts/apps/UsingWitnetRequestTemplate.sol b/contracts/apps/UsingWitnetRequestTemplate.sol index 4e25ec0b..46cb8f0b 100644 --- a/contracts/apps/UsingWitnetRequestTemplate.sol +++ b/contracts/apps/UsingWitnetRequestTemplate.sol @@ -2,19 +2,19 @@ pragma solidity ^0.8.0; import "./UsingWitnet.sol"; + import "../WitnetRequest.sol"; +import "../WitnetRequestTemplate.sol"; abstract contract UsingWitnetRequestTemplate is UsingWitnet { WitnetRequestTemplate immutable public dataRequestTemplate; - - uint16 immutable internal __witnetQueryResultMaxSize; /// @param _witnetRequestTemplate Address of the WitnetRequestTemplate from which actual data requests will get built. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. constructor ( - WitnetRequestTemplate _witnetRequestTemplate, + WitnetRequestTemplate _witnetRequestTemplate, uint16 _baseFeeOverheadPercentage ) UsingWitnet(_witnetRequestTemplate.witnet()) @@ -24,7 +24,6 @@ abstract contract UsingWitnetRequestTemplate "UsingWitnetRequestTemplate: uncompliant WitnetRequestTemplate" ); dataRequestTemplate = _witnetRequestTemplate; - __witnetQueryResultMaxSize = _witnetRequestTemplate.resultDataMaxSize(); __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } @@ -37,14 +36,7 @@ abstract contract UsingWitnetRequestTemplate function _witnetBuildRequest(string[][] memory _witnetRequestArgs) internal returns (WitnetRequest) { - return WitnetRequest(dataRequestTemplate.buildRequest(_witnetRequestArgs)); - } - - function _witnetEstimateEvmReward() - virtual internal view - returns (uint256) - { - return _witnetEstimateEvmReward(__witnetQueryResultMaxSize); + return WitnetRequest(dataRequestTemplate.buildWitnetRequest(_witnetRequestArgs)); } function __witnetRequestData( diff --git a/contracts/apps/WitnetConsumer.sol b/contracts/apps/WitnetConsumer.sol index 4f000a21..c6d54573 100644 --- a/contracts/apps/WitnetConsumer.sol +++ b/contracts/apps/WitnetConsumer.sol @@ -34,7 +34,7 @@ abstract contract WitnetConsumer /// =============================================================================================================== /// --- WitnetConsumer virtual methods ---------------------------------------------------------------------------- - function _witnetEstimateEvmReward() virtual internal view returns (uint256) { + function _witnetEstimateBaseFee() virtual override internal view returns (uint256) { return ( (100 + __witnetBaseFeeOverheadPercentage) * __witnet.estimateBaseFeeWithCallback( @@ -43,19 +43,12 @@ abstract contract WitnetConsumer ) ) / 100; } - - function _witnetEstimateEvmReward(uint16) - virtual override internal view - returns (uint256) - { - return _witnetEstimateEvmReward(); - } /// @notice Estimate the minimum reward required for posting a data request, using `tx.gasprice` as a reference. /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. /// @param _callbackGasLimit Maximum gas to be spent when reporting the data request result. - function _witnetEstimateEvmRewardWithCallback(uint24 _callbackGasLimit) + function _witnetEstimateBaseFeeWithCallback(uint24 _callbackGasLimit) virtual internal view returns (uint256) { diff --git a/contracts/apps/WitnetRandomnessRequestConsumer.sol b/contracts/apps/WitnetRandomnessRequestConsumer.sol index b8b911ef..4165db05 100644 --- a/contracts/apps/WitnetRandomnessRequestConsumer.sol +++ b/contracts/apps/WitnetRandomnessRequestConsumer.sol @@ -30,7 +30,7 @@ abstract contract WitnetRandomnessRequestConsumer { // On-chain building of the Witnet Randomness Request: { - WitnetRequestBytecodes _registry = witnet().registry(); + WitnetRadonRegistry _registry = witnet().registry(); // Build own Witnet Randomness Request: bytes32[] memory _retrievals = new bytes32[](1); _retrievals[0] = _registry.verifyRadonRetrieval( @@ -40,30 +40,21 @@ abstract contract WitnetRandomnessRequestConsumer new string[2][](0), // no headers hex"80" // no retrieval script ); - Witnet.RadonFilter[] memory _filters; - bytes32 _aggregator = _registry.verifyRadonReducer(Witnet.RadonReducer({ - opcode: Witnet.RadonReducerOpcodes.Mode, - filters: _filters // no filters - })); - bytes32 _tally = _registry.verifyRadonReducer(Witnet.RadonReducer({ - opcode: Witnet.RadonReducerOpcodes.ConcatenateAndHash, - filters: _filters // no filters - })); __witnetRandomnessRadHash = _registry.verifyRadonRequest( _retrievals, - _aggregator, - _tally, - 32, // 256 bits of pure entropy ;-) - new string[][](_retrievals.length) + Witnet.RadonReducer({ + opcode: Witnet.RadonReduceOpcodes.Mode, + filters: new Witnet.RadonFilter[](0) + }), + Witnet.RadonReducer({ + opcode: Witnet.RadonReduceOpcodes.ConcatenateAndHash, + filters: new Witnet.RadonFilter[](0) + }) ); } __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - function _witnetEstimateEvmReward() virtual override internal view returns (uint256) { - return _witnetEstimateEvmReward(32); - } - function _witnetRandomUniformUint32(uint32 _range, uint256 _nonce, bytes32 _seed) internal pure returns (uint32) { uint256 _number = uint256( keccak256( diff --git a/contracts/apps/WitnetRandomnessV2.sol b/contracts/apps/WitnetRandomnessV2.sol index e1f5c352..1dde05af 100644 --- a/contracts/apps/WitnetRandomnessV2.sol +++ b/contracts/apps/WitnetRandomnessV2.sol @@ -21,7 +21,7 @@ contract WitnetRandomnessV2 using Witnet for Witnet.RadonSLA; struct Randomize { - uint256 witnetQueryId; + uint256 queryId; uint256 prevBlock; uint256 nextBlock; } @@ -45,36 +45,32 @@ contract WitnetRandomnessV2 _require( address(_witnet) == address(0) || _witnet.specs() == type(WitnetOracle).interfaceId, - "uncompliant WitnetOracle" + "uncompliant oracle" ); - WitnetRequestBytecodes _registry = witnet().registry(); - { - // Build own Witnet Randomness Request: - bytes32[] memory _retrievals = new bytes32[](1); - _retrievals[0] = _registry.verifyRadonRetrieval( - Witnet.RadonRetrievalMethods.RNG, - "", // no request url - "", // no request body - new string[2][](0), // no request headers - hex"80" // no request Radon script - ); - Witnet.RadonFilter[] memory _filters; - bytes32 _aggregator = _registry.verifyRadonReducer(Witnet.RadonReducer({ - opcode: Witnet.RadonReducerOpcodes.Mode, - filters: _filters // no filters - })); - bytes32 _tally = _registry.verifyRadonReducer(Witnet.RadonReducer({ - opcode: Witnet.RadonReducerOpcodes.ConcatenateAndHash, - filters: _filters // no filters - })); - witnetRadHash = _registry.verifyRadonRequest( - _retrievals, - _aggregator, - _tally, - 32, // 256 bits of pure entropy ;-) - new string[][](_retrievals.length) - ); - } + // Build Witnet-compliant randomness request: + WitnetRadonRegistry _registry = witnet().registry(); + witnetRadHash = _registry.verifyRadonRequest( + abi.decode( + abi.encode([ + _registry.verifyRadonRetrieval( + Witnet.RadonRetrievalMethods.RNG, + "", // no request url + "", // no request body + new string[2][](0), // no request headers + hex"80" // no request Radon script + ) + ]), (bytes32[]) + ), + Witnet.RadonReducer({ + opcode: Witnet.RadonReduceOpcodes.Mode, + filters: new Witnet.RadonFilter[](0) + }), + Witnet.RadonReducer({ + opcode: Witnet.RadonReduceOpcodes.ConcatenateAndHash, + filters: new Witnet.RadonFilter[](0) + }) + ); + __witnetDefaultSLA.maxTallyResultSize = 34; } receive() virtual external payable { @@ -117,11 +113,8 @@ contract WitnetRandomnessV2 returns (uint256) { return ( - (100 + __witnetBaseFeeOverheadPercentage) - * __witnet.estimateBaseFee( - _evmGasPrice, - uint16(34) - ) + __witnet.estimateBaseFee(_evmGasPrice) + * (100 + __witnetBaseFeeOverheadPercentage) ) / 100; } @@ -150,21 +143,21 @@ contract WitnetRandomnessV2 virtual internal view returns (bytes32) { - if (__storage().randomize_[_blockNumber].witnetQueryId == 0) { + if (__storage().randomize_[_blockNumber].queryId == 0) { _blockNumber = getRandomizeNextBlock(_blockNumber); } Randomize storage __randomize = __storage().randomize_[_blockNumber]; - uint256 _witnetQueryId = __randomize.witnetQueryId; + uint256 _queryId = __randomize.queryId; _require( - _witnetQueryId != 0, + _queryId != 0, "not randomized" ); - Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_witnetQueryId); + Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); if (_status == Witnet.ResponseStatus.Ready) { return ( - __witnet.getQueryResultCborBytes(_witnetQueryId) + __witnet.getQueryResultCborBytes(_queryId) .toWitnetResult() .asBytes32() ); @@ -203,20 +196,20 @@ contract WitnetRandomnessV2 uint256 _witnetResultFinalityBlock ) { - if (__storage().randomize_[_blockNumber].witnetQueryId == 0) { + if (__storage().randomize_[_blockNumber].queryId == 0) { _blockNumber = getRandomizeNextBlock(_blockNumber); } Randomize storage __randomize = __storage().randomize_[_blockNumber]; - uint256 _witnetQueryId = __randomize.witnetQueryId; + uint256 _queryId = __randomize.queryId; _require( - _witnetQueryId != 0, + _queryId != 0, "not randomized" ); - Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_witnetQueryId); + Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); if (_status == Witnet.ResponseStatus.Ready) { - Witnet.Response memory _witnetQueryResponse = __witnet.getQueryResponse(_witnetQueryId); + Witnet.Response memory _witnetQueryResponse = __witnet.getQueryResponse(_queryId); _witnetResultTimestamp = _witnetQueryResponse.resultTimestamp; _witnetResultTallyHash = _witnetQueryResponse.resultTallyHash; _witnetResultFinalityBlock = _witnetQueryResponse.finality; @@ -247,20 +240,20 @@ contract WitnetRandomnessV2 /// @notice Retrieves metadata related to the randomize request that got posted to the /// @notice Witnet Oracle contract on the given block number. /// @dev Returns zero values if no randomize request was actually posted on the given block. - /// @return _witnetQueryId Identifier of the underlying Witnet query created on the given block number. + /// @return _queryId Identifier of the underlying Witnet query created on the given block number. /// @return _prevRandomizeBlock Block number in which a randomize request got posted just before this one. 0 if none. /// @return _nextRandomizeBlock Block number in which a randomize request got posted just after this one, 0 if none. function getRandomizeData(uint256 _blockNumber) external view virtual override returns ( - uint256 _witnetQueryId, + uint256 _queryId, uint256 _prevRandomizeBlock, uint256 _nextRandomizeBlock ) { Randomize storage __randomize = __storage().randomize_[_blockNumber]; - _witnetQueryId = __randomize.witnetQueryId; + _queryId = __randomize.queryId; _prevRandomizeBlock = __randomize.prevBlock; _nextRandomizeBlock = __randomize.nextBlock; } @@ -273,7 +266,7 @@ contract WitnetRandomnessV2 virtual override returns (uint256) { - return ((__storage().randomize_[_blockNumber].witnetQueryId != 0) + return ((__storage().randomize_[_blockNumber].queryId != 0) ? __storage().randomize_[_blockNumber].nextBlock // start search from the latest block : _searchNextBlock(_blockNumber, __storage().lastRandomizeBlock) @@ -309,15 +302,15 @@ contract WitnetRandomnessV2 public view returns (Witnet.ResponseStatus) { - if (__storage().randomize_[_blockNumber].witnetQueryId == 0) { + if (__storage().randomize_[_blockNumber].queryId == 0) { _blockNumber = getRandomizeNextBlock(_blockNumber); } - uint256 _witnetQueryId = __storage().randomize_[_blockNumber].witnetQueryId; - if (_witnetQueryId == 0) { + uint256 _queryId = __storage().randomize_[_blockNumber].queryId; + if (_queryId == 0) { return Witnet.ResponseStatus.Void; } else { - Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_witnetQueryId); + Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); if (_status == Witnet.ResponseStatus.Error) { uint256 _nextRandomizeBlock = __storage().randomize_[_blockNumber].nextBlock; if (_nextRandomizeBlock != 0) { diff --git a/contracts/apps/WitnetRequestConsumer.sol b/contracts/apps/WitnetRequestConsumer.sol index 684eacb6..0977317f 100644 --- a/contracts/apps/WitnetRequestConsumer.sol +++ b/contracts/apps/WitnetRequestConsumer.sol @@ -24,21 +24,13 @@ abstract contract WitnetRequestConsumer WitnetConsumer(_callbackGasLimit) {} - function _witnetEstimateEvmReward() - virtual override(UsingWitnetRequest, WitnetConsumer) - internal view - returns (uint256) - { - return WitnetConsumer._witnetEstimateEvmReward(); - } - - function _witnetEstimateEvmReward(uint16) + function _witnetEstimateBaseFee() virtual override(UsingWitnet, WitnetConsumer) internal view returns (uint256) { - return WitnetConsumer._witnetEstimateEvmReward(); - } + return WitnetConsumer._witnetEstimateBaseFee(); + } function __witnetRequestData( uint256 _witnetEvmReward, diff --git a/contracts/apps/WitnetRequestTemplateConsumer.sol b/contracts/apps/WitnetRequestTemplateConsumer.sol index 55526442..2e85386a 100644 --- a/contracts/apps/WitnetRequestTemplateConsumer.sol +++ b/contracts/apps/WitnetRequestTemplateConsumer.sol @@ -24,22 +24,14 @@ abstract contract WitnetRequestTemplateConsumer WitnetConsumer(_callbackGasLimit) {} - function _witnetEstimateEvmReward() - virtual override(UsingWitnetRequestTemplate, WitnetConsumer) + function _witnetEstimateBaseFee() + virtual override(UsingWitnet, WitnetConsumer) internal view returns (uint256) { - return WitnetConsumer._witnetEstimateEvmReward(__witnetQueryResultMaxSize); + return WitnetConsumer._witnetEstimateBaseFee(); } - function _witnetEstimateEvmReward(uint16) - virtual override(UsingWitnet, WitnetConsumer) - internal view - returns (uint256) - { - return WitnetConsumer._witnetEstimateEvmReward(); - } - function __witnetRequestData( uint256 _witnetEvmReward, string[][] memory _witnetRequestArgs, diff --git a/contracts/core/customs/WitnetOracleTrustableObscuro.sol b/contracts/core/customs/WitnetOracleTrustableObscuro.sol index d692142b..4c6293f6 100644 --- a/contracts/core/customs/WitnetOracleTrustableObscuro.sol +++ b/contracts/core/customs/WitnetOracleTrustableObscuro.sol @@ -21,8 +21,8 @@ contract WitnetOracleTrustableObscuro } constructor( + WitnetRadonRegistry _registry, WitnetRequestFactory _factory, - WitnetRequestBytecodes _registry, bool _upgradable, bytes32 _versionTag, uint256 _reportResultGasBase, @@ -31,8 +31,8 @@ contract WitnetOracleTrustableObscuro uint256 _sstoreFromZeroGas ) WitnetOracleTrustableDefault( - _factory, _registry, + _factory, _upgradable, _versionTag, _reportResultGasBase, diff --git a/contracts/core/customs/WitnetOracleTrustableOvm2.sol b/contracts/core/customs/WitnetOracleTrustableOvm2.sol index 683cb136..63922d93 100644 --- a/contracts/core/customs/WitnetOracleTrustableOvm2.sol +++ b/contracts/core/customs/WitnetOracleTrustableOvm2.sol @@ -28,8 +28,8 @@ contract WitnetOracleTrustableOvm2 } constructor( + WitnetRadonRegistry _registry, WitnetRequestFactory _factory, - WitnetRequestBytecodes _registry, bool _upgradable, bytes32 _versionTag, uint256 _reportResultGasBase, @@ -38,8 +38,8 @@ contract WitnetOracleTrustableOvm2 uint256 _sstoreFromZeroGas ) WitnetOracleTrustableDefault( - _factory, _registry, + _factory, _upgradable, _versionTag, _reportResultGasBase, diff --git a/contracts/core/customs/WitnetOracleTrustableReef.sol b/contracts/core/customs/WitnetOracleTrustableReef.sol index 220d1f53..e6485264 100644 --- a/contracts/core/customs/WitnetOracleTrustableReef.sol +++ b/contracts/core/customs/WitnetOracleTrustableReef.sol @@ -22,8 +22,8 @@ contract WitnetOracleTrustableReef } constructor( + WitnetRadonRegistry _registry, WitnetRequestFactory _factory, - WitnetRequestBytecodes _registry, bool _upgradable, bytes32 _versionTag, uint256 _reportResultGasBase, @@ -32,8 +32,8 @@ contract WitnetOracleTrustableReef uint256 _sstoreFromZeroGas ) WitnetOracleTrustableDefault( - _factory, _registry, + _factory, _upgradable, _versionTag, _reportResultGasBase, diff --git a/contracts/core/customs/WitnetRequestFactoryCfxCore.sol b/contracts/core/customs/WitnetRequestFactoryCfxCore.sol index 93bb4e2e..86e4700f 100644 --- a/contracts/core/customs/WitnetRequestFactoryCfxCore.sol +++ b/contracts/core/customs/WitnetRequestFactoryCfxCore.sol @@ -11,11 +11,10 @@ contract WitnetRequestFactoryCfxCore { constructor( WitnetOracle _witnet, - WitnetRadonRegistry _registry, bool _upgradable, bytes32 _versionTag ) - WitnetRequestFactoryDefault(_witnet, _registry, _upgradable, _versionTag) + WitnetRequestFactoryDefault(_witnet, _upgradable, _versionTag) {} function _cloneDeterministic(bytes32 _salt) diff --git a/contracts/core/defaults/WitnetOracleTrustableBase.sol b/contracts/core/defaults/WitnetOracleTrustableBase.sol index ecaf6a3d..f2756ed5 100644 --- a/contracts/core/defaults/WitnetOracleTrustableBase.sol +++ b/contracts/core/defaults/WitnetOracleTrustableBase.sol @@ -5,7 +5,6 @@ pragma experimental ABIEncoderV2; import "../WitnetUpgradableBase.sol"; import "../../WitnetOracle.sol"; -import "../../WitnetRequestFactory.sol"; import "../../data/WitnetOracleDataLib.sol"; import "../../interfaces/IWitnetOracleReporter.sol"; import "../../interfaces/IWitnetRequestBoardAdminACLs.sol"; @@ -20,18 +19,22 @@ import "../../patterns/Payable.sol"; /// @author The Witnet Foundation abstract contract WitnetOracleTrustableBase is - WitnetUpgradableBase, + Payable, WitnetOracle, + WitnetUpgradableBase, IWitnetOracleReporter, - IWitnetRequestBoardAdminACLs, - Payable + IWitnetRequestBoardAdminACLs { using Witnet for bytes; - using Witnet for Witnet.Result; - using WitnetCBOR for WitnetCBOR.CBOR; using Witnet for Witnet.RadonSLA; using Witnet for Witnet.Request; using Witnet for Witnet.Response; + using Witnet for Witnet.Result; + using WitnetCBOR for WitnetCBOR.CBOR; + + WitnetRequestFactory public immutable override factory; + WitnetRadonRegistry public immutable override registry; + bytes4 public immutable override specs = type(WitnetOracle).interfaceId; function channel() virtual override public view returns (bytes4) { @@ -99,8 +102,8 @@ abstract contract WitnetOracleTrustableBase } constructor( + WitnetRadonRegistry _registry, WitnetRequestFactory _factory, - WitnetRequestBytecodes _registry, bool _upgradable, bytes32 _versionTag, address _currency @@ -113,8 +116,8 @@ abstract contract WitnetOracleTrustableBase "io.witnet.proxiable.board" ) { - __factory = _factory; registry = _registry; + factory = _factory; } receive() external payable { @@ -188,20 +191,11 @@ abstract contract WitnetOracleTrustableBase } __proxiable().codehash = codehash(); - _require( - address(__factory).code.length > 0, - "inexistent factory" - ); - _require( - __factory.specs() == type(IWitnetRequestFactory).interfaceId, - "uncompliant factory" - ); - _require( - address(__factory.witnet()) == address(this) - && address(__factory.registry()) == address(registry), - "discordant factory" - ); - + _require(address(registry).code.length > 0, "inexistent registry"); + _require(registry.specs() == type(WitnetRadonRegistry).interfaceId, "uncompliant registry"); + _require(address(factory).code.length > 0, "inexistent factory"); + _require(address(factory.witnet()) == address(this), "discordant factory"); + // Set reporters, if any __setReporters(_newReporters); @@ -224,7 +218,7 @@ abstract contract WitnetOracleTrustableBase /// @notice Estimate the minimum reward required for posting a data request. /// @dev Underestimates if the size of returned data is greater than `resultMaxSize`. /// @param gasPrice Expected gas price to pay upon posting the data request. - /// @param radHash The hash of some Witnet Data Request previously posted in the WitnetRequestBytecodes registry. + /// @param radHash The hash of some Witnet Data Request previously posted in the WitnetRadonRegistry registry. function estimateBaseFee(uint256 gasPrice, bytes32 radHash) public view virtual override @@ -378,7 +372,7 @@ abstract contract WitnetOracleTrustableBase /// @notice solved by the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be /// @notice transferred to the reporter who relays back the Witnet-provable result to this request. /// @dev Reasons to fail: - /// @dev - the RAD hash was not previously verified by the WitnetRequestBytecodes registry; + /// @dev - the RAD hash was not previously verified by the WitnetRadonRegistry registry; /// @dev - invalid SLA parameters were provided; /// @dev - insufficient value is paid as reward. /// @param _queryRAD The RAD hash of the data request to be solved by Witnet. @@ -413,7 +407,7 @@ abstract contract WitnetOracleTrustableBase /// @notice will be triggered, and the Witnet audit trail will be saved in storage, but not so the actual CBOR-encoded result. /// @dev Reasons to fail: /// @dev - the caller is not a contract implementing the IWitnetConsumer interface; - /// @dev - the RAD hash was not previously verified by the WitnetRequestBytecodes registry; + /// @dev - the RAD hash was not previously verified by the WitnetRadonRegistry registry; /// @dev - invalid SLA parameters were provided; /// @dev - zero callback gas limit is provided; /// @dev - insufficient value is paid as reward. diff --git a/contracts/core/defaults/WitnetOracleTrustableDefault.sol b/contracts/core/defaults/WitnetOracleTrustableDefault.sol index 6a64a5bb..c6ecef81 100644 --- a/contracts/core/defaults/WitnetOracleTrustableDefault.sol +++ b/contracts/core/defaults/WitnetOracleTrustableDefault.sol @@ -16,6 +16,8 @@ contract WitnetOracleTrustableDefault is WitnetOracleTrustableBase { + using Witnet for Witnet.RadonSLA; + function class() virtual override public view returns (string memory) { return type(WitnetOracleTrustableDefault).name; } @@ -26,8 +28,8 @@ contract WitnetOracleTrustableDefault uint256 internal immutable __sstoreFromZeroGas; constructor( + WitnetRadonRegistry _registry, WitnetRequestFactory _factory, - WitnetRequestBytecodes _registry, bool _upgradable, bytes32 _versionTag, uint256 _reportResultGasBase, @@ -36,13 +38,13 @@ contract WitnetOracleTrustableDefault uint256 _sstoreFromZeroGas ) WitnetOracleTrustableBase( - _factory, _registry, + _factory, _upgradable, _versionTag, address(0) ) - { + { __reportResultGasBase = _reportResultGasBase; __reportResultWithCallbackGasBase = _reportResultWithCallbackGasBase; __reportResultWithCallbackRevertGasBase = _reportResultWithCallbackRevertGasBase; diff --git a/contracts/core/defaults/WitnetPriceFeedsDefault.sol b/contracts/core/defaults/WitnetPriceFeedsDefault.sol index 3280bc03..66434cfa 100644 --- a/contracts/core/defaults/WitnetPriceFeedsDefault.sol +++ b/contracts/core/defaults/WitnetPriceFeedsDefault.sol @@ -37,6 +37,7 @@ contract WitnetPriceFeedsDefault bytes4 immutable public override specs = type(WitnetPriceFeeds).interfaceId; WitnetOracle immutable public override witnet; + WitnetRadonRegistry immutable internal __registry; Witnet.RadonSLA private __defaultRadonSLA; uint16 private __baseFeeOverheadPercentage; @@ -56,6 +57,10 @@ contract WitnetPriceFeedsDefault witnet = _wrb; } + function _registry() virtual internal view returns (WitnetRadonRegistry) { + return witnet.registry(); + } + // solhint-disable-next-line payable-fallback fallback() override external { if ( @@ -63,9 +68,9 @@ contract WitnetPriceFeedsDefault && msg.sender == address(this) ) { address _solver = __records_(bytes4(bytes8(msg.data) << 32)).solver; - require( + _require( _solver != address(0), - "WitnetPriceFeeds: unsettled solver" + "unsettled solver" ); assembly { let ptr := mload(0x40) @@ -78,7 +83,7 @@ contract WitnetPriceFeedsDefault default { return(ptr, size) } } } else { - revert("WitnetPriceFeeds: not implemented"); + _revert("not implemented"); } } @@ -106,9 +111,9 @@ contract WitnetPriceFeedsDefault __baseFeeOverheadPercentage = 10; } else { // only the owner can initialize: - require( + _require( msg.sender == _owner, - "WitnetPriceFeeds: not the owner" + "not the owner" ); } @@ -116,17 +121,17 @@ contract WitnetPriceFeedsDefault __proxiable().codehash != bytes32(0) && __proxiable().codehash == codehash() ) { - revert("WitnetPriceFeeds: already upgraded"); + _revert("already upgraded"); } __proxiable().codehash = codehash(); - require( + _require( address(witnet).code.length > 0, - "WitnetPriceFeeds: inexistent oracle" + "inexistent oracle" ); - require( + _require( witnet.specs() == type(WitnetOracle).interfaceId, - "WitnetPriceFeeds: uncompliant oracle" + "uncompliant oracle" ); emit Upgraded(_owner, base(), codehash(), version()); } @@ -286,9 +291,9 @@ contract WitnetPriceFeedsDefault returns (bytes memory) { Record storage __record = __records_(feedId); - require( + _require( __record.radHash != 0, - "WitnetPriceFeeds: no RAD hash" + "no RAD hash" ); return _registry().bytecodeOf(__record.radHash); } @@ -304,15 +309,9 @@ contract WitnetPriceFeedsDefault override external view returns (Witnet.RadonRetrieval[] memory _retrievals) { - bytes32[] memory _hashes = registry().lookupRadonRequestSources(lookupWitnetRadHash(feedId)); - _retrievals = new Witnet.RadonRetrieval[](_hashes.length); - for (uint _ix = 0; _ix < _retrievals.length; _ix ++) { - _retrievals[_ix] = registry().lookupRadonRetrieval(_hashes[_ix]); - } - } - - function registry() public view virtual override returns (WitnetRequestBytecodes) { - return WitnetOracle(address(witnet)).registry(); + return _registry().lookupRadonRequestRetrievals( + lookupWitnetRadHash(feedId) + ); } function requestUpdate(bytes4 feedId) @@ -328,9 +327,9 @@ contract WitnetPriceFeedsDefault virtual override returns (uint256 _usedFunds) { - require( + _require( updateSLA.equalOrGreaterThan(__defaultRadonSLA), - "WitnetPriceFeeds: unsecure update" + "unsecure update" ); return __requestUpdate(feedId, updateSLA); } @@ -387,7 +386,7 @@ contract WitnetPriceFeedsDefault bytes4[] storage __ids = __storage().ids; Record storage __record = __records_(feedId); uint _index = __record.index; - require(_index != 0, "WitnetPriceFeeds: unknown feed"); + _require(_index != 0, "unknown feed"); { bytes4 _lastFeedId = __ids[__ids.length - 1]; __ids[_index - 1] = _lastFeedId; @@ -423,7 +422,7 @@ contract WitnetPriceFeedsDefault override public onlyOwner { - require(defaultSLA.isValid(), "WitnetPriceFeeds: invalid SLA"); + _require(defaultSLA.isValid(), "invalid SLA"); __defaultRadonSLA = defaultSLA; emit WitnetRadonSLA(defaultSLA); } @@ -432,9 +431,9 @@ contract WitnetPriceFeedsDefault override public onlyOwner { - require( - registry().lookupRadonRequestResultDataType(radHash) == dataType, - "WitnetPriceFeeds: bad result data type" + _require( + _registry().lookupRadonRequestResultDataType(radHash) == dataType, + "bad result data type" ); bytes4 feedId = hash(caption); Record storage __record = __records_(feedId); @@ -479,9 +478,9 @@ contract WitnetPriceFeedsDefault override external onlyOwner { - require( + _require( solver != address(0), - "WitnetPriceFeeds: no solver address" + "no solver address" ); bytes4 feedId = hash(caption); Record storage __record = __records_(feedId); @@ -509,8 +508,8 @@ contract WitnetPriceFeedsDefault assembly { _reason := add(_reason, 4) } - revert(string(abi.encodePacked( - "WitnetPriceFeedUpgradable: solver validation failed: ", + _revert(string(abi.encodePacked( + "solver validation failed: ", string(abi.decode(_reason,(string))) ))); } @@ -526,8 +525,8 @@ contract WitnetPriceFeedsDefault assembly { _reason := add(_reason, 4) } - revert(string(abi.encodePacked( - "WitnetPriceFeeds: smoke-test failed: ", + _revert(string(abi.encodePacked( + "smoke-test failed: ", string(abi.decode(_reason,(string))) ))); } @@ -708,10 +707,7 @@ contract WitnetPriceFeedsDefault try WitnetPriceFeedsLib.validateCaption(__prefix, caption) returns (uint8 _decimals) { return _decimals; } catch Error(string memory reason) { - revert(string(abi.encodePacked( - "WitnetPriceFeeds: ", - reason - ))); + _revert(reason); } } @@ -731,11 +727,8 @@ contract WitnetPriceFeedsDefault { Record storage __feed = __records_(feedId); if (__feed.radHash != 0) { - _usedFunds = estimateUpdateRequestFee(_getGasPrice()); - require( - msg.value >= _usedFunds, - "WitnetPriceFeeds: insufficient reward" - ); + _usedFunds = estimateUpdateRequestFee(tx.gasprice); + _require(msg.value >= _usedFunds, "insufficient reward"); uint _latestId = __feed.latestUpdateQueryId; Witnet.ResponseStatus _latestStatus = _checkQueryResponseStatus(_latestId); if (_latestStatus == Witnet.ResponseStatus.Awaiting) { @@ -746,13 +739,6 @@ contract WitnetPriceFeedsDefault if (_deltaReward > 0) { _usedFunds = uint(_deltaReward); witnet.upgradeQueryEvmReward{value: _usedFunds}(_latestId); - // solhint-disable avoid-tx-origin - emit PullingUpdate( - tx.origin, - _msgSender(), - feedId, - _latestId - ); } else { _usedFunds = 0; } @@ -790,7 +776,7 @@ contract WitnetPriceFeedsDefault querySLA ); } else { - revert("WitnetPriceFeeds: unknown feed"); + _revert("unknown feed"); } if (_usedFunds < msg.value) { // transfer back unused funds: diff --git a/contracts/core/defaults/WitnetRadonRegistryDefault.sol b/contracts/core/defaults/WitnetRadonRegistryDefault.sol index 73a7fd23..069ee2bc 100644 --- a/contracts/core/defaults/WitnetRadonRegistryDefault.sol +++ b/contracts/core/defaults/WitnetRadonRegistryDefault.sol @@ -4,7 +4,8 @@ pragma solidity >=0.8.4 <0.9.0; import "../WitnetUpgradableBase.sol"; import "../../WitnetRadonRegistry.sol"; -import "../../data/WitnetRequestBytecodesData.sol"; +import "../../data/WitnetRadonRegistryData.sol"; +import "../../interfaces/IWitnetRadonRegistryLegacy.sol"; import "../../libs/WitnetEncodingLib.sol"; /// @title Witnet Request Board EVM-default implementation contract. @@ -15,30 +16,41 @@ import "../../libs/WitnetEncodingLib.sol"; contract WitnetRadonRegistryDefault is WitnetRadonRegistry, - WitnetRequestBytecodesData, - WitnetUpgradableBase + WitnetRadonRegistryData, + WitnetUpgradableBase, + IWitnetRadonRegistryLegacy { using Witnet for bytes; using Witnet for string; using Witnet for Witnet.RadonSLA; - using WitnetEncodingLib for Witnet.RadonRetrievalMethods; + using WitnetEncodingLib for Witnet.RadonDataTypes; + using WitnetEncodingLib for Witnet.RadonReducer; using WitnetEncodingLib for Witnet.RadonRetrieval; using WitnetEncodingLib for Witnet.RadonRetrieval[]; - using WitnetEncodingLib for Witnet.RadonReducer; + using WitnetEncodingLib for Witnet.RadonRetrievalMethods; using WitnetEncodingLib for Witnet.RadonSLAv1; - using WitnetEncodingLib for Witnet.RadonDataTypes; - function class() - public view - virtual override(IWitnetAppliance, WitnetUpgradableBase) - returns (string memory) - { + function class() public view virtual override(IWitnetAppliance, WitnetUpgradableBase) returns (string memory) { return type(WitnetRadonRegistryDefault).name; } bytes4 public immutable override specs = type(WitnetRadonRegistry).interfaceId; + + modifier radonRequestExists(bytes32 _radHash) { + _require( + __database().requests[_radHash].aggregateTallyHashes != bytes32(0), + "unverified data request" + ); _; + } + modifier radonRetrievalExists(bytes32 _hash) { + _require( + __database().retrievals[_hash].method != Witnet.RadonRetrievalMethods.Unknown, + "unverified data source" + ); _; + } + constructor(bool _upgradable, bytes32 _versionTag) Ownable(address(msg.sender)) WitnetUpgradableBase( @@ -49,7 +61,7 @@ contract WitnetRadonRegistryDefault {} receive() external payable { - revert("WitnetRadonRegistry: no transfers"); + _revert("no transfers"); } @@ -117,14 +129,14 @@ contract WitnetRadonRegistryDefault } else { // only owner can initialize: if (msg.sender != _owner) { - revert("WitnetRadonRegistry: not the owner"); + _revert("not the owner"); } } if (__bytecodes().base != address(0)) { // current implementation cannot be initialized more than once: if(__bytecodes().base == base()) { - revert("WitnetRadonRegistry: already initialized"); + _revert("already initialized"); } } __bytecodes().base = base(); @@ -187,140 +199,147 @@ contract WitnetRadonRegistryDefault return _witnetHash(_radBytecode); } - function lookupDataProvider(uint256 _index) - external view - override - returns (string memory, uint256) - { - return ( - __database().providers[_index].authority, - __database().providers[_index].totalEndpoints - ); - } - - function lookupDataProviderIndex(string calldata _authority) - external view - override - returns (uint256) - { - return __database().providersIndex[keccak256(abi.encodePacked(_authority))]; - } - - function lookupDataProviderSources( - uint256 _index, - uint256 _offset, - uint256 _length - ) - external view - returns (bytes32[] memory _endpoints) - { - DataProvider storage __provider = __database().providers[_index]; - uint _totalEndpoints = __provider.totalEndpoints; - if (_offset < _totalEndpoints){ - if (_offset + _length > _totalEndpoints) { - _length = _totalEndpoints - _offset; - } - _endpoints = new bytes32[](_length); - for (uint _ix = 0; _ix < _endpoints.length; _ix ++) { - _endpoints[_ix] = __provider.endpoints[_ix + _offset]; - } - } + function lookupRadonReducer(bytes32 _hash) + override public view + returns (Witnet.RadonReducer memory _reducer) + { + _reducer = __database().reducers[_hash]; + _require(uint8(_reducer.opcode) != 0, "unverified data reducer"); } function lookupRadonRetrieval(bytes32 _hash) - external view - override + override external view + radonRetrievalExists(_hash) returns (Witnet.RadonRetrieval memory _source) { - _source = __database().retrievals[_hash]; - if (_source.method == Witnet.RadonRetrievalMethods.Unknown) { - revert UnknownRadonRetrieval(_hash); - } + return __database().retrievals[_hash]; } function lookupRadonRetrievalArgsCount(bytes32 _hash) - external view - override + override external view + radonRetrievalExists(_hash) returns (uint8) { - if (__database().retrievals[_hash].method == Witnet.RadonRetrievalMethods.Unknown) { - revert UnknownRadonRetrieval(_hash); - } return __database().retrievals[_hash].argsCount; } function lookupRadonRetrievalResultDataType(bytes32 _hash) - external view - override + override public view + radonRetrievalExists(_hash) returns (Witnet.RadonDataTypes) { - if (__database().retrievals[_hash].method == Witnet.RadonRetrievalMethods.Unknown) { - revert UnknownRadonRetrieval(_hash); - } - return __database().retrievals[_hash].resultDataType; + return __database().retrievals[_hash].dataType; } - - function lookupRadonReducer(bytes32 _hash) - external view - override - returns (Witnet.RadonReducer memory _reducer) - { - _reducer = __database().reducers[_hash]; - if (uint8(_reducer.opcode) == 0) { - revert UnknownRadonReducer(_hash); - } + + function lookupRadonRequest(bytes32 _radHash) + override external view + returns (Witnet.RadonRequest memory) + { + RadonRequestPacked storage __packed = __database().requests[_radHash]; + return Witnet.RadonRequest({ + retrieve: lookupRadonRequestRetrievals(_radHash), + aggregate: lookupRadonReducer(bytes32(bytes16(__packed.aggregateTallyHashes))), + tally: lookupRadonReducer(bytes32(bytes16(__packed.aggregateTallyHashes << 128))) + }); } function lookupRadonRequestAggregator(bytes32 _radHash) - external view - override + override external view + radonRequestExists(_radHash) returns (Witnet.RadonReducer memory) { - return __database().reducers[ - __requests(_radHash).aggregator - ]; + if (__requests(_radHash).legacyTallyHash != bytes32(0)) { + return lookupRadonReducer(__requests(_radHash).aggregateTallyHashes); + } else { + return lookupRadonReducer(bytes32(bytes16(__requests(_radHash).aggregateTallyHashes))); + } + } + + function lookupRadonRequestTally(bytes32 _radHash) + override external view + radonRequestExists(_radHash) + returns (Witnet.RadonReducer memory) + { + if (__requests(_radHash).legacyTallyHash != bytes32(0)) { + return lookupRadonReducer(__requests(_radHash).legacyTallyHash); + } else { + return lookupRadonReducer(bytes32(bytes16(__requests(_radHash).aggregateTallyHashes << 128))); + } } function lookupRadonRequestResultDataType(bytes32 _radHash) - external view - override + override external view + radonRequestExists(_radHash) returns (Witnet.RadonDataTypes) { - return __requests(_radHash).resultDataType; + return lookupRadonRetrievalResultDataType( + __database().requests[_radHash].retrievals[0] + ); } - function lookupRadonRequestResultMaxSize(bytes32 _radHash) - external view - override - returns (uint16) + function lookupRadonRequestRetrievalByIndex(bytes32 _radHash, uint256 _index) + override external view + radonRequestExists(_radHash) + returns (Witnet.RadonRetrieval memory) { - return uint16(__requests(_radHash).resultMaxSize); - } + _require(_index < __requests(_radHash).retrievals.length, "out of range"); + return __database().retrievals[ + __requests(_radHash).retrievals[_index] + ]; + } - function lookupRadonRequestSources(bytes32 _radHash) - external view - override - returns (bytes32[] memory) + function lookupRadonRequestRetrievals(bytes32 _radHash) + override public view + radonRequestExists(_radHash) + returns (Witnet.RadonRetrieval[] memory _retrievals) { - return __requests(_radHash).retrievals; + _retrievals = new Witnet.RadonRetrieval[](__requests(_radHash).retrievals.length); + for (uint _ix = 0; _ix < _retrievals.length; _ix ++) { + _retrievals[_ix] = __database().retrievals[ + __requests(_radHash).retrievals[_ix] + ]; + } } - function lookupRadonRequestSourcesCount(bytes32 _radHash) - external view - override - returns (uint) + + function verifyRadonReducer(Witnet.RadonReducer memory _reducer) + virtual override public + returns (bytes16 hash) { - return __requests(_radHash).retrievals.length; + hash = bytes16(keccak256(abi.encode(_reducer))); + Witnet.RadonReducer storage __reducer = __database().reducers[hash]; + if ( + uint8(__reducer.opcode) == 0 + && __reducer.filters.length == 0 + ) { + _reducer.validate(); + __reducer.opcode = _reducer.opcode; + __pushRadonReducerFilters(__reducer, _reducer.filters); + emit NewRadonReducer(hash); + } + } + + function verifyRadonRequest( + bytes32[] calldata retrieveHashes, + Witnet.RadonReducer calldata aggregate, + Witnet.RadonReducer calldata tally + ) + override external + returns (bytes32 radHash) + { + // TODO } - function lookupRadonRequestTally(bytes32 _radHash) - external view - override - returns (Witnet.RadonReducer memory) + function verifyRadonRequest( + bytes32[] calldata _retrieveHashes, + string[][] calldata _retrieveArgs, + Witnet.RadonReducer calldata _aggregate, + Witnet.RadonReducer calldata _tally + ) + override external + returns (bytes32 _radHash) { - return __database().reducers[ - __requests(_radHash).tally - ]; + // TODO } function verifyRadonRetrieval( @@ -330,8 +349,7 @@ contract WitnetRadonRegistryDefault string[2][] memory _requestHeaders, bytes calldata _requestRadonScript ) - public - virtual override + virtual override public returns (bytes32 hash) { // validate data source params @@ -361,7 +379,7 @@ contract WitnetRadonRegistryDefault method: _requestMethod, - resultDataType: + dataType: WitnetEncodingLib.verifyRadonScriptResultDataType(_requestRadonScript), url: @@ -373,151 +391,141 @@ contract WitnetRadonRegistryDefault headers: _requestHeaders, - script: + radonScript: _requestRadonScript }); - emit NewRadonRetrievalHash(hash); + emit NewRadonRetrieval(hash); } } - function verifyRadonReducer(Witnet.RadonReducer memory _reducer) - external returns (bytes32 hash) + + // ================================================================================================================ + // --- IWitnetRadonRegistryLegacy --------------------------------------------------------------------------------- + + function lookupRadonRequestResultMaxSize(bytes32) override external pure returns (uint16) { + return 32; + } + + function lookupRadonRequestSources(bytes32 _radHash) + override external view + radonRequestExists(_radHash) + returns (bytes32[] memory) { - hash = keccak256(abi.encode(_reducer)); - Witnet.RadonReducer storage __reducer = __database().reducers[hash]; - if ( - uint8(__reducer.opcode) == 0 - && __reducer.filters.length == 0 - ) { - _reducer.validate(); - __reducer.opcode = _reducer.opcode; - __pushRadonReducerFilters(__reducer, _reducer.filters); - emit NewRadonReducerHash(hash); - } + return __requests(_radHash).retrievals; + } + + function lookupRadonRequestSourcesCount(bytes32 _radHash) + override external view + radonRequestExists(_radHash) + returns (uint) + { + return __requests(_radHash).retrievals.length; } function verifyRadonRequest( - bytes32[] memory _retrievalsIds, - bytes32 _aggregatorId, - bytes32 _tallyId, - uint16 _resultMaxSize, - string[][] memory _args + bytes32[] memory _retrieveHashes, + bytes32 _aggregateReduceHash, + bytes32 _tallyReduceHash, + uint16, + string[][] memory _retrieveArgs ) - external - virtual override + virtual override public returns (bytes32 _radHash) { - // calculate unique hash + // check reducers are valid: + _require( + uint8(__database().reducers[_aggregateReduceHash].opcode) != 0, + "unknown aggregate reducer" + ); + _require( + uint8(__database().reducers[_tallyReduceHash].opcode) != 0, + "unknown tally reducer" + ); + + // calculate unique hash: bytes32 hash = keccak256(abi.encode( - _retrievalsIds, - _aggregatorId, - _tallyId, - _resultMaxSize, - _args + _retrieveHashes, + _aggregateReduceHash, + _tallyReduceHash, + _retrieveArgs )); - _radHash = __database().rads[hash]; + // verify, compose and register only if hash is not yet known: + _radHash = __database().rads[hash]; if (__database().rads[hash] == bytes32(0)) { // Check that at least one source is provided; - if (_retrievalsIds.length == 0) { - revert("WitnetRadonRegistry: no retrievals"); - } + _require( + _retrieveHashes.length > 0, + "no retrievals" + ); // Check that number of args arrays matches the number of sources: - if ( _retrievalsIds.length != _args.length) { - revert("WitnetRadonRegistry: args mismatch"); - } + _require( + _retrieveHashes.length == _retrieveArgs.length, + "args mismatch" + ); // Check sources and tally reducers: - Witnet.RadonReducer memory _aggregator = __database().reducers[_aggregatorId]; - Witnet.RadonReducer memory _tally = __database().reducers[_tallyId]; + Witnet.RadonReducer memory _aggregator = __database().reducers[_aggregateReduceHash]; + Witnet.RadonReducer memory _tally = __database().reducers[_tallyReduceHash]; // Check result type consistency among all sources: Witnet.RadonDataTypes _resultDataType; - Witnet.RadonRetrieval[] memory _retrievals = new Witnet.RadonRetrieval[](_retrievalsIds.length); - for (uint _ix = 0; _ix < _retrievals.length; _ix ++) { - _retrievals[_ix] = __database().retrievals[_retrievalsIds[_ix]]; + Witnet.RadonRetrieval[] memory _retrievals = new Witnet.RadonRetrieval[](_retrieveHashes.length); + for (uint _ix = 0; _ix < _retrieveHashes.length; _ix ++) { + _retrievals[_ix] = __database().retrievals[_retrieveHashes[_ix]]; + _require( + _retrievals[_ix].method != Witnet.RadonRetrievalMethods.Unknown, + "unknown retrieval" + ); // Check all sources return same Radon data type: if (_ix == 0) { - _resultDataType = _retrievals[0].resultDataType; - } else if (_retrievals[_ix].resultDataType != _resultDataType) { - revert("WitnetRadonRegistry: mismatching retrievals"); + _resultDataType = _retrievals[0].dataType; + } else if (_resultDataType != _retrievals[_ix].dataType) { + _revert("mismatching retrievals"); } // check enough args are provided for each source - if (_args[_ix].length < uint(_retrievals[_ix].argsCount)) { - revert("WitnetRadonRegistry: missing args"); + if (_retrieveArgs[_ix].length < uint(_retrievals[_ix].argsCount)) { + _revert("missing args"); } } - - // Check provided result type and result max size: - _resultMaxSize = _resultDataType.validate(_resultMaxSize); // Build radon retrieval bytecode: bytes memory _bytecode = _retrievals.encode( - _args, + _retrieveArgs, _aggregator.encode(), _tally.encode(), - _resultMaxSize + 0 //_resultMaxSize + ); + _require( + _bytecode.length <= 65535, + "too big request" ); - if (_bytecode.length > 65535) { - revert("WitnetRadonRegistry: too heavy request"); - } // Calculate radhash and add request metadata and rad bytecode to storage: _radHash = _witnetHash(_bytecode); __database().rads[hash] = _radHash; __database().radsBytecode[_radHash] = _bytecode; - __database().requests[_radHash] = DataRequest({ - aggregator: _aggregatorId, - args: _args, - radHash: _radHash, - resultDataType: _resultDataType, - resultMaxSize: _resultMaxSize, - retrievals: _retrievalsIds, - tally: _tallyId + __database().requests[_radHash] = RadonRequestPacked({ + _args: new string[][](0), + aggregateTallyHashes: (_aggregateReduceHash & 0xffffffffffffffffffffffffffffffff00000000000000000000000000000000) | (_tallyReduceHash >> 128), + _radHash: bytes32(0), + _resultDataType: Witnet.RadonDataTypes.Any, + _resultMaxSize: 0, + retrievals: _retrieveHashes, + legacyTallyHash: bytes32(0) }); - emit NewRadHash(_radHash); - } - } - function totalDataProviders() - external view - override - returns (uint) - { - return __bytecodes().totalDataProviders; + // Emit event + emit NewRadonRequest(_radHash); + } } // ================================================================================================================ // --- Internal state-modifying methods --------------------------------------------------------------------------- - function __pushDataProviderSource( - string memory _authority, - bytes32 _retrievalHash - ) - internal virtual - returns (bytes32 _hash) - { - if ( - bytes(_authority).length > 0 - && WitnetBuffer.argsCountOf(bytes(_authority)) == 0 - ) { - _hash = keccak256(abi.encodePacked(_authority)); - uint _index = __database().providersIndex[_hash]; - if (_index == 0) { - _index = ++ __bytecodes().totalDataProviders; - __database().providersIndex[keccak256(bytes(_authority))] = _index; - __database().providers[_index].authority = _authority; - emit NewDataProvider(_index); - } - __database().providers[_index].endpoints[ - __database().providers[_index].totalEndpoints ++ - ] = _retrievalHash; - } - } - function __pushRadonReducerFilters( Witnet.RadonReducer storage __reducer, Witnet.RadonFilter[] memory _filters diff --git a/contracts/core/defaults/WitnetRequestFactoryDefault.sol b/contracts/core/defaults/WitnetRequestFactoryDefault.sol index 00c0aab1..a1076dac 100644 --- a/contracts/core/defaults/WitnetRequestFactoryDefault.sol +++ b/contracts/core/defaults/WitnetRequestFactoryDefault.sol @@ -7,6 +7,7 @@ import "../WitnetUpgradableBase.sol"; import "../../WitnetRadonRegistry.sol"; import "../../WitnetRequestFactory.sol"; import "../../data/WitnetRequestFactoryData.sol"; +import "../../interfaces/IWitnetRadonRegistryLegacy.sol"; import "../../patterns/Clonable.sol"; contract WitnetRequestFactoryDefault @@ -15,42 +16,51 @@ contract WitnetRequestFactoryDefault WitnetRequest, WitnetRequestFactory, WitnetRequestFactoryData, + WitnetRequestTemplate, WitnetUpgradableBase { - /// @notice Reference to Witnet Data Requests Bytecode Registry. - WitnetRequestBytecodes immutable public override(WitnetRequestFactory, WitnetRequestTemplate) registry; - /// @notice Reference to the Witnet Request Board that all templates built out from this factory will refer to. WitnetOracle immutable public override witnet; + modifier notOnFactory { + _require( + address(this) != __proxy() + && address(this) != base(), + "not on factory" + ); _; + } + modifier onlyDelegateCalls override(Clonable, Upgradeable) { - require( + _require( address(this) != _BASE, - "WitnetRequestFactory: not a delegate call" - ); - _; + "not a delegate call" + ); _; } modifier onlyOnFactory { - require( + _require( address(this) == __proxy() || address(this) == base(), - "WitnetRequestFactory: not the factory" - ); - _; + "not the factory" + ); _; + } + + modifier onlyOnRequests { + _require( + __witnetRequest().radHash != bytes32(0), + "not a request" + ); _; } modifier onlyOnTemplates { - require( - __witnetRequestTemplate().tally != bytes32(0), - "WitnetRequestFactory: not a WitnetRequestTemplate" - ); - _; + _require( + __witnetRequestTemplate().tallyReduceHash != bytes32(0), + "not a template" + ); _; } constructor( WitnetOracle _witnet, - WitnetRequestBytecodes _registry, bool _upgradable, bytes32 _versionTag ) @@ -62,163 +72,42 @@ contract WitnetRequestFactoryDefault ) { witnet = _witnet; - registry = _registry; // let logic contract be used as a factory, while avoiding further initializations: __proxiable().proxy = address(this); __proxiable().implementation = address(this); __witnetRequestFactory().owner = address(0); } - function initializeWitnetRequestTemplate( - bytes32[] calldata _retrievalsIds, - bytes32 _aggregatorId, - bytes32 _tallyId, - uint16 _resultDataMaxSize - ) - virtual public - initializer - returns (WitnetRequestTemplate) - { - // check that at least one retrieval is provided - Witnet.RadonDataTypes _resultDataType; - require( - _retrievalsIds.length > 0, - "WitnetRequestTemplate: no retrievals?" - ); - // check that all retrievals exist in the registry, - // and they all return the same data type - bool _parameterized; - for (uint _ix = 0; _ix < _retrievalsIds.length; _ix ++) { - bytes32 _retrievalHash = _retrievalsIds[_ix]; - if (_ix == 0) { - _resultDataType = registry.lookupRadonRetrievalResultDataType(_retrievalHash); - } else { - require( - _resultDataType == registry.lookupRadonRetrievalResultDataType(_retrievalHash), - "WitnetRequestTemplate: mismatching retrievals" - ); - } - if (!_parameterized) { - // check whether at least one of the retrievals is parameterized - _parameterized = registry.lookupRadonRetrievalArgsCount(_retrievalHash) > 0; - } - } - { - // check that the aggregator and tally reducers actually exist in the registry - registry.lookupRadonReducer(_aggregatorId); - registry.lookupRadonReducer(_tallyId); - - // write data into storage: - WitnetRequestTemplateSlot storage __data = __witnetRequestTemplate(); - __data.aggregator = _aggregatorId; - __data.factory = WitnetRequestFactory(msg.sender); - __data.parameterized = _parameterized; - __data.resultDataType = _resultDataType; - __data.resultDataMaxSize = _resultDataMaxSize; - __data.retrievals = _retrievalsIds; - __data.tally = _tallyId; - } - return WitnetRequestTemplate(address(this)); + function _getWitnetRadonRegistry() virtual internal view returns (WitnetRadonRegistry) { + return witnet.registry(); } - function initializeWitnetRequest( - bytes32 _radHash, - string[][] memory _args - ) - virtual public - initializer + function initializeWitnetRequest(bytes32 _radHash) + virtual public initializer returns (address) { - WitnetRequestSlot storage __data = __witnetRequest(); - __data.args = _args; - __data.radHash = _radHash; - __data.template = WitnetRequestTemplate(msg.sender); + _require(_radHash != bytes32(0), "no rad hash?"); + __witnetRequest().radHash = _radHash; return address(this); } - - /// =============================================================================================================== - /// --- IWitnetRequestFactory implementation ---------------------------------------------------------------------- - - function buildRequestTemplate( - bytes32[] memory _retrievals, - bytes32 _aggregator, - bytes32 _tally, - uint16 _resultDataMaxSize + function initializeWitnetRequestTemplate( + bytes32[] calldata _retrieveHashes, + bytes16 _aggregateReduceHash, + bytes16 _tallyReduceHash ) - virtual override - public - onlyOnFactory - returns (address _template) - { - bytes32 _salt = keccak256( - // As to avoid template address collisions from: - abi.encodePacked( - // - different factory major or mid versions: - bytes4(_WITNET_UPGRADABLE_VERSION), - // - different templates params: - _retrievals, - _aggregator, - _tally, - _resultDataMaxSize - ) - ); - _template = address(uint160(uint256(keccak256( - abi.encodePacked( - bytes1(0xff), - address(this), - _salt, - keccak256(_cloneBytecode()) - ) - )))); - if (_template.code.length == 0) { - _template = address(WitnetRequestFactoryDefault( - _cloneDeterministic(_salt) - ).initializeWitnetRequestTemplate( - _retrievals, - _aggregator, - _tally, - _resultDataMaxSize - )); - } - emit WitnetRequestTemplateBuilt( - _template, - WitnetRequestTemplate(_template).parameterized() - ); - } - - function class() - virtual override(IWitnetAppliance, WitnetUpgradableBase) - public view - returns (string memory) - { - if ( - address(this) == _SELF - || address(this) == __proxy() - ) { - return type(WitnetRequestFactory).name; - } else if (__witnetRequest().radHash != bytes32(0)) { - return type(WitnetRequest).name; - } else { - return type(WitnetRequestTemplate).name; - } - } - - function specs() - virtual override - external view - returns (bytes4) - { - if ( - address(this) == _SELF - || address(this) == __proxy() - ) { - return type(IWitnetRequestFactory).interfaceId; - } else if (__witnetRequest().radHash != bytes32(0)) { - return type(WitnetRequest).interfaceId; - } else { - return type(WitnetRequestTemplate).interfaceId; - } + virtual public initializer + returns (address) + { + _require(_retrieveHashes.length > 0, "no retrievals?"); + _require(_aggregateReduceHash != bytes16(0), "no aggregate reducer?"); + _require(_tallyReduceHash != bytes16(0), "no tally reducer?"); + + WitnetRequestTemplateStorage storage __data = __witnetRequestTemplate(); + __data.retrieveHashes = _retrieveHashes; + __data.aggregateReduceHash = _aggregateReduceHash; + __data.tallyReduceHash = _tallyReduceHash; + return address(this); } @@ -236,8 +125,8 @@ contract WitnetRequestFactoryDefault /// @notice Returns the address of the current owner. function owner() - public view virtual override + public view returns (address) { return __witnetRequestFactory().owner; @@ -246,8 +135,7 @@ contract WitnetRequestFactoryDefault /// @notice Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. /// @dev Can only be called by the current owner. function transferOwnership(address _newOwner) - public - virtual override + virtual override public onlyOwner { __witnetRequestFactory().pendingOwner = _newOwner; @@ -275,51 +163,48 @@ contract WitnetRequestFactoryDefault /// @notice Re-initialize contract's storage context upon a new upgrade from a proxy. /// @dev Must fail when trying to upgrade to same logic contract more than once. function initialize(bytes memory _initData) - virtual override - public + virtual override public onlyDelegateCalls { - // WitnetRequest or WitnetRequestTemplate instances would already be initialized, - // so only callable from proxies, in practice. - - address _owner = __witnetRequestFactory().owner; - if (_owner == address(0)) { - // set owner from the one specified in _initData - _owner = abi.decode(_initData, (address)); - __witnetRequestFactory().owner = _owner; - } else { - // only owner can initialize the proxy - if (msg.sender != _owner) { - revert("WitnetRequestFactory: not the owner"); + _require(!initialized(), "already initialized"); + + // Trying to intialize an upgradable factory instance... + { + address _owner = __witnetRequestFactory().owner; + if (_owner == address(0)) { + // Upon first initialization of an upgradable factory, + // set owner from the one specified in _initData + _owner = abi.decode(_initData, (address)); + __witnetRequestFactory().owner = _owner; + } else { + // only the owner can upgrade an upgradable factory + _require( + msg.sender == _owner, + "not the owner" + ); } - } - if (__proxiable().proxy == address(0)) { - // first initialization of the proxy - __proxiable().proxy = address(this); - } - - if (__proxiable().implementation != address(0)) { - // same implementation cannot be initialized more than once: - if(__proxiable().implementation == base()) { - revert("WitnetRequestFactory: already initialized"); + if (__proxiable().proxy == address(0)) { + // first initialization of the proxy + __proxiable().proxy = address(this); } - } - __proxiable().implementation = base(); + __proxiable().implementation = base(); - require(address(registry).code.length > 0, "WitnetRequestFactory: inexistent requests registry"); - require(registry.specs() == type(WitnetRadonRegistry).interfaceId, "WitnetRequestFactory: uncompliant requests registry"); - - emit Upgraded(msg.sender, base(), codehash(), version()); + _require(address(witnet).code.length > 0, "inexistent request board"); + _require(witnet.specs() == type(WitnetOracle).interfaceId, "uncompliant request board"); + + emit Upgraded(msg.sender, base(), codehash(), version()); + } } /// Tells whether provided address could eventually upgrade the contract. function isUpgradableFrom(address _from) external view override returns (bool) { address _owner = __witnetRequestFactory().owner; return ( - // false if the WRB is intrinsically not upgradable, or `_from` is no owner + // false if the logic contract is intrinsically not upgradable, or `_from` is no owner isUpgradable() && _owner == _from + && _owner != address(0) ); } @@ -328,15 +213,15 @@ contract WitnetRequestFactoryDefault /// --- Clonable implementation and override ---------------------------------------------------------------------- /// @notice Tells whether a WitnetRequest or a WitnetRequestTemplate has been properly initialized. - /// @dev True only on WitnetRequest instances with some Radon SLA set. function initialized() virtual override(Clonable) public view returns (bool) { return ( - __witnetRequestTemplate().tally != bytes32(0) + __witnetRequestTemplate().tallyReduceHash != bytes16(0) || __witnetRequest().radHash != bytes32(0) + || __implementation() == base() ); } @@ -354,275 +239,359 @@ contract WitnetRequestFactoryDefault /// =============================================================================================================== - /// --- WitnetRequest implementation ------------------------------------------------------------------------------ + /// --- IWitnetRequestFactory, IWitnetRequestTemplate, IWitnetRequest polymorphic methods ------------------------- - function bytecode() - override - external view - returns (bytes memory) - { - return registry.bytecodeOf(__witnetRequest().radHash); - } - - function template() - override - external view - onlyDelegateCalls - returns (WitnetRequestTemplate) - { - return __witnetRequest().template; - } - - function args() - override - external view - onlyDelegateCalls - returns (string[][] memory) - { - return __witnetRequest().args; - } - - function radHash() - override - external view - onlyDelegateCalls - returns (bytes32) - { - return __witnetRequest().radHash; - } - - function version() - virtual override(WitnetRequestTemplate, WitnetUpgradableBase) + function class() + virtual override(IWitnetAppliance, WitnetUpgradableBase) public view returns (string memory) { - return WitnetUpgradableBase.version(); + if (__witnetRequest().radHash != bytes32(0)) { + return type(WitnetRequest).name; + } else if (__witnetRequestTemplate().tallyReduceHash != bytes16(0)) { + return type(WitnetRequestTemplate).name; + } else { + return type(WitnetRequestFactory).name; + } } - - /// =============================================================================================================== - /// --- WitnetRequestTemplate implementation ---------------------------------------------------------------------- - - function factory() - override + function specs() + virtual override external view - onlyDelegateCalls - returns (WitnetRequestFactory) + returns (bytes4) { - WitnetRequestTemplate _template = __witnetRequest().template; - if (address(_template) != address(0)) { - return _template.factory(); + if (__witnetRequest().radHash != bytes32(0)) { + return type(WitnetRequest).interfaceId; + } else if (__witnetRequestTemplate().tallyReduceHash != bytes16(0)) { + return type(WitnetRequestTemplate).interfaceId; } else { - return __witnetRequestTemplate().factory; + return type(WitnetRequestFactory).interfaceId; } } - function aggregator() - override + + /// =============================================================================================================== + /// --- IWitnetRequestTemplate, IWitnetRequest polymorphic methods ------------------------------------------------ + + function getRadonReducers() + virtual override (IWitnetRequest, IWitnetRequestTemplate) external view - onlyDelegateCalls - returns (bytes32) - { - WitnetRequestTemplate _template = __witnetRequest().template; - if (address(_template) != address(0)) { - return _template.aggregator(); + notOnFactory + returns (Witnet.RadonReducer memory, Witnet.RadonReducer memory) + { + WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); + if (__witnetRequest().radHash != bytes32(0)) { + return ( + _registry.lookupRadonRequestAggregator(__witnetRequest().radHash), + _registry.lookupRadonRequestTally(__witnetRequest().radHash) + ); } else { - return __witnetRequestTemplate().aggregator; + return ( + _registry.lookupRadonReducer(__witnetRequestTemplate().aggregateReduceHash), + _registry.lookupRadonReducer(__witnetRequestTemplate().tallyReduceHash) + ); } } - function parameterized() - override - external view - onlyDelegateCalls - returns (bool) + function getRadonRetrievalByIndex(uint256 _index) + virtual override (IWitnetRequest, IWitnetRequestTemplate) + external view + notOnFactory + returns (Witnet.RadonRetrieval memory) { - WitnetRequestTemplate _template = __witnetRequest().template; - if (address(_template) != address(0)) { - return _template.parameterized(); + if (__witnetRequest().radHash != bytes32(0)) { + return _getWitnetRadonRegistry().lookupRadonRequestRetrievalByIndex( + __witnetRequest().radHash, + _index + ); } else { - return __witnetRequestTemplate().parameterized; + _require( + _index < __witnetRequestTemplate().retrieveHashes.length, + "index out of range" + ); + return _getWitnetRadonRegistry().lookupRadonRetrieval( + __witnetRequestTemplate().retrieveHashes[_index] + ); } } - function resultDataMaxSize() - override + function getRadonRetrievals() + virtual override (IWitnetRequest, IWitnetRequestTemplate) external view - onlyDelegateCalls - returns (uint16) + notOnFactory + returns (Witnet.RadonRetrieval[] memory _retrievals) { - WitnetRequestTemplate _template = __witnetRequest().template; - if (address(_template) != address(0)) { - return _template.resultDataMaxSize(); + WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); + if (__witnetRequest().radHash != bytes32(0)) { + return _registry.lookupRadonRequestRetrievals( + __witnetRequest().radHash + ); } else { - return __witnetRequestTemplate().resultDataMaxSize; + _retrievals = new Witnet.RadonRetrieval[](__witnetRequestTemplate().retrieveHashes.length); + for (uint _ix = 0; _ix < _retrievals.length; _ix ++) { + _retrievals[_ix] = _registry.lookupRadonRetrieval( + __witnetRequestTemplate().retrieveHashes[_ix] + ); + } } } - function resultDataType() - override + function getResultDataType() + virtual override (IWitnetRequest, IWitnetRequestTemplate) external view - onlyDelegateCalls + notOnFactory returns (Witnet.RadonDataTypes) { - WitnetRequestTemplate _template = __witnetRequest().template; - if (address(_template) != address(0)) { - return _template.resultDataType(); + if (__witnetRequest().radHash != bytes32(0)) { + return _getWitnetRadonRegistry().lookupRadonRequestResultDataType( + __witnetRequest().radHash + ); } else { - return __witnetRequestTemplate().resultDataType; + return _getWitnetRadonRegistry().lookupRadonRetrievalResultDataType( + __witnetRequestTemplate().retrieveHashes[0] + ); } } - function retrievals() - override - external view - onlyDelegateCalls - returns (bytes32[] memory) + function version() + virtual override(IWitnetRequest, IWitnetRequestTemplate, WitnetUpgradableBase) + public view + returns (string memory) { - WitnetRequestTemplate _template = __witnetRequest().template; - if (address(_template) != address(0)) { - return _template.retrievals(); - } else { - return __witnetRequestTemplate().retrievals; - } + return WitnetUpgradableBase.version(); } - function tally() - override - external view - onlyDelegateCalls - returns (bytes32) + + /// =============================================================================================================== + /// --- IWitnetRequestFactory implementation ---------------------------------------------------------------------- + + function buildWitnetRequest( + bytes32[] calldata _retrieveHashes, + Witnet.RadonReducer calldata _aggregate, + Witnet.RadonReducer calldata _tally + ) + virtual override external + onlyOnFactory + returns (address) { - WitnetRequestTemplate _template = __witnetRequest().template; - if (address(_template) != address(0)) { - return _template.tally(); - } else { - return __witnetRequestTemplate().tally; + WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); + + // TODO: checks and reducers verification should be done by the registry instead ... + + // Check input retrievals: + _require( + !_checkParameterizedRadonRetrievals(_registry, _retrieveHashes), + "parameterized retrievals" + ); + + // Check input reducers: + bytes16 _aggregateReduceHash = _registry.verifyRadonReducer(_aggregate); + bytes16 _tallyReduceHash = _registry.verifyRadonReducer(_tally); + + // Verify Radon Request: + bytes32 _radHash = IWitnetRadonRegistryLegacy(address(_registry)).verifyRadonRequest( + _retrieveHashes, + bytes32(_aggregateReduceHash), + bytes32(_tallyReduceHash), + uint16(0), + new string[][](0) + ); + + // Determine request's minimal-proxy counter-factual salt and address: + (address _requestAddr, bytes32 _requestSalt) = _determineWitnetRequestAddressAndSalt(_radHash); + + // Create and initialize counter-factual request just once: + if (_requestAddr.code.length == 0) { + _requestAddr = WitnetRequestFactoryDefault(_cloneDeterministic(_requestSalt)) + .initializeWitnetRequest( + _radHash + ); } - } - function getRadonAggregator() - override - external view - onlyDelegateCalls - returns (Witnet.RadonReducer memory) + // Emit event even when building same request more than once + emit WitnetRequestBuilt(_requestAddr); + return _requestAddr; + } + + function buildWitnetRequestTemplate( + bytes32[] calldata _retrieveHashes, + Witnet.RadonReducer calldata _aggregate, + Witnet.RadonReducer calldata _tally + ) + virtual override external + onlyOnFactory + returns (address) { - WitnetRequestTemplate _template = __witnetRequest().template; - if (address(_template) != address(0)) { - return _template.getRadonAggregator(); - } else { - return registry.lookupRadonReducer( - __witnetRequestTemplate().aggregator + WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); + + // Check input retrievals: + _require( + _checkParameterizedRadonRetrievals(_registry, _retrieveHashes), + "non-parameterized retrievals" + ); + + // Check input reducers: + bytes16 _aggregateReduceHash = _registry.verifyRadonReducer(_aggregate); + bytes16 _tallyReduceHash = _registry.verifyRadonReducer(_tally); + + // Determine template's minimal-proxy counter-factual salt and address: + (address _templateAddr, bytes32 _templateSalt) = _determineWitnetRequestTemplateAddressAndSalt( + _retrieveHashes, + _aggregateReduceHash, + _tallyReduceHash + ); + + // Create and initialize counter-factual template just once: + if (_templateAddr.code.length == 0) { + _templateAddr = address( + WitnetRequestFactoryDefault(_cloneDeterministic(_templateSalt)) + .initializeWitnetRequestTemplate( + _retrieveHashes, + _aggregateReduceHash, + _tallyReduceHash + ) ); } + + // Emit event even when building same template more than one + emit WitnetRequestTemplateBuilt(_templateAddr); + return _templateAddr; } - function getRadonRetrievalByIndex(uint256 _index) - override - external view - onlyDelegateCalls - returns (Witnet.RadonRetrieval memory) - { - WitnetRequestTemplate _template = __witnetRequest().template; - if (address(_template) != address(0)) { - return _template.getRadonRetrievalByIndex(_index); - } else { - require( - _index < __witnetRequestTemplate().retrievals.length, - "WitnetRequestTemplate: out of range" - ); - return registry.lookupRadonRetrieval( - __witnetRequestTemplate().retrievals[_index] - ); - } + function verifyRadonRetrieval( + Witnet.RadonRetrievalMethods _requestMethod, + string calldata _requestURL, + string calldata _requestBody, + string[2][] calldata _requestHeaders, + bytes calldata _requestRadonScript + ) + virtual override external + onlyOnFactory + returns (bytes32 _retrievalHash) + { + return _getWitnetRadonRegistry().verifyRadonRetrieval( + _requestMethod, + _requestURL, + _requestBody, + _requestHeaders, + _requestRadonScript + ); } - function getRadonRetrievalsCount() - override - external view - onlyDelegateCalls - returns (uint256) + + /// =============================================================================================================== + /// --- IWitnetRequestTemplate implementation --------------------------------------------------------------------- + + function buildWitnetRequest(string[][] calldata _retrieveArgs) + override external + onlyOnTemplates + returns (address _request) { - WitnetRequestTemplate _template = __witnetRequest().template; - if (address(_template) != address(0)) { - return _template.getRadonRetrievalsCount(); - } else { - return __witnetRequestTemplate().retrievals.length; + WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); + WitnetRequestTemplateStorage storage __template = __witnetRequestTemplate(); + + // Verify Radon Request using template's retrieve hashes, aggregate and tally reducers, + // and given args: + bytes32 _radHash = IWitnetRadonRegistryLegacy(address(_registry)).verifyRadonRequest( + __template.retrieveHashes, + bytes32(__template.aggregateReduceHash), + bytes32(__template.tallyReduceHash), + 0, + _retrieveArgs + ); + + // Determine request's minimal-proxy counter-factual salt and address: + (address _requestAddr, bytes32 _requestSalt) = _determineWitnetRequestAddressAndSalt(_radHash); + + // Create and initialize counter-factual request just once: + if (_requestAddr.code.length == 0) { + _requestAddr = WitnetRequestFactoryDefault(_cloneDeterministic(_requestSalt)) + .initializeWitnetRequest( + _radHash + ); } + + // Emit event even when building same request more than once + emit WitnetRequestBuilt(_requestAddr); + return _requestAddr; } - function getRadonTally() - override - external view - onlyDelegateCalls - returns (Witnet.RadonReducer memory) + function getArgsCount() + override external view + onlyOnTemplates + returns (uint256[] memory _argsCount) { - WitnetRequestTemplate _template = __witnetRequest().template; - if (address(_template) != address(0)) { - return _template.getRadonTally(); - } else { - return registry.lookupRadonReducer( - __witnetRequestTemplate().tally + + WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); + _argsCount = new uint256[](__witnetRequestTemplate().retrieveHashes.length); + for (uint _ix = 0; _ix < _argsCount.length; _ix ++) { + _argsCount[_ix] = _registry.lookupRadonRetrievalArgsCount( + __witnetRequestTemplate().retrieveHashes[_ix] ); } } - function buildRequest(string[][] memory _args) - virtual override - public - onlyDelegateCalls - returns (address _request) + function verifyRadonRequest(string[][] calldata _args) + override external + onlyOnTemplates + returns (bytes32) { - // if called on a WitnetRequest instance: - if (address(__witnetRequest().template) != address(0)) { - // ...surrogate to request's template - return __witnetRequest().template.buildRequest(_args); - } - WitnetRequestTemplateSlot storage __data = __witnetRequestTemplate(); - bytes32 _radHash = registry.verifyRadonRequest( - __data.retrievals, - __data.aggregator, - __data.tally, - __data.resultDataMaxSize, + return IWitnetRadonRegistryLegacy(address(_getWitnetRadonRegistry())).verifyRadonRequest( + __witnetRequestTemplate().retrieveHashes, + bytes32(__witnetRequestTemplate().aggregateReduceHash), + bytes32(__witnetRequestTemplate().tallyReduceHash), + 0, _args ); - // the request address will be determined by the template's address, - // the request's radHash and the factory's implementation version: - bytes32 _salt; - (_request, _salt) = _determineRequestAddressAndSalt(_radHash); - if (_request.code.length == 0) { - _request = WitnetRequestFactoryDefault(_cloneDeterministic(_salt)) - .initializeWitnetRequest( - _radHash, - _args - ); - } - emit WitnetRequestBuilt(_request, _radHash, _args); } - function verifyRadonRequest(string[][] memory _args) - virtual override - public - onlyDelegateCalls - returns (bytes32 _radHash) + /// =============================================================================================================== + /// --- IWitnetRequest implementation ----------------------------------------------------------------------------- + + function bytecode() + override external view + onlyOnRequests + returns (bytes memory) { - // if called on a WitnetRequest instance: - if (address(__witnetRequest().template) != address(0)) { - // ...surrogate to request's template - return __witnetRequest().template.verifyRadonRequest(_args); - } - WitnetRequestTemplateSlot storage __data = __witnetRequestTemplate(); - _radHash = registry.verifyRadonRequest( - __data.retrievals, - __data.aggregator, - __data.tally, - __data.resultDataMaxSize, - _args + return _getWitnetRadonRegistry().bytecodeOf( + __witnetRequest().radHash ); } - function _determineRequestAddressAndSalt(bytes32 _radHash) - internal view + function radHash() + override external view + onlyOnRequests + returns (bytes32) + { + return __witnetRequest().radHash; + } + + + /// =============================================================================================================== + /// --- Internal methods ------------------------------------------------------------------------------------------ + + function _checkParameterizedRadonRetrievals(WitnetRadonRegistry _registry, bytes32[] calldata _retrieveHashes) + internal view returns (bool _parameterized) + { + Witnet.RadonDataTypes _resultDataType; + for (uint _ix = 0; _ix < _retrieveHashes.length; _ix ++) { + bytes32 _retrievalHash = _retrieveHashes[_ix]; + if (_ix == 0) { + _resultDataType = _registry.lookupRadonRetrievalResultDataType(_retrievalHash); + } else { + _require( + _resultDataType == _registry.lookupRadonRetrievalResultDataType(_retrievalHash), + "mistmaching retrievals" + ); + } + if (!_parameterized) { + _parameterized = _registry.lookupRadonRetrievalArgsCount(_retrievalHash) > 0; + } + } + } + + function _determineWitnetRequestAddressAndSalt(bytes32 _radHash) + virtual internal view returns (address, bytes32) { bytes32 _salt = keccak256( @@ -642,4 +611,35 @@ contract WitnetRequestFactoryDefault )))), _salt ); } + + function _determineWitnetRequestTemplateAddressAndSalt( + bytes32[] calldata _retrieveHashes, + bytes16 _aggregateReduceHash, + bytes16 _tallyReduceHash + ) + virtual internal view + returns (address, bytes32) + { + bytes32 _salt = keccak256( + // As to avoid template address collisions from: + abi.encodePacked( + // - different factory major or mid versions: + bytes4(_WITNET_UPGRADABLE_VERSION), + // - different templates params: + _retrieveHashes, + _aggregateReduceHash, + _tallyReduceHash + ) + ); + return ( + address(uint160(uint256(keccak256( + abi.encodePacked( + bytes1(0xff), + address(this), + _salt, + keccak256(_cloneBytecode()) + ) + )))), _salt + ); + } } \ No newline at end of file diff --git a/contracts/data/WitnetRequestBytecodesData.sol b/contracts/data/WitnetRadonRegistryData.sol similarity index 77% rename from contracts/data/WitnetRequestBytecodesData.sol rename to contracts/data/WitnetRadonRegistryData.sol index c9fde48a..c4b55a83 100644 --- a/contracts/data/WitnetRequestBytecodesData.sol +++ b/contracts/data/WitnetRadonRegistryData.sol @@ -6,7 +6,7 @@ import "../libs/Witnet.sol"; /// @title Witnet Request Board base data model. /// @author The Witnet Foundation. -abstract contract WitnetRequestBytecodesData { +abstract contract WitnetRadonRegistryData { bytes32 private constant _WITNET_BYTECODES_DATA_SLOTHASH = /* keccak256("io.witnet.bytecodes.data") */ @@ -18,8 +18,6 @@ abstract contract WitnetRequestBytecodesData { address pendingOwner; Database db; - uint256 totalDataProviders; - // ... } struct DataProvider { @@ -28,26 +26,25 @@ abstract contract WitnetRequestBytecodesData { mapping (uint256 => bytes32) endpoints; } - struct DataRequest { - string[][] args; - bytes32 aggregator; - bytes32 radHash; - Witnet.RadonDataTypes resultDataType; - uint16 resultMaxSize; + struct RadonRequestPacked { + string[][] _args; + bytes32 aggregateTallyHashes; + bytes32 _radHash; + Witnet.RadonDataTypes _resultDataType; + uint16 _resultMaxSize; bytes32[] retrievals; - bytes32 tally; + bytes32 legacyTallyHash; } struct Database { - mapping (uint256 => DataProvider) providers; - mapping (bytes32 => uint256) providersIndex; + bytes32 _reservedSlot0; + bytes32 _reservedSlot1; mapping (bytes32 => Witnet.RadonReducer) reducers; mapping (bytes32 => Witnet.RadonRetrieval) retrievals; - mapping (bytes32 => DataRequest) requests; + mapping (bytes32 => RadonRequestPacked) requests; mapping (bytes32 => bytes32) rads; mapping (bytes32 => bytes) radsBytecode; - mapping (bytes32 => bytes) _slasBytecode; } constructor() { @@ -79,7 +76,7 @@ abstract contract WitnetRequestBytecodesData { function __requests(bytes32 _radHash) internal view - returns (DataRequest storage _ptr) + returns (RadonRequestPacked storage _ptr) { return __database().requests[_radHash]; } diff --git a/contracts/data/WitnetRequestFactoryData.sol b/contracts/data/WitnetRequestFactoryData.sol index 6679dfd6..0282bb80 100644 --- a/contracts/data/WitnetRequestFactoryData.sol +++ b/contracts/data/WitnetRequestFactoryData.sol @@ -4,6 +4,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "../WitnetRequest.sol"; +import "../WitnetRequestTemplate.sol"; contract WitnetRequestFactoryData { @@ -19,40 +20,30 @@ contract WitnetRequestFactoryData { /* keccak256("io.witnet.data.request.template") */ 0x50402db987be01ecf619cd3fb022cf52f861d188e7b779dd032a62d082276afb; - struct Slot { + struct WitnetRequestFactoryStorage { address owner; address pendingOwner; } - struct WitnetRequestSlot { - /// Array of string arguments passed upon initialization. - string[][] args; + struct WitnetRequestStorage { /// Radon RAD hash. bytes32 radHash; - /// Parent WitnetRequestTemplate contract. - WitnetRequestTemplate template; + // /// Array of string arguments passed upon initialization. + // string[][] args; } - struct WitnetRequestTemplateSlot { - /// @notice Aggregator reducer hash. - bytes32 aggregator; - /// @notice Parent IWitnetRequestFactory from which this template was built. - WitnetRequestFactory factory; - /// Whether any of the sources is parameterized. - bool parameterized; - /// @notice Tally reducer hash. - bytes32 tally; + struct WitnetRequestTemplateStorage { /// @notice Array of retrievals hashes passed upon construction. - bytes32[] retrievals; - /// @notice Result data type. - Witnet.RadonDataTypes resultDataType; - /// @notice Result max size or rank (if variable type). - uint16 resultDataMaxSize; + bytes32[] retrieveHashes; + /// @notice Aggregator reduce hash. + bytes16 aggregateReduceHash; + /// @notice Tally reduce hash. + bytes16 tallyReduceHash; } function __witnetRequestFactory() internal pure - returns (Slot storage ptr) + returns (WitnetRequestFactoryStorage storage ptr) { assembly { ptr.slot := _WITNET_REQUEST_FACTORY_SLOTHASH @@ -61,7 +52,7 @@ contract WitnetRequestFactoryData { function __witnetRequest() internal pure - returns (WitnetRequestSlot storage ptr) + returns (WitnetRequestStorage storage ptr) { assembly { ptr.slot := _WITNET_REQUEST_SLOTHASH @@ -70,7 +61,7 @@ contract WitnetRequestFactoryData { function __witnetRequestTemplate() internal pure - returns (WitnetRequestTemplateSlot storage ptr) + returns (WitnetRequestTemplateStorage storage ptr) { assembly { ptr.slot := _WITNET_REQUEST_TEMPLATE_SLOTHASH diff --git a/contracts/interfaces/IWitnetFeedsAdmin.sol b/contracts/interfaces/IWitnetFeedsAdmin.sol index 0761c956..b2fa501b 100644 --- a/contracts/interfaces/IWitnetFeedsAdmin.sol +++ b/contracts/interfaces/IWitnetFeedsAdmin.sol @@ -3,7 +3,9 @@ pragma solidity >=0.8.0 <0.9.0; import "../libs/Witnet.sol"; + import "../WitnetRequest.sol"; +import "../WitnetRequestTemplate.sol"; interface IWitnetFeedsAdmin { @@ -22,7 +24,7 @@ interface IWitnetFeedsAdmin { function settleDefaultRadonSLA(Witnet.RadonSLA calldata) external; function settleFeedRequest(string calldata caption, bytes32 radHash) external; function settleFeedRequest(string calldata caption, WitnetRequest request) external; - function settleFeedRequest(string calldata caption, IWitnetRequestTemplate template, string[][] calldata) external; + function settleFeedRequest(string calldata caption, WitnetRequestTemplate template, string[][] calldata) external; function settleFeedSolver (string calldata caption, address solver, string[] calldata deps) external; function transferOwnership(address) external; } \ No newline at end of file diff --git a/contracts/interfaces/IWitnetOracleEvents.sol b/contracts/interfaces/IWitnetOracleEvents.sol index 671d17b1..59993f9e 100644 --- a/contracts/interfaces/IWitnetOracleEvents.sol +++ b/contracts/interfaces/IWitnetOracleEvents.sol @@ -29,7 +29,7 @@ interface IWitnetOracleEvents { event WitnetQueryUpgrade( uint256 queryId, address evmSender, - address evmGasPrice, + uint256 evmGasPrice, uint256 evmReward ); diff --git a/contracts/interfaces/IWitnetRadonRegistry.sol b/contracts/interfaces/IWitnetRadonRegistry.sol index 228f253f..25ce25ef 100644 --- a/contracts/interfaces/IWitnetRadonRegistry.sol +++ b/contracts/interfaces/IWitnetRadonRegistry.sol @@ -27,27 +27,24 @@ interface IWitnetRadonRegistry { /// can be used to trace back in the Witnet blockchain all past resolutions /// of the given data request payload. function hashOf(bytes calldata) external view returns (bytes32); - - /// Returns introspective metadata of some previously verified Radon Retrieval - /// (i.e. public data source). Reverts if unknown. - function lookupRadonRetrieval(bytes32 hash) external view returns (Witnet.RadonRetrieval memory); - - /// Returns the number of indexed parameters required to be fulfilled when - /// eventually using the given Radon Retrieval. Reverts if unknown. - function lookupRadonRetrievalArgsCount(bytes32 hash) external view returns (uint8); - /// Returns the type of the data that would be retrieved by the given Radon Retrieval - /// (i.e. public data source). Reverts if unknown. - function lookupRadonRetrievalDataType(bytes32 hash) external view returns (Witnet.RadonDataTypes); + function lookupRadonReducer(bytes32 hash) external view returns (Witnet.RadonReducer memory); + + /// Returns the whole Witnet.RadonRequest metadata struct for the given RAD hash value. + function lookupRadonRequest(bytes32 radHash) external view returns (Witnet.RadonRequest memory); /// Returns the Aggregate reducer that is applied to the data extracted from the data sources /// (i.e. Radon Retrievals) whenever the given Radon Request gets solved on the Witnet blockchain. /// Reverts if unknown. - function lookupRadonRequestAggregate(bytes32 radHash) external view returns (Witnet.RadonReducer memory); + function lookupRadonRequestAggregator(bytes32 radHash) external view returns (Witnet.RadonReducer memory); /// Returns the deterministic data type returned by successful resolutions of the given Radon Request. /// Reverts if unknown. - function lookupRadonRequestDataType(bytes32 radHash) external view returns (Witnet.RadonDataTypes); + function lookupRadonRequestResultDataType(bytes32 radHash) external view returns (Witnet.RadonDataTypes); + + /// Returns introspective metadata for the index-th data source of some pre-verified Radon Request. + /// Reverts if out of range. + function lookupRadonRequestRetrievalByIndex(bytes32 radHash, uint256 index) external view returns (Witnet.RadonRetrieval memory); /// Returns an array (one or more items) containing the introspective metadata of the given Radon Request's /// data sources (i.e. Radon Retrievals). Reverts if unknown. @@ -55,7 +52,54 @@ interface IWitnetRadonRegistry { /// Returns the Tally reducer that is applied to aggregated values revealed by the witnessing nodes on the /// Witnet blockchain. Reverts if unknown. - function lookupRadonRequestsTally(bytes32 radHash) external view returns (Witnet.RadonReducer memory); + function lookupRadonRequestTally(bytes32 radHash) external view returns (Witnet.RadonReducer memory); + + /// Returns introspective metadata of some previously verified Radon Retrieval + /// (i.e. public data source). Reverts if unknown. + function lookupRadonRetrieval(bytes32 hash) external view returns (Witnet.RadonRetrieval memory); + + /// Returns the number of indexed parameters required to be fulfilled when + /// eventually using the given Radon Retrieval. Reverts if unknown. + function lookupRadonRetrievalArgsCount(bytes32 hash) external view returns (uint8); + + /// Returns the type of the data that would be retrieved by the given Radon Retrieval + /// (i.e. public data source). Reverts if unknown. + function lookupRadonRetrievalResultDataType(bytes32 hash) external view returns (Witnet.RadonDataTypes); + + /// Verifies and registers the given sequence of dataset filters and reducing function to be + /// potentially used as either Aggregate or Tally reducers within the resolution workflow + /// of Radon Requests in the Wit/oracle blockchain. Returns a unique hash that identifies the + /// given Radon Reducer in the registry. Reverts if unsupported reducing or filtering methods + /// are specified. + function verifyRadonReducer(Witnet.RadonReducer calldata reducer) external returns (bytes16 hash); + + /// Verifies and registers the specified Radon Request out of the given data sources (i.e. retrievals) + /// and the aggregate and tally Radon Reducers. Returns a unique RAD hash that identifies the + /// verified Radon Request. Reverts if: + /// - unverified retrievals are passed; + /// - retrievals return different data types; + /// - any of passed retrievals is parameterized; + /// - unsupported reducers are passed. + function verifyRadonRequest( + bytes32[] calldata retrieveHashes, + Witnet.RadonReducer calldata aggregate, + Witnet.RadonReducer calldata tally + ) external returns (bytes32 radHash); + + /// Verifies and registers the specified Radon Request out of the given data sources (i.e. retrievals), + /// data sources parameters (if required), and the aggregate and tally Radon Reducers. Returns a unique + /// RAD hash that identifies the verified Radon Request. + /// Reverts if: + /// - unverified retrievals are passed; + /// - retrievals return different data types; + /// - ranks of passed args don't match with those required by each given retrieval; + /// - unsupported reducers are passed. + function verifyRadonRequest( + bytes32[] calldata retrieveHashes, + string[][] calldata retrieveArgs, + Witnet.RadonReducer calldata aggregate, + Witnet.RadonReducer calldata tally + ) external returns (bytes32 radHash); /// Verifies and registers the specified Radon Retrieval (i.e. public data source) into this registry contract. /// Returns a unique retrieval hash that identifies the verified Radon Retrieval. @@ -71,19 +115,4 @@ interface IWitnetRadonRegistry { string[2][] calldata requestHeaders, bytes calldata requestRadonScript ) external returns (bytes32 hash); - - /// Verifies and registers the specified Radon Request out of the given data sources (i.e. retrievals), - /// data sources parameters (if required), and the aggregate and tally Radon Reducers. Returns a unique - /// RAD hash that identifies the verified Radon Request. - /// Reverts if: - /// - unverified retrievals are passed; - /// - retrievals return different data types; - /// - ranks of passed args don't match with those required by each given retrieval; - /// - unsupported reducers are passed. - function verifyRadonRequest( - bytes32[] calldata retrievals, - string[][] calldata retrievalsArgs, - Witnet.RadonReducer calldata aggregate, - Witnet.RadonReducer calldata tally - ) external returns (bytes32 radHash); } diff --git a/contracts/interfaces/IWitnetRadonRegistryEvents.sol b/contracts/interfaces/IWitnetRadonRegistryEvents.sol index c22822e0..3c6cdac9 100644 --- a/contracts/interfaces/IWitnetRadonRegistryEvents.sol +++ b/contracts/interfaces/IWitnetRadonRegistryEvents.sol @@ -6,11 +6,15 @@ import "../libs/Witnet.sol"; interface IWitnetRadonRegistryEvents { + /// Emitted every time a new Radon Reducer gets successfully verified and + /// stored into the WitnetRadonRegistry. + event NewRadonReducer(bytes16 hash); + /// Emitted every time a new Radon Retrieval gets successfully verified and - /// stored in the registry. - event NewRadonRetrieval(bytes32 hash, Witnet.RadonRetrieval retrieval); + /// stored into the WitnetRadonRegistry. + event NewRadonRetrieval(bytes32 hash); /// Emitted every time a new Radon Request gets successfully verified and - /// stored in the registry. - event NewRadonRequest(bytes32 radHash, Witnet.RadonRequest rad); + /// stored into the WitnetRadonRegistry. + event NewRadonRequest(bytes32 radHash); } diff --git a/contracts/interfaces/IWitnetRadonRegistryLegacy.sol b/contracts/interfaces/IWitnetRadonRegistryLegacy.sol index d4efd290..7dfe3134 100644 --- a/contracts/interfaces/IWitnetRadonRegistryLegacy.sol +++ b/contracts/interfaces/IWitnetRadonRegistryLegacy.sol @@ -9,25 +9,17 @@ interface IWitnetRadonRegistryLegacy { error UnknownRadonReducer(bytes32 hash); error UnknownRadonRequest(bytes32 hash); - function lookupDataProvider(uint256 index) external view returns (string memory, uint); - function lookupDataProviderIndex(string calldata authority) external view returns (uint); - function lookupDataProviderSources(uint256 index, uint256 offset, uint256 length) external view returns (bytes32[] memory); + // function lookupDataProvider(uint256 index) external view returns (string memory, uint); + // function lookupDataProviderIndex(string calldata authority) external view returns (uint); + // function lookupDataProviderSources(uint256 index, uint256 offset, uint256 length) external view returns (bytes32[] memory); - function lookupRadonReducer(bytes32 hash) external view returns (Witnet.RadonReducer memory); + // function lookupRadonRetrievalResultDataType(bytes32 hash) external view returns (Witnet.RadonDataTypes); + // function lookupRadonRequestResultDataType(bytes32 radHash) external view returns (Witnet.RadonDataTypes); - function lookupRadonRetrieval(bytes32 hash) external view returns (Witnet.RadonRetrieval memory); - function lookupRadonRetrievalArgsCount(bytes32 hash) external view returns (uint8); - function lookupRadonRetrievalResultDataType(bytes32 hash) external view returns (Witnet.RadonDataTypes); - - function lookupRadonRequestAggregator(bytes32 radHash) external view returns (Witnet.RadonReducer memory); function lookupRadonRequestResultMaxSize(bytes32 radHash) external view returns (uint16); - function lookupRadonRequestResultDataType(bytes32 radHash) external view returns (Witnet.RadonDataTypes); function lookupRadonRequestSources(bytes32 radHash) external view returns (bytes32[] memory); function lookupRadonRequestSourcesCount(bytes32 radHash) external view returns (uint); - function lookupRadonRequestTally(bytes32 radHash) external view returns (Witnet.RadonReducer memory); - function verifyRadonReducer(Witnet.RadonReducer calldata reducer) - external returns (bytes32 hash); function verifyRadonRequest( bytes32[] calldata sources, @@ -36,6 +28,4 @@ interface IWitnetRadonRegistryLegacy { uint16 resultMaxSize, string[][] calldata args ) external returns (bytes32 radHash); - - function totalDataProviders() external view returns (uint); } diff --git a/contracts/interfaces/IWitnetRequest.sol b/contracts/interfaces/IWitnetRequest.sol index 444a71a4..866904e0 100644 --- a/contracts/interfaces/IWitnetRequest.sol +++ b/contracts/interfaces/IWitnetRequest.sol @@ -2,7 +2,7 @@ pragma solidity >=0.7.0 <0.9.0; -import "./IWitnetRequestTemplate.sol"; +import "../libs/Witnet.sol"; interface IWitnetRequest { @@ -13,35 +13,28 @@ interface IWitnetRequest { /// Returns the Witnet-compliant RAD hash of the data request (i.e. Radon Request) /// contained within this WitnetRequest. function radHash() external view returns (bytes32); - - /// If built out of a WitnetRequestTemplate, returns the array or string values - /// passed as parameters when this WitnetRequest got built. - function getArgs() external view returns (string[][] memory); - /// Returns the expected data type produced by successful resolutions of the - /// Witnet-compliant data request contained within this WitnetRequest. - function getResultDataType() external view returns (Witnet.RadonDataTypes); + /// Returns the filters and reducing functions to be applied by witnessing nodes + /// on the Witnet blockchain both at the: + /// - Aggregate stage: when aggregating data extracted from the public + /// data sources (i.e. Radon Retrievals). + /// - Tally stage: when aggregating values revealed by witnesses. + function getRadonReducers() external view returns ( + Witnet.RadonReducer memory aggregateStage, + Witnet.RadonReducer memory tallyStage + ); - /// Returns the filters and reducing function to be applied by witnessing nodes - /// on the Witnet blockchain when aggregating data extracted from the public - /// data sources (i.e. Radon Retrievals) as specified within this WitnetRequest. - function getAggregateReducer() external view returns (Witnet.RadonReducer memory); /// Returns metadata concerning the data source specified by the given index. - function getRetrievalByIndex(uint256) external view returns (Witnet.RadonRetrieval memory); + function getRadonRetrievalByIndex(uint256) external view returns (Witnet.RadonRetrieval memory); /// Returns the array of one or more data sources (i.e. Radon Retrievals) /// that compose this WitnetRequest. - function getRetrievals() external view returns (Witnet.RadonRetrieval[] memory); + function getRadonRetrievals() external view returns (Witnet.RadonRetrieval[] memory); - /// Returns the slashing filters and reducing function to be applied to the - /// values revealed by the witnessing nodes on the Witnet blockchain that - /// contribute to solve the data request as specified within this WitnetRequest. - function getTallyReducer() external view returns (Witnet.RadonReducer memory); - - /// If built out of a template, returns the address of the WitnetRequestTemplate - /// from which this WitnetRequest instance got built. - function template() external view returns (IWitnetRequestTemplate); + /// Returns the expected data type produced by successful resolutions of the + /// Witnet-compliant data request contained within this WitnetRequest. + function getResultDataType() external view returns (Witnet.RadonDataTypes); /// If built out of an upgradable factory, or template, returns the SemVer tag of /// the actual implementation version at the time when this WitnetRequest got built. diff --git a/contracts/interfaces/IWitnetRequestFactory.sol b/contracts/interfaces/IWitnetRequestFactory.sol index e649d3e0..3898bfe2 100644 --- a/contracts/interfaces/IWitnetRequestFactory.sol +++ b/contracts/interfaces/IWitnetRequestFactory.sol @@ -36,8 +36,7 @@ interface IWitnetRequestFactory { /// @param aggregate The Radon Reducer to apply on values returned from data sources. /// @param tally The Radon Reducer to apply on values revealed by witnessing nodes. function buildWitnetRequestTemplate( - bytes32[] calldata retrieveHashes, - string[][] calldata args, + bytes32[] calldata retrieveHashes, Witnet.RadonReducer calldata aggregate, Witnet.RadonReducer calldata tally ) external returns (address template); @@ -52,7 +51,7 @@ interface IWitnetRequestFactory { /// @dev - unsupported data request method is given; /// @dev - no URL is provided on Http/* data requests; /// @dev - non-empty strings given on RNG data requests.. - function verifyWitnetRetrieval( + function verifyRadonRetrieval( Witnet.RadonRetrievalMethods requestMethod, string calldata requestURL, string calldata requestBody, diff --git a/contracts/interfaces/IWitnetRequestFactoryAppliance.sol b/contracts/interfaces/IWitnetRequestFactoryAppliance.sol deleted file mode 100644 index 3329e39f..00000000 --- a/contracts/interfaces/IWitnetRequestFactoryAppliance.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import "./IWitnetOracleAppliance.sol"; -import "../WitnetRequestFactory.sol"; - -abstract contract IWitnetRequestFactoryAppliance - is - IWitnetOracleAppliance -{ - function factory() virtual external view returns (WitnetRequestFactory); -} diff --git a/contracts/interfaces/IWitnetRequestFactoryEvents.sol b/contracts/interfaces/IWitnetRequestFactoryEvents.sol index 0347d8d2..9ec22267 100644 --- a/contracts/interfaces/IWitnetRequestFactoryEvents.sol +++ b/contracts/interfaces/IWitnetRequestFactoryEvents.sol @@ -8,5 +8,5 @@ interface IWitnetRequestFactoryEvents { event WitnetRequestBuilt(address request); /// Emitted every time a new counter-factual WitnetRequestTemplate gets verified and built. - event WitnetRequestTemplateBuilt(address template, uint256[] argsCount); + event WitnetRequestTemplateBuilt(address template); } diff --git a/contracts/interfaces/IWitnetRequestTemplate.sol b/contracts/interfaces/IWitnetRequestTemplate.sol index d09f6baa..23339103 100644 --- a/contracts/interfaces/IWitnetRequestTemplate.sol +++ b/contracts/interfaces/IWitnetRequestTemplate.sol @@ -5,6 +5,7 @@ pragma solidity >=0.7.0 <0.9.0; import "../libs/Witnet.sol"; interface IWitnetRequestTemplate { + /// Build a WitnetRequest instance that will provide the bytecode and RAD /// hash of some Witnet-compliant Radon Request, provably made out of the /// data sources, aggregate and tally Radon Reducers that compose this WitnetRequestTemplate. @@ -20,27 +21,30 @@ interface IWitnetRequestTemplate { /// of data sources that compose this instance. function getArgsCount() external view returns (uint256[] memory); - /// Returns the expected data type produced by successful resolutions of - /// any WitnetRequest that gets built out of this WitnetRequestTemplate. - function getResultDataType() external view returns (Witnet.RadonDataTypes); - - /// Returns the filters and reducing function to be applied by witnessing - /// nodes on the Witnet blockchain when aggregating data extracted from - /// the public data sources (i.e. Radon Retrievals) of the data requests - /// that get eventually built out of this WitnetRequestTemplate. - function getAggregateReducer() external view returns (Witnet.RadonReducer memory); + /// Returns the filters and reducing functions to be applied by witnessing nodes + /// on the Witnet blockchain both at the: + /// - Aggregate stage: when aggregating data extracted from the public + /// data sources (i.e. Radon Retrievals). + /// - Tally stage: when aggregating values revealed by witnesses. + function getRadonReducers() external view returns ( + Witnet.RadonReducer memory aggregateStage, + Witnet.RadonReducer memory tallyStage + ); /// Returns metadata concerning the data source specified by the given index. - function getRetrievalByIndex(uint256) external view returns (Witnet.RadonRetrieval memory); + function getRadonRetrievalByIndex(uint256) external view returns (Witnet.RadonRetrieval memory); /// Returns the array of one or more parameterized data sources that compose /// this WitnetRequestTemplate. - function getRetrievals() external view returns (Witnet.RadonRetrieval[] memory); + function getRadonRetrievals() external view returns (Witnet.RadonRetrieval[] memory); + + /// Returns the expected data type produced by successful resolutions of + /// any WitnetRequest that gets built out of this WitnetRequestTemplate. + function getResultDataType() external view returns (Witnet.RadonDataTypes); - /// Returns the slashing filters and reducing function to be applied to the - /// values revealed by the witnessing nodes on the Witnet blockchain that - /// contribute to solve data requests built out of this WitnetRequestTemplate. - function getTallyReducer() external view returns (Witnet.RadonReducer memory); + /// If built out of an upgradable factory, returns the SemVer tag of the + /// factory implementation at the time when this WitnetRequestTemplate got built. + function version() external view returns (string memory); /// Verifies into the bounded WitnetOracle's registry the actual bytecode /// and RAD hash of the Witnet-compliant Radon Request that gets provably @@ -55,9 +59,5 @@ interface IWitnetRequestTemplate { /// @dev This method requires less gas than buildWitnetRequest(string[][]), and /// it's usually preferred when parameterized data requests made out of this /// template are intended to be used just once in lifetime. - function verifyWitnetRequest(string[][] calldata args) external returns (bytes32); - - /// If built out of an upgradable factory, returns the SemVer tag of the - /// factory implementation at the time when this WitnetRequestTemplate got built. - function version() external view returns (string memory); + function verifyRadonRequest(string[][] calldata args) external returns (bytes32); } diff --git a/contracts/libs/Witnet.sol b/contracts/libs/Witnet.sol index ac1c361b..ecfc58f6 100644 --- a/contracts/libs/Witnet.sol +++ b/contracts/libs/Witnet.sol @@ -328,12 +328,12 @@ library Witnet { /// Structure defining the array of filters and reducting function to be applied at either the Aggregation /// or the Tally stages within a Witnet Data Request resolution workflow. struct RadonReducer { - RadonReducerOpcodes opcode; + RadonReduceOpcodes opcode; RadonFilter[] filters; } /// Reducting functions currently supported on the Witnet blockchain. - enum RadonReducerOpcodes { + enum RadonReduceOpcodes { /* 0x00 */ Reserved0x00, //Minimum, /* 0x01 */ Reserved0x01, //Maximum, /* 0x02 */ Mode, diff --git a/contracts/libs/WitnetEncodingLib.sol b/contracts/libs/WitnetEncodingLib.sol index 0d5e4b55..e2931eba 100644 --- a/contracts/libs/WitnetEncodingLib.sol +++ b/contracts/libs/WitnetEncodingLib.sol @@ -265,7 +265,7 @@ library WitnetEncodingLib { ); } - function encode(Witnet.RadonReducerOpcodes opcode) + function encode(Witnet.RadonReduceOpcodes opcode) public pure returns (bytes memory) { @@ -411,11 +411,11 @@ library WitnetEncodingLib { { // if (reducer.script.length == 0) { if (!( - reducer.opcode == Witnet.RadonReducerOpcodes.AverageMean - || reducer.opcode == Witnet.RadonReducerOpcodes.StandardDeviation - || reducer.opcode == Witnet.RadonReducerOpcodes.Mode - || reducer.opcode == Witnet.RadonReducerOpcodes.ConcatenateAndHash - || reducer.opcode == Witnet.RadonReducerOpcodes.AverageMedian + reducer.opcode == Witnet.RadonReduceOpcodes.AverageMean + || reducer.opcode == Witnet.RadonReduceOpcodes.StandardDeviation + || reducer.opcode == Witnet.RadonReduceOpcodes.Mode + || reducer.opcode == Witnet.RadonReduceOpcodes.ConcatenateAndHash + || reducer.opcode == Witnet.RadonReduceOpcodes.AverageMedian )) { revert UnsupportedRadonReducerOpcode(uint8(reducer.opcode)); } diff --git a/contracts/mocks/WitnetMockedOracle.sol b/contracts/mocks/WitnetMockedOracle.sol index 39701641..8195bd09 100644 --- a/contracts/mocks/WitnetMockedOracle.sol +++ b/contracts/mocks/WitnetMockedOracle.sol @@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetMockedRequestBytecodes.sol"; +import "./WitnetMockedRadonRegistry.sol"; import "./WitnetMockedRequestFactory.sol"; import "../core/defaults/WitnetOracleTrustableDefault.sol"; @@ -19,12 +19,10 @@ contract WitnetMockedOracle is WitnetOracleTrustableDefault { - WitnetRequestFactory private __factory; - - constructor(WitnetMockedRequestBytecodes _registry) + constructor(WitnetMockedRadonRegistry _registry) WitnetOracleTrustableDefault( + WitnetRadonRegistry(_registry), WitnetRequestFactory(address(0)), - WitnetRequestBytecodes(address(_registry)), false, bytes32("mocked"), 60000, 65000, 70000, 20000 @@ -34,12 +32,4 @@ contract WitnetMockedOracle _reporters[0] = msg.sender; __setReporters(_reporters); } - - function factory() override public view returns (WitnetRequestFactory) { - return __factory; - } - - function setFactory(WitnetMockedRequestFactory _factory) external onlyOwner { - __factory = WitnetRequestFactory(address(_factory)); - } -} \ No newline at end of file +} diff --git a/contracts/mocks/WitnetMockedRequestBytecodes.sol b/contracts/mocks/WitnetMockedRadonRegistry.sol similarity index 52% rename from contracts/mocks/WitnetMockedRequestBytecodes.sol rename to contracts/mocks/WitnetMockedRadonRegistry.sol index 43f9926d..9d7d9ef5 100644 --- a/contracts/mocks/WitnetMockedRequestBytecodes.sol +++ b/contracts/mocks/WitnetMockedRadonRegistry.sol @@ -3,16 +3,16 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../core/defaults/WitnetRequestBytecodesDefault.sol"; +import "../core/defaults/WitnetRadonRegistryDefault.sol"; -/// @title Mocked implementation of `WitnetRequestBytecodes`. +/// @title Mocked implementation of `WitnetRadonRegistry`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE -/// @dev THE `WitnetRequestBytecodes` CONTRACT ADDRESS PROVIDED +/// @dev THE `WitnetRadonRegistry` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. -contract WitnetMockedRequestBytecodes is WitnetRequestBytecodesDefault { +contract WitnetMockedRadonRegistry is WitnetRadonRegistryDefault { constructor() - WitnetRequestBytecodesDefault( + WitnetRadonRegistryDefault( false, bytes32("mocked") ) diff --git a/contracts/mocks/WitnetMockedRequestFactory.sol b/contracts/mocks/WitnetMockedRequestFactory.sol index a331a286..deed09b0 100644 --- a/contracts/mocks/WitnetMockedRequestFactory.sol +++ b/contracts/mocks/WitnetMockedRequestFactory.sol @@ -18,7 +18,6 @@ contract WitnetMockedRequestFactory constructor (WitnetMockedOracle _wrb) WitnetRequestFactoryDefault( WitnetOracle(address(_wrb)), - WitnetRequestBytecodes(_wrb.registry()), false, bytes32("mocked") ) diff --git a/migrations/scripts/3_core.js b/migrations/scripts/3_core.js index 8db060f4..2f17391d 100644 --- a/migrations/scripts/3_core.js +++ b/migrations/scripts/3_core.js @@ -46,7 +46,6 @@ module.exports = async function (_, network, [, from]) { types: ["address", "address", "bool", "bytes32"], values: [ /* _witnet */ await determineProxyAddr(from, specs.WitnetOracle?.vanity || 3), - /* _registry */ await determineProxyAddr(from, specs.WitnetRadonRegistry?.vanity || 1), /* _upgradable */ true, /* _versionTag */ utils.fromAscii(version), ], @@ -66,8 +65,8 @@ module.exports = async function (_, network, [, from]) { intrinsics: { types: ["address", "address", "bool", "bytes32"], values: [ - /* _factory */ await determineProxyAddr(from, specs.WitnetRequestFactory?.vanity || 2), /* _registry */ await determineProxyAddr(from, specs.WitnetRadonRegistry?.vanity || 1), + /* _factory */ await determineProxyAddr(from, specs.WitnetRequestFactory?.vanity || 2), /* _upgradable */ true, /* _versionTag */ utils.fromAscii(version), ], diff --git a/test/TestWitnetEncodingLib.sol b/test/TestWitnetEncodingLib.sol index c1bc9fed..9eeef9c4 100644 --- a/test/TestWitnetEncodingLib.sol +++ b/test/TestWitnetEncodingLib.sol @@ -42,12 +42,12 @@ contract TestWitnetEncodingLib { function testEncodeRadonReducerOpcodes() external { bytes memory bytecode = WitnetEncodingLib.encode( - Witnet.RadonReducerOpcodes.StandardDeviation + Witnet.RadonReduceOpcodes.StandardDeviation ); Assert.equal( keccak256(bytecode), keccak256(hex"1007"), - "bad encode(Witnet.RadonReducerOpcodes)" + "bad encode(Witnet.RadonReduceOpcodes)" ); } @@ -71,7 +71,7 @@ contract TestWitnetEncodingLib { function testEncodeRadonReducer1Filter() external { Witnet.RadonReducer memory reducer; - reducer.opcode = Witnet.RadonReducerOpcodes.Mode; + reducer.opcode = Witnet.RadonReduceOpcodes.Mode; reducer.filters = new Witnet.RadonFilter[](1); reducer.filters[0].opcode = Witnet.RadonFilterOpcodes.StandardDeviation; reducer.filters[0].cborArgs = hex"fa40200000"; From d9c628e55c201d293b022980831463ff35dca045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sat, 3 Aug 2024 13:41:14 +0200 Subject: [PATCH 12/39] refactor: estimate*Fee --- .../customs/WitnetOracleTrustableOvm2.sol | 80 +++++++++++----- .../defaults/WitnetOracleTrustableBase.sol | 95 ++++++++++++------- .../defaults/WitnetOracleTrustableDefault.sol | 38 ++++++++ .../core/defaults/WitnetPriceFeedsDefault.sol | 5 +- contracts/interfaces/IWitnetOracle.sol | 27 +++--- contracts/interfaces/IWitnetOracleLegacy.sol | 17 ++++ contracts/mocks/MyDapp.sol | 8 +- 7 files changed, 194 insertions(+), 76 deletions(-) create mode 100644 contracts/interfaces/IWitnetOracleLegacy.sol diff --git a/contracts/core/customs/WitnetOracleTrustableOvm2.sol b/contracts/core/customs/WitnetOracleTrustableOvm2.sol index 63922d93..f5f31065 100644 --- a/contracts/core/customs/WitnetOracleTrustableOvm2.sol +++ b/contracts/core/customs/WitnetOracleTrustableOvm2.sol @@ -101,6 +101,32 @@ contract WitnetOracleTrustableOvm2 return _getCurrentL1Fee(32) + WitnetOracleTrustableDefault.estimateBaseFeeWithCallback(_gasPrice, _callbackGasLimit); } + /// @notice Estimate the extra reward (i.e. over the base fee) to be paid when posting a new + /// @notice data query in order to avoid getting provable "too low incentives" results from + /// @notice the Wit/oracle blockchain. + /// @dev The extra fee gets calculated in proportion to: + /// @param _evmGasPrice Tentative EVM gas price at the moment the query result is ready. + /// @param _evmWitPrice Tentative nanoWit price in Wei at the moment the query is solved on the Wit/oracle blockchain. + /// @param _querySLA The query SLA data security parameters as required for the Wit/oracle blockchain. + function estimateExtraFee( + uint256 _evmGasPrice, + uint256 _evmWitPrice, + Witnet.RadonSLA memory _querySLA + ) + public view + virtual override + returns (uint256) + { + return ( + _getCurrentL1Fee(_querySLA.maxTallyResultSize) + + WitnetOracleTrustableDefault.estimateExtraFee( + _evmGasPrice, + _evmWitPrice, + _querySLA + ) + ); + } + // ================================================================================================================ // --- Overrides 'IWitnetOracleReporter' -------------------------------------------------------------------------- @@ -108,41 +134,47 @@ contract WitnetOracleTrustableOvm2 /// @notice based on the gas price of the calling transaction. Data requesters should consider upgrading the reward on /// @notice queries providing no actual earnings. function estimateReportEarnings( - uint256[] calldata _witnetQueryIds, - bytes calldata _reportTxMsgData, - uint256 _reportTxGasPrice, - uint256 _nanoWitPrice + uint256[] calldata _queryIds, + bytes calldata _evmMsgData, + uint256 _evmGasPrice, + uint256 _evmWitPrice ) external view virtual override returns (uint256 _revenues, uint256 _expenses) { - for (uint _ix = 0; _ix < _witnetQueryIds.length; _ix ++) { - if (WitnetOracleDataLib.seekQueryStatus(_witnetQueryIds[_ix]) == Witnet.QueryStatus.Posted) { - Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryIds[_ix]); + for (uint _ix = 0; _ix < _queryIds.length; _ix ++) { + if ( + WitnetOracleDataLib.seekQueryStatus(_queryIds[_ix]) == Witnet.QueryStatus.Posted + ) { + Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_queryIds[_ix]); if (__request.gasCallback > 0) { - _expenses += WitnetOracleTrustableDefault.estimateBaseFeeWithCallback( - _reportTxGasPrice, - __request.gasCallback + _expenses += ( + WitnetOracleTrustableDefault.estimateBaseFeeWithCallback(_evmGasPrice, __request.gasCallback) + + WitnetOracleTrustableDefault.estimateExtraFee( + _evmGasPrice, + _evmWitPrice, + Witnet.RadonSLA({ + witnessingCommitteeSize: __request.witnetSLA.witnessingCommitteeSize, + witnessingReward: __request.witnetSLA.witnessingReward, + maxTallyResultSize: uint16(0) + }) + ) ); } else { - if (__request.witnetRAD != bytes32(0)) { - _expenses += WitnetOracleTrustableDefault.estimateBaseFee( - _reportTxGasPrice, - __registry.lookupRadonRequestResultMaxSize(__request.witnetRAD) - ); - } else { - // todo: improve profit estimation accuracy if reporting on deleted query - _expenses += WitnetOracleTrustableDefault.estimateBaseFee( - _reportTxGasPrice, - uint16(0) - ); - } + _expenses += ( + WitnetOracleTrustableDefault.estimateBaseFee(_evmGasPrice) + + WitnetOracleTrustableDefault.estimateExtraFee( + _evmGasPrice, + _evmWitPrice, + __request.witnetSLA + ) + ); } - _expenses += __request.witnetSLA.nanoWitTotalFee() * _nanoWitPrice; + _expenses += __request.witnetSLA.witnessingTotalReward() * _evmWitPrice; _revenues += __request.evmReward; } } - _expenses += __gasPriceOracleL1.getL1Fee(_reportTxMsgData); + _expenses += __gasPriceOracleL1.getL1Fee(_evmMsgData); } } diff --git a/contracts/core/defaults/WitnetOracleTrustableBase.sol b/contracts/core/defaults/WitnetOracleTrustableBase.sol index f2756ed5..503f8487 100644 --- a/contracts/core/defaults/WitnetOracleTrustableBase.sol +++ b/contracts/core/defaults/WitnetOracleTrustableBase.sol @@ -6,6 +6,7 @@ pragma experimental ABIEncoderV2; import "../WitnetUpgradableBase.sol"; import "../../WitnetOracle.sol"; import "../../data/WitnetOracleDataLib.sol"; +import "../..//interfaces/IWitnetOracleLegacy.sol"; import "../../interfaces/IWitnetOracleReporter.sol"; import "../../interfaces/IWitnetRequestBoardAdminACLs.sol"; import "../../interfaces/IWitnetConsumer.sol"; @@ -22,6 +23,7 @@ abstract contract WitnetOracleTrustableBase Payable, WitnetOracle, WitnetUpgradableBase, + IWitnetOracleLegacy, IWitnetOracleReporter, IWitnetRequestBoardAdminACLs { @@ -143,16 +145,34 @@ abstract contract WitnetOracleTrustableBase // ================================================================================================================ // --- Yet to be implemented virtual methods ---------------------------------------------------------------------- + + /// @notice Estimate the minimum reward required for posting a data request. + /// @param evmGasPrice Expected gas price to pay upon posting the data request. + function estimateBaseFee(uint256 evmGasPrice) + virtual public view returns (uint256); + /// @notice Estimate the minimum reward required for posting a data request. /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. - /// @param _gasPrice Expected gas price to pay upon posting the data request. - /// @param _resultMaxSize Maximum expected size of returned data (in bytes). - function estimateBaseFee(uint256 _gasPrice, uint16 _resultMaxSize) virtual public view returns (uint256); + /// @param evmGasPrice Expected gas price to pay upon posting the data request. + /// @param maxResultSize Maximum expected size of returned data (in bytes). + function estimateBaseFee(uint256 evmGasPrice, uint16 maxResultSize) + virtual public view returns (uint256); /// @notice Estimate the minimum reward required for posting a data request with a callback. - /// @param _gasPrice Expected gas price to pay upon posting the data request. - /// @param _callbackGasLimit Maximum gas to be spent when reporting the data request result. - function estimateBaseFeeWithCallback(uint256 _gasPrice, uint24 _callbackGasLimit) virtual public view returns (uint256); + /// @param evmGasPrice Expected gas price to pay upon posting the data request. + /// @param evmCallbackGas Maximum gas to be spent when reporting the data request result. + function estimateBaseFeeWithCallback(uint256 evmGasPrice, uint24 evmCallbackGas) + virtual public view returns (uint256); + + /// @notice Estimate the extra reward (i.e. over the base fee) to be paid when posting a new + /// @notice data query in order to avoid getting provable "too low incentives" results from + /// @notice the Wit/oracle blockchain. + /// @dev The extra fee gets calculated in proportion to: + /// @param evmGasPrice Tentative EVM gas price at the moment the query result is ready. + /// @param evmWitPrice Tentative nanoWit price in Wei at the moment the query is solved on the Wit/oracle blockchain. + /// @param querySLA The query SLA data security parameters as required for the Wit/oracle blockchain. + function estimateExtraFee(uint256 evmGasPrice, uint256 evmWitPrice, Witnet.RadonSLA memory querySLA) + virtual public view returns (uint256); // ================================================================================================================ @@ -224,15 +244,11 @@ abstract contract WitnetOracleTrustableBase virtual override returns (uint256) { - uint16 _resultMaxSize = registry.lookupRadonRequestResultMaxSize(radHash); - _require( - _resultMaxSize > 0, - "invalid RAD" - ); - return estimateBaseFee( - gasPrice, - _resultMaxSize - ); + // Check this rad hash is actually verified: + registry.lookupRadonRequestResultDataType(radHash); + + // Base fee is actually invariant to max result size: + return estimateBaseFee(gasPrice); } /// Retrieves copy of all response data related to a previously posted request, removing the whole query from storage. @@ -456,7 +472,7 @@ abstract contract WitnetOracleTrustableBase /// @param _queryUnverifiedBytecode The (unverified) bytecode containing the actual data request to be solved by the Witnet blockchain. /// @param _querySLA The data query SLA to be fulfilled on the Witnet blockchain. /// @param _queryCallbackGasLimit Maximum gas to be spent when reporting the data request result. - /// @return _witnetQueryId Unique query identifier. + /// @return _queryId Unique query identifier. function postRequestWithCallback( bytes calldata _queryUnverifiedBytecode, Witnet.RadonSLA calldata _querySLA, @@ -474,7 +490,7 @@ abstract contract WitnetOracleTrustableBase _querySLA, _queryCallbackGasLimit ); - WitnetOracleDataLib.seekQueryRequest(_witnetQueryId).witnetBytecode = _queryUnverifiedBytecode; + WitnetOracleDataLib.seekQueryRequest(_queryId).witnetBytecode = _queryUnverifiedBytecode; emit WitnetQuery( _msgSender(), _getGasPrice(), @@ -511,30 +527,45 @@ abstract contract WitnetOracleTrustableBase /// @notice based on the gas price of the calling transaction. Data requesters should consider upgrading the reward on /// @notice queries providing no actual earnings. function estimateReportEarnings( - uint256[] calldata _witnetQueryIds, + uint256[] calldata _queryIds, bytes calldata, - uint256 _txGasPrice, - uint256 _nanoWitPrice + uint256 _evmGasPrice, + uint256 _evmWitPrice ) external view virtual override returns (uint256 _revenues, uint256 _expenses) { - for (uint _ix = 0; _ix < _witnetQueryIds.length; _ix ++) { - if (WitnetOracleDataLib.seekQueryStatus(_witnetQueryIds[_ix]) == Witnet.QueryStatus.Posted) { - Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryIds[_ix]); - _revenues += __request.evmReward; + for (uint _ix = 0; _ix < _queryIds.length; _ix ++) { + if ( + WitnetOracleDataLib.seekQueryStatus(_queryIds[_ix]) == Witnet.QueryStatus.Posted + ) { + Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_queryIds[_ix]); if (__request.gasCallback > 0) { - _expenses += estimateBaseFeeWithCallback(_txGasPrice, __request.gasCallback); + _expenses += ( + estimateBaseFeeWithCallback(_evmGasPrice, __request.gasCallback) + + estimateExtraFee( + _evmGasPrice, + _evmWitPrice, + Witnet.RadonSLA({ + witnessingCommitteeSize: __request.witnetSLA.witnessingCommitteeSize, + witnessingReward: __request.witnetSLA.witnessingReward, + maxTallyResultSize: uint16(0) + }) + ) + ); } else { - if (__request.witnetRAD != bytes32(0)) { - _expenses += estimateBaseFee(_txGasPrice, __request.witnetRAD); - } else { - // todo: improve profit estimation accuracy if reporting on deleted query - _expenses += estimateBaseFee(_txGasPrice, uint16(0)); - } + _expenses += ( + estimateBaseFee(_evmGasPrice) + + estimateExtraFee( + _evmGasPrice, + _evmWitPrice, + __request.witnetSLA + ) + ); } - _expenses += __request.witnetSLA.nanoWitTotalFee() * _nanoWitPrice; + _expenses += _evmWitPrice * __request.witnetSLA.witnessingTotalReward(); + _revenues += __request.evmReward; } } } diff --git a/contracts/core/defaults/WitnetOracleTrustableDefault.sol b/contracts/core/defaults/WitnetOracleTrustableDefault.sol index c6ecef81..bb31fff6 100644 --- a/contracts/core/defaults/WitnetOracleTrustableDefault.sol +++ b/contracts/core/defaults/WitnetOracleTrustableDefault.sol @@ -55,6 +55,19 @@ contract WitnetOracleTrustableDefault // ================================================================================================================ // --- Overrides 'IWitnetOracle' ---------------------------------------------------------------------------- + /// @notice Estimate the minimum reward required for posting a data request. + /// @param _gasPrice Expected gas price to pay upon posting the data request. + function estimateBaseFee(uint256 _gasPrice) + public view + virtual override + returns (uint256) + { + return _gasPrice * ( + __reportResultGasBase + + 4 * __sstoreFromZeroGas + ); + } + /// @notice Estimate the minimum reward required for posting a data request. /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. /// @param _gasPrice Expected gas price to pay upon posting the data request. @@ -103,6 +116,31 @@ contract WitnetOracleTrustableDefault } } + /// @notice Estimate the extra reward (i.e. over the base fee) to be paid when posting a new + /// @notice data query in order to avoid getting provable "too low incentives" results from + /// @notice the Wit/oracle blockchain. + /// @dev The extra fee gets calculated in proportion to: + /// @param _evmGasPrice Tentative EVM gas price at the moment the query result is ready. + /// @param _evmWitPrice Tentative nanoWit price in Wei at the moment the query is solved on the Wit/oracle blockchain. + /// @param _querySLA The query SLA data security parameters as required for the Wit/oracle blockchain. + function estimateExtraFee( + uint256 _evmGasPrice, + uint256 _evmWitPrice, + Witnet.RadonSLA memory _querySLA + ) + public view + virtual override + returns (uint256) + { + return ( + _evmWitPrice * ((3 + _querySLA.witnessingCommitteeSize) * _querySLA.witnessingReward) + + (_querySLA.maxTallyResultSize > 32 + ? _evmGasPrice * __sstoreFromZeroGas * ((_querySLA.maxTallyResultSize - 32) / 32) + : 0 + ) + ); + } + // ================================================================================================================ // --- Overrides 'Payable' ---------------------------------------------------------------------------------------- diff --git a/contracts/core/defaults/WitnetPriceFeedsDefault.sol b/contracts/core/defaults/WitnetPriceFeedsDefault.sol index 66434cfa..ac564fe4 100644 --- a/contracts/core/defaults/WitnetPriceFeedsDefault.sol +++ b/contracts/core/defaults/WitnetPriceFeedsDefault.sol @@ -6,11 +6,10 @@ pragma experimental ABIEncoderV2; import "../WitnetUpgradableBase.sol"; import "../../WitnetPriceFeeds.sol"; - import "../../data/WitnetPriceFeedsData.sol"; import "../../interfaces/IWitnetFeedsAdmin.sol"; import "../../interfaces/IWitnetPriceSolverDeployer.sol"; - +import "../../interfaces/IWitnetOracleLegacy.sol"; import "../../libs/WitnetPriceFeedsLib.sol"; import "../../patterns/Ownable2Step.sol"; @@ -232,7 +231,7 @@ contract WitnetPriceFeedsDefault public view returns (uint) { - return (witnet.estimateBaseFee(_evmGasPrice, 32) + return (IWitnetOracleLegacy(address(witnet)).estimateBaseFee(_evmGasPrice, 32) * (100 + __baseFeeOverheadPercentage) ) / 100; } diff --git a/contracts/interfaces/IWitnetOracle.sol b/contracts/interfaces/IWitnetOracle.sol index bc5f6afb..eeba02f7 100644 --- a/contracts/interfaces/IWitnetOracle.sol +++ b/contracts/interfaces/IWitnetOracle.sol @@ -12,22 +12,23 @@ interface IWitnetOracle { function channel() external view returns (bytes4); /// @notice Estimate the minimum reward required for posting a data request. - /// @dev Underestimates if the size of returned data is greater than `resultMaxSize`. - /// @param gasPrice Expected gas price to pay upon posting the data request. - /// @param resultMaxSize Maximum expected size of returned data (in bytes). - function estimateBaseFee(uint256 gasPrice, uint16 resultMaxSize) external view returns (uint256); - - /// @notice Estimate the minimum reward required for posting a data request. - /// @dev Fails if the RAD hash was not previously verified on the WitnetRadonRegistry registry. - /// @param gasPrice Expected gas price to pay upon posting the data request. - /// @param radHash The RAD hash of the data request to be solved by Witnet. - function estimateBaseFee(uint256 gasPrice, bytes32 radHash) external view returns (uint256); + /// @param evmGasPrice Expected gas price to pay upon posting the data request. + function estimateBaseFee(uint256 evmGasPrice) external view returns (uint256); /// @notice Estimate the minimum reward required for posting a data request with a callback. - /// @param gasPrice Expected gas price to pay upon posting the data request. + /// @param evmGasPrice Expected gas price to pay upon posting the data request. /// @param callbackGasLimit Maximum gas to be spent when reporting the data request result. - function estimateBaseFeeWithCallback(uint256 gasPrice, uint24 callbackGasLimit) external view returns (uint256); - + function estimateBaseFeeWithCallback(uint256 evmGasPrice, uint24 callbackGasLimit) external view returns (uint256); + + /// @notice Estimate the extra reward (i.e. over the base fee) to be paid when posting a new + /// @notice data query in order to avoid getting provable "too low incentives" results from + /// @notice the Wit/oracle blockchain. + /// @dev The extra fee gets calculated in proportion to: + /// @param evmGasPrice Tentative EVM gas price at the moment the query result is ready. + /// @param evmWitPrice Tentative nanoWit price in Wei at the moment the query is solved on the Wit/oracle blockchain. + /// @param querySLA The query SLA data security parameters as required for the Wit/oracle blockchain. + function estimateExtraFee(uint256 evmGasPrice, uint256 evmWitPrice, Witnet.RadonSLA calldata querySLA) external view returns (uint256); + /// @notice Returns the address of the WitnetRequestFactory appliance capable of building compliant data request /// @notice templates verified into the same WitnetRadonRegistry instance returned by registry(). function factory() external view returns (WitnetRequestFactory); diff --git a/contracts/interfaces/IWitnetOracleLegacy.sol b/contracts/interfaces/IWitnetOracleLegacy.sol new file mode 100644 index 00000000..f75ba476 --- /dev/null +++ b/contracts/interfaces/IWitnetOracleLegacy.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0 <0.9.0; + +interface IWitnetOracleLegacy { + + /// @notice Estimate the minimum reward required for posting a data request. + /// @dev Underestimates if the size of returned data is greater than `resultMaxSize`. + /// @param gasPrice Expected gas price to pay upon posting the data request. + /// @param resultMaxSize Maximum expected size of returned data (in bytes). + function estimateBaseFee(uint256 gasPrice, uint16 resultMaxSize) external view returns (uint256); + + /// @notice Estimate the minimum reward required for posting a data request. + /// @dev Fails if the RAD hash was not previously verified on the WitnetRadonRegistry registry. + /// @param gasPrice Expected gas price to pay upon posting the data request. + /// @param radHash The RAD hash of the data request to be solved by Witnet. + function estimateBaseFee(uint256 gasPrice, bytes32 radHash) external view returns (uint256); +} diff --git a/contracts/mocks/MyDapp.sol b/contracts/mocks/MyDapp.sol index ff779d19..7ffcc045 100644 --- a/contracts/mocks/MyDapp.sol +++ b/contracts/mocks/MyDapp.sol @@ -3,11 +3,11 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../apps/UsingWitnetRandomness.sol"; +import "../apps/WitnetRandomnessRequestConsumer.sol"; contract MyDapp is - UsingWitnetRandomness + WitnetRandomnessRequestConsumer { using WitnetCBOR for WitnetCBOR.CBOR; @@ -29,7 +29,7 @@ contract MyDapp uint256 private immutable __randomizeValue; constructor(WitnetOracle _wrb, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit) - UsingWitnetRandomness( + WitnetRandomnessRequestConsumer( _wrb, _baseFeeOverheadPercentage, _callbackGasLimit @@ -41,7 +41,7 @@ contract MyDapp rubbish.slot3 = blockhash(block.number - 3); witnetRandomnessRadHash = __witnetRandomnessRadHash; witnetRandomnessBytecode = witnet().registry().bytecodeOf(__witnetRandomnessRadHash); - __randomizeValue = _witnetEstimateEvmReward(); + __randomizeValue = _witnetEstimateBaseFee(); } function getRandomizeValue() external view returns (uint256) { From 948d044cdecbc9ead01c0c20cfb2971a2a891c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sat, 3 Aug 2024 14:38:04 +0200 Subject: [PATCH 13/39] refactor: Witnet.RadonSLA --- contracts/apps/UsingWitnet.sol | 8 +- .../customs/WitnetOracleTrustableOvm2.sol | 6 +- .../defaults/WitnetOracleTrustableBase.sol | 136 +++++++++++++----- .../defaults/WitnetOracleTrustableDefault.sol | 40 +++--- .../core/defaults/WitnetPriceFeedsDefault.sol | 25 +++- contracts/interfaces/IWitnetFeedsLegacy.sol | 11 ++ contracts/interfaces/IWitnetOracleLegacy.sol | 8 ++ .../interfaces/IWitnetRadonRegistryLegacy.sol | 12 -- contracts/libs/Witnet.sol | 81 ++++++----- test/TestWitnetV2.sol | 10 +- 10 files changed, 218 insertions(+), 119 deletions(-) create mode 100644 contracts/interfaces/IWitnetFeedsLegacy.sol diff --git a/contracts/apps/UsingWitnet.sol b/contracts/apps/UsingWitnet.sol index 10103bf4..b9033418 100644 --- a/contracts/apps/UsingWitnet.sol +++ b/contracts/apps/UsingWitnet.sol @@ -34,9 +34,11 @@ abstract contract UsingWitnet __witnet = _wrb; __witnetDefaultSLA = Witnet.RadonSLA({ // Number of nodes in the Witnet blockchain that will take part in solving the data request: - committeeSize: 10, - // Fee in $nanoWIT paid to every node in the Witnet blockchain involved in solving the data request: - witnessingFeeNanoWit: 2 * 10 ** 8 // defaults to 0.2 $WIT + witNumWitnesses: 10, + // Reward in $nanoWIT to be paid to every node in the Witnet blockchain involved in solving some data query. + witUnitaryReward: 2 * 10 ** 8, // defaults to 0.2 $WIT + // Maximum size accepted for the CBOR-encoded buffer containing successfull result values. + maxTallyResultSize: 32 }); __witnetBaseFeeOverheadPercentage = 33; // defaults to 33% diff --git a/contracts/core/customs/WitnetOracleTrustableOvm2.sol b/contracts/core/customs/WitnetOracleTrustableOvm2.sol index f5f31065..86500c9a 100644 --- a/contracts/core/customs/WitnetOracleTrustableOvm2.sol +++ b/contracts/core/customs/WitnetOracleTrustableOvm2.sol @@ -155,8 +155,8 @@ contract WitnetOracleTrustableOvm2 _evmGasPrice, _evmWitPrice, Witnet.RadonSLA({ - witnessingCommitteeSize: __request.witnetSLA.witnessingCommitteeSize, - witnessingReward: __request.witnetSLA.witnessingReward, + witNumWitnesses: __request.witnetSLA.witNumWitnesses, + witUnitaryReward: __request.witnetSLA.witUnitaryReward, maxTallyResultSize: uint16(0) }) ) @@ -171,7 +171,7 @@ contract WitnetOracleTrustableOvm2 ) ); } - _expenses += __request.witnetSLA.witnessingTotalReward() * _evmWitPrice; + _expenses += __request.witnetSLA.witUnitaryReward * _evmWitPrice; _revenues += __request.evmReward; } } diff --git a/contracts/core/defaults/WitnetOracleTrustableBase.sol b/contracts/core/defaults/WitnetOracleTrustableBase.sol index 503f8487..9eeae2d3 100644 --- a/contracts/core/defaults/WitnetOracleTrustableBase.sol +++ b/contracts/core/defaults/WitnetOracleTrustableBase.sol @@ -70,9 +70,9 @@ abstract contract WitnetOracleTrustableBase _; } - modifier checkSLA(Witnet.RadonSLA calldata sla) { + modifier checkSLA(Witnet.RadonSLA memory sla) { _require( - Witnet.isValid(sla), + sla.isValid(), "invalid SLA" ); _; } @@ -145,18 +145,9 @@ abstract contract WitnetOracleTrustableBase // ================================================================================================================ // --- Yet to be implemented virtual methods ---------------------------------------------------------------------- - - /// @notice Estimate the minimum reward required for posting a data request. - /// @param evmGasPrice Expected gas price to pay upon posting the data request. - function estimateBaseFee(uint256 evmGasPrice) - virtual public view returns (uint256); - /// @notice Estimate the minimum reward required for posting a data request. - /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. /// @param evmGasPrice Expected gas price to pay upon posting the data request. - /// @param maxResultSize Maximum expected size of returned data (in bytes). - function estimateBaseFee(uint256 evmGasPrice, uint16 maxResultSize) - virtual public view returns (uint256); + function estimateBaseFee(uint256 evmGasPrice) virtual public view returns (uint256); /// @notice Estimate the minimum reward required for posting a data request with a callback. /// @param evmGasPrice Expected gas price to pay upon posting the data request. @@ -235,22 +226,6 @@ abstract contract WitnetOracleTrustableBase // ================================================================================================================ // --- Partial implementation of IWitnetOracle -------------------------------------------------------------- - /// @notice Estimate the minimum reward required for posting a data request. - /// @dev Underestimates if the size of returned data is greater than `resultMaxSize`. - /// @param gasPrice Expected gas price to pay upon posting the data request. - /// @param radHash The hash of some Witnet Data Request previously posted in the WitnetRadonRegistry registry. - function estimateBaseFee(uint256 gasPrice, bytes32 radHash) - public view - virtual override - returns (uint256) - { - // Check this rad hash is actually verified: - registry.lookupRadonRequestResultDataType(radHash); - - // Base fee is actually invariant to max result size: - return estimateBaseFee(gasPrice); - } - /// Retrieves copy of all response data related to a previously posted request, removing the whole query from storage. /// @dev Fails if the `_witnetQueryId` is not in 'Reported' status, or called from an address different to /// @dev the one that actually posted the given request. @@ -396,10 +371,10 @@ abstract contract WitnetOracleTrustableBase /// @return _queryId Unique query identifier. function postRequest( bytes32 _queryRAD, - Witnet.RadonSLA calldata _querySLA + Witnet.RadonSLA memory _querySLA ) virtual override - external payable + public payable checkReward(estimateBaseFee(_getGasPrice(), _queryRAD)) checkSLA(_querySLA) returns (uint256 _queryId) @@ -433,11 +408,11 @@ abstract contract WitnetOracleTrustableBase /// @return _queryId Unique query identifier. function postRequestWithCallback( bytes32 _queryRAD, - Witnet.RadonSLA calldata _querySLA, + Witnet.RadonSLA memory _querySLA, uint24 _queryCallbackGasLimit ) virtual override - external payable + public payable checkCallbackRecipient(msg.sender, _queryCallbackGasLimit) checkReward(estimateBaseFeeWithCallback(_getGasPrice(), _queryCallbackGasLimit)) checkSLA(_querySLA) @@ -475,11 +450,11 @@ abstract contract WitnetOracleTrustableBase /// @return _queryId Unique query identifier. function postRequestWithCallback( bytes calldata _queryUnverifiedBytecode, - Witnet.RadonSLA calldata _querySLA, + Witnet.RadonSLA memory _querySLA, uint24 _queryCallbackGasLimit ) virtual override - external payable + public payable checkCallbackRecipient(msg.sender, _queryCallbackGasLimit) checkReward(estimateBaseFeeWithCallback(_getGasPrice(), _queryCallbackGasLimit)) checkSLA(_querySLA) @@ -519,6 +494,91 @@ abstract contract WitnetOracleTrustableBase ); } + + /// =============================================================================================================== + /// --- IWitnetOracleLegacy --------------------------------------------------------------------------------------- + + /// @notice Estimate the minimum reward required for posting a data request. + /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. + /// @param evmGasPrice Expected gas price to pay upon posting the data request. + /// @param maxResultSize Maximum expected size of returned data (in bytes). + function estimateBaseFee(uint256 evmGasPrice, uint16 maxResultSize) + virtual public view returns (uint256); + + /// @notice Estimate the minimum reward required for posting a data request. + /// @dev Underestimates if the size of returned data is greater than `resultMaxSize`. + /// @param gasPrice Expected gas price to pay upon posting the data request. + /// @param radHash The hash of some Witnet Data Request previously posted in the WitnetRadonRegistry registry. + function estimateBaseFee(uint256 gasPrice, bytes32 radHash) + public view + virtual override + returns (uint256) + { + // Check this rad hash is actually verified: + registry.lookupRadonRequestResultDataType(radHash); + + // Base fee is actually invariant to max result size: + return estimateBaseFee(gasPrice); + } + + function postRequest( + bytes32 _queryRadHash, + IWitnetOracleLegacy.RadonSLA calldata _querySLA + ) + virtual override + external payable + returns (uint256) + { + return postRequest( + _queryRadHash, + Witnet.RadonSLA({ + witNumWitnesses: _querySLA.witNumWitnesses, + witUnitaryReward: _querySLA.witUnitaryReward, + maxTallyResultSize: 32 + }) + ); + } + + function postRequestWithCallback( + bytes32 _queryRadHash, + IWitnetOracleLegacy.RadonSLA calldata _querySLA, + uint24 _queryCallbackGas + ) + virtual override + external payable + returns (uint256) + { + return postRequestWithCallback( + _queryRadHash, + Witnet.RadonSLA({ + witNumWitnesses: _querySLA.witNumWitnesses, + witUnitaryReward: _querySLA.witUnitaryReward, + maxTallyResultSize: 32 + }), + _queryCallbackGas + ); + } + + function postRequestWithCallback( + bytes calldata _queryRadBytecode, + IWitnetOracleLegacy.RadonSLA calldata _querySLA, + uint24 _queryCallbackGas + ) + virtual override + external payable + returns (uint256) + { + return postRequestWithCallback( + _queryRadBytecode, + Witnet.RadonSLA({ + witNumWitnesses: _querySLA.witNumWitnesses, + witUnitaryReward: _querySLA.witUnitaryReward, + maxTallyResultSize: 32 + }), + _queryCallbackGas + ); + } + // ================================================================================================================ // --- Full implementation of IWitnetOracleReporter --------------------------------------------------------- @@ -548,8 +608,8 @@ abstract contract WitnetOracleTrustableBase _evmGasPrice, _evmWitPrice, Witnet.RadonSLA({ - witnessingCommitteeSize: __request.witnetSLA.witnessingCommitteeSize, - witnessingReward: __request.witnetSLA.witnessingReward, + witNumWitnesses: __request.witnetSLA.witNumWitnesses, + witUnitaryReward: __request.witnetSLA.witUnitaryReward, maxTallyResultSize: uint16(0) }) ) @@ -564,7 +624,7 @@ abstract contract WitnetOracleTrustableBase ) ); } - _expenses += _evmWitPrice * __request.witnetSLA.witnessingTotalReward(); + _expenses += _evmWitPrice * __request.witnetSLA.witUnitaryReward; _revenues += __request.evmReward; } } @@ -766,7 +826,7 @@ abstract contract WitnetOracleTrustableBase function __postRequest( bytes32 _radHash, - Witnet.RadonSLA calldata _sla, + Witnet.RadonSLA memory _sla, uint24 _callbackGasLimit ) virtual internal diff --git a/contracts/core/defaults/WitnetOracleTrustableDefault.sol b/contracts/core/defaults/WitnetOracleTrustableDefault.sol index bb31fff6..daa3578d 100644 --- a/contracts/core/defaults/WitnetOracleTrustableDefault.sol +++ b/contracts/core/defaults/WitnetOracleTrustableDefault.sol @@ -68,23 +68,6 @@ contract WitnetOracleTrustableDefault ); } - /// @notice Estimate the minimum reward required for posting a data request. - /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. - /// @param _gasPrice Expected gas price to pay upon posting the data request. - /// @param _resultMaxSize Maximum expected size of returned data (in bytes). - function estimateBaseFee(uint256 _gasPrice, uint16 _resultMaxSize) - public view - virtual override - returns (uint256) - { - return _gasPrice * ( - __reportResultGasBase - + __sstoreFromZeroGas * ( - 4 + (_resultMaxSize == 0 ? 0 : _resultMaxSize - 1) / 32 - ) - ); - } - /// @notice Estimate the minimum reward required for posting a data request with a callback. /// @param _gasPrice Expected gas price to pay upon posting the data request. /// @param _callbackGasLimit Maximum gas to be spent when reporting the data request result. @@ -133,7 +116,7 @@ contract WitnetOracleTrustableDefault returns (uint256) { return ( - _evmWitPrice * ((3 + _querySLA.witnessingCommitteeSize) * _querySLA.witnessingReward) + _evmWitPrice * ((3 + _querySLA.witNumWitnesses) * _querySLA.witUnitaryReward) + (_querySLA.maxTallyResultSize > 32 ? _evmGasPrice * __sstoreFromZeroGas * ((_querySLA.maxTallyResultSize - 32) / 32) : 0 @@ -142,6 +125,27 @@ contract WitnetOracleTrustableDefault } + /// =============================================================================================================== + /// --- IWitnetOracleLegacy --------------------------------------------------------------------------------------- + + /// @notice Estimate the minimum reward required for posting a data request. + /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. + /// @param _gasPrice Expected gas price to pay upon posting the data request. + /// @param _resultMaxSize Maximum expected size of returned data (in bytes). + function estimateBaseFee(uint256 _gasPrice, uint16 _resultMaxSize) + public view + virtual override + returns (uint256) + { + return _gasPrice * ( + __reportResultGasBase + + __sstoreFromZeroGas * ( + 4 + (_resultMaxSize == 0 ? 0 : _resultMaxSize - 1) / 32 + ) + ); + } + + // ================================================================================================================ // --- Overrides 'Payable' ---------------------------------------------------------------------------------------- diff --git a/contracts/core/defaults/WitnetPriceFeedsDefault.sol b/contracts/core/defaults/WitnetPriceFeedsDefault.sol index ac564fe4..49eae164 100644 --- a/contracts/core/defaults/WitnetPriceFeedsDefault.sol +++ b/contracts/core/defaults/WitnetPriceFeedsDefault.sol @@ -8,6 +8,7 @@ import "../WitnetUpgradableBase.sol"; import "../../WitnetPriceFeeds.sol"; import "../../data/WitnetPriceFeedsData.sol"; import "../../interfaces/IWitnetFeedsAdmin.sol"; +import "../../interfaces/IWitnetFeedsLegacy.sol"; import "../../interfaces/IWitnetPriceSolverDeployer.sol"; import "../../interfaces/IWitnetOracleLegacy.sol"; import "../../libs/WitnetPriceFeedsLib.sol"; @@ -23,6 +24,7 @@ contract WitnetPriceFeedsDefault WitnetPriceFeedsData, WitnetUpgradableBase, IWitnetFeedsAdmin, + IWitnetFeedsLegacy, IWitnetPriceSolverDeployer { using Witnet for bytes; @@ -103,8 +105,9 @@ contract WitnetPriceFeedsDefault _transferOwnership(_owner); // settle default Radon SLA upon first initialization __defaultRadonSLA = Witnet.RadonSLA({ - committeeSize: 10, - witnessingFeeNanoWit: 2 * 10 ** 8 // 0.2 $WIT + witNumWitnesses: 10, + witUnitaryReward: 2 * 10 ** 8, // 0.2 $WIT + maxTallyResultSize: 16 }); // settle default base fee overhead percentage __baseFeeOverheadPercentage = 10; @@ -321,7 +324,7 @@ contract WitnetPriceFeedsDefault return __requestUpdate(feedId, __defaultRadonSLA); } - function requestUpdate(bytes4 feedId, Witnet.RadonSLA calldata updateSLA) + function requestUpdate(bytes4 feedId, Witnet.RadonSLA memory updateSLA) public payable virtual override returns (uint256 _usedFunds) @@ -333,6 +336,21 @@ contract WitnetPriceFeedsDefault return __requestUpdate(feedId, updateSLA); } + function requestUpdate(bytes4 feedId, IWitnetFeedsLegacy.RadonSLA memory updateSLA) + external payable + virtual override + returns (uint256) + { + return requestUpdate( + feedId, + Witnet.RadonSLA({ + witNumWitnesses: updateSLA.witNumWitnesses, + witUnitaryReward: updateSLA.witUnitaryReward, + maxTallyResultSize: __defaultRadonSLA.maxTallyResultSize + }) + ); + } + // ================================================================================================================ // --- Implements 'IWitnetFeedsAdmin' ----------------------------------------------------------------------------- @@ -724,6 +742,7 @@ contract WitnetPriceFeedsDefault virtual internal returns (uint256 _usedFunds) { + // TODO: let requester settle the reward (see WRV2.randomize(..)) Record storage __feed = __records_(feedId); if (__feed.radHash != 0) { _usedFunds = estimateUpdateRequestFee(tx.gasprice); diff --git a/contracts/interfaces/IWitnetFeedsLegacy.sol b/contracts/interfaces/IWitnetFeedsLegacy.sol new file mode 100644 index 00000000..cc688fea --- /dev/null +++ b/contracts/interfaces/IWitnetFeedsLegacy.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.8.0 <0.9.0; + +interface IWitnetFeedsLegacy { + struct RadonSLA { + uint8 witNumWitnesses; + uint64 witUnitaryReward; + } + function requestUpdate(bytes4, RadonSLA calldata) external payable returns (uint256 usedFunds); +} diff --git a/contracts/interfaces/IWitnetOracleLegacy.sol b/contracts/interfaces/IWitnetOracleLegacy.sol index f75ba476..312940f9 100644 --- a/contracts/interfaces/IWitnetOracleLegacy.sol +++ b/contracts/interfaces/IWitnetOracleLegacy.sol @@ -14,4 +14,12 @@ interface IWitnetOracleLegacy { /// @param gasPrice Expected gas price to pay upon posting the data request. /// @param radHash The RAD hash of the data request to be solved by Witnet. function estimateBaseFee(uint256 gasPrice, bytes32 radHash) external view returns (uint256); + + struct RadonSLA { + uint8 witNumWitnesses; + uint64 witUnitaryReward; + } + function postRequest(bytes32, RadonSLA calldata) external payable returns (uint256); + function postRequestWithCallback(bytes32, RadonSLA calldata, uint24) external payable returns (uint256); + function postRequestWithCallback(bytes calldata, RadonSLA calldata, uint24) external payable returns (uint256); } diff --git a/contracts/interfaces/IWitnetRadonRegistryLegacy.sol b/contracts/interfaces/IWitnetRadonRegistryLegacy.sol index 7dfe3134..5764521c 100644 --- a/contracts/interfaces/IWitnetRadonRegistryLegacy.sol +++ b/contracts/interfaces/IWitnetRadonRegistryLegacy.sol @@ -4,23 +4,11 @@ pragma solidity >=0.8.0 <0.9.0; import "../libs/Witnet.sol"; interface IWitnetRadonRegistryLegacy { - - error UnknownRadonRetrieval(bytes32 hash); - error UnknownRadonReducer(bytes32 hash); - error UnknownRadonRequest(bytes32 hash); - - // function lookupDataProvider(uint256 index) external view returns (string memory, uint); - // function lookupDataProviderIndex(string calldata authority) external view returns (uint); - // function lookupDataProviderSources(uint256 index, uint256 offset, uint256 length) external view returns (bytes32[] memory); - - // function lookupRadonRetrievalResultDataType(bytes32 hash) external view returns (Witnet.RadonDataTypes); - // function lookupRadonRequestResultDataType(bytes32 radHash) external view returns (Witnet.RadonDataTypes); function lookupRadonRequestResultMaxSize(bytes32 radHash) external view returns (uint16); function lookupRadonRequestSources(bytes32 radHash) external view returns (bytes32[] memory); function lookupRadonRequestSourcesCount(bytes32 radHash) external view returns (uint); - function verifyRadonRequest( bytes32[] calldata sources, bytes32 aggregator, diff --git a/contracts/libs/Witnet.sol b/contracts/libs/Witnet.sol index ecfc58f6..7878a9f8 100644 --- a/contracts/libs/Witnet.sol +++ b/contracts/libs/Witnet.sol @@ -377,15 +377,14 @@ library Witnet { } struct RadonSLA { - /// @notice Number of nodes in the Witnet blockchain that will take part in solving the data request. - uint8 committeeSize; + /// Number of witnessing nodes in the Witnet blockchain that contribute to solve some data query. + uint8 witNumWitnesses; - /// @notice Fee in $nanoWIT paid to every node in the Witnet blockchain involved in solving the data request. - /// @dev Witnet nodes participating as witnesses will have to stake as collateral 100x this amount. - uint64 witnessingFeeNanoWit; + /// Reward in $nanoWit ultimately paid to every earnest node in the Wit/oracle blockchain contributing to solve some data query. + uint64 witUnitaryReward; - /// @notice Maximum size accepted for the CBOR-encoded buffer containing successfull Tally Result values. - //uint16 maxTallyResultSize; + /// Maximum size accepted for the CBOR-encoded buffer containing successfull result values. + uint16 maxTallyResultSize; } /// Structure containing the SLA security parameters of a Witnet-compliant Data Request. @@ -398,6 +397,43 @@ library Witnet { } + /// =============================================================================================================== + /// --- 'Witnet.RadonSLA' helper methods ------------------------------------------------------------------------ + + function equalOrGreaterThan(RadonSLA memory a, RadonSLA memory b) + internal pure returns (bool) + { + return ( + a.witNumWitnesses >= b.witNumWitnesses + && a.witUnitaryReward >= b.witUnitaryReward + && a.maxTallyResultSize >= b.maxTallyResultSize + ); + } + + function isValid(RadonSLA memory sla) internal pure returns (bool) { + return ( + sla.witUnitaryReward > 0 + && sla.witNumWitnesses > 0 && sla.witNumWitnesses <= 127 + && sla.maxTallyResultSize > 0 + ); + } + + function toV1(RadonSLA memory self) internal pure returns (Witnet.RadonSLAv1 memory) { + return Witnet.RadonSLAv1({ + numWitnesses: self.witNumWitnesses, + minConsensusPercentage: 51, + witnessReward: self.witUnitaryReward, + witnessCollateral: self.witUnitaryReward * 100, + minerCommitRevealFee: self.witUnitaryReward / self.witNumWitnesses + }); + } + + /// Sum of all rewards in $nanoWit to be paid to nodes in the Wit/oracle blockchain that contribute to solve some data query. + function witTotalReward(RadonSLA storage self) internal view returns (uint64) { + return self.witUnitaryReward / (self.witNumWitnesses + 3); + } + + /// =============================================================================================================== /// --- 'uint*' helper methods ------------------------------------------------------------------------------------ @@ -722,37 +758,6 @@ library Witnet { return result.value.readUintArray(); } - - /// =============================================================================================================== - /// --- 'Witnet.RadonSLA' helper methods ------------------------------------------------------------------------ - - function equalOrGreaterThan(RadonSLA memory a, RadonSLA memory b) - internal pure returns (bool) - { - return (a.committeeSize >= b.committeeSize); - } - - function isValid(RadonSLA calldata sla) internal pure returns (bool) { - return ( - sla.witnessingFeeNanoWit > 0 - && sla.committeeSize > 0 && sla.committeeSize <= 127 - ); - } - - function toV1(RadonSLA memory self) internal pure returns (Witnet.RadonSLAv1 memory) { - return Witnet.RadonSLAv1({ - numWitnesses: self.committeeSize, - minConsensusPercentage: 51, - witnessReward: self.witnessingFeeNanoWit, - witnessCollateral: self.witnessingFeeNanoWit * 100, - minerCommitRevealFee: self.witnessingFeeNanoWit / self.committeeSize - }); - } - - function nanoWitTotalFee(RadonSLA storage self) internal view returns (uint64) { - return self.witnessingFeeNanoWit * (self.committeeSize + 3); - } - /// =============================================================================================================== /// --- P-RNG generators ------------------------------------------------------------------------------------------ diff --git a/test/TestWitnetV2.sol b/test/TestWitnetV2.sol index 98cbd40f..71d6b2e0 100644 --- a/test/TestWitnetV2.sol +++ b/test/TestWitnetV2.sol @@ -29,8 +29,9 @@ contract TestWitnetV2 { witnetBytecode: hex"0aab0412520801123268747470733a2f2f6170692e62696e616e63652e55532f6170692f76332f7469636b65723f73796d626f6c3d4254435553441a1a841877821864696c61737450726963658218571a000f4240185b124d0801122c68747470733a2f2f6170692e62697466696e65782e636f6d2f76312f7075627469636b65722f6274637573641a1b8418778218646a6c6173745f70726963658218571a000f4240185b12480801122d68747470733a2f2f7777772e6269747374616d702e6e65742f6170692f76322f7469636b65722f6274637573641a15841877821864646c6173748218571a000f4240185b12550801123168747470733a2f2f6170692e626974747265782e636f6d2f76332f6d61726b6574732f4254432d5553442f7469636b65721a1e8418778218646d6c6173745472616465526174658218571a000f4240185b12620801123768747470733a2f2f6170692e636f696e626173652e636f6d2f76322f65786368616e67652d72617465733f63757272656e63793d4254431a258618778218666464617461821866657261746573821864635553448218571a000f4240185b12630801123268747470733a2f2f6170692e6b72616b656e2e636f6d2f302f7075626c69632f5469636b65723f706169723d4254435553441a2b87187782186666726573756c7482186668585842545a55534482186161618216008218571a000f4240185b1a0d0a0908051205fa3fc000001003220d0a0908051205fa4020000010031080a3c347180a2080ade20428333080acc7f037", witnetRAD: bytes32(0), witnetSLA: Witnet.RadonSLA({ - committeeSize: 7, - witnessingFeeNanoWit: 10 ** 9 + witNumWitnesses: 7, + witUnitaryReward: 10 ** 9, + maxTallyResultSize: 32 }) }); } @@ -47,8 +48,9 @@ contract TestWitnetV2 { witnetBytecode: hex"", witnetRAD: bytes32(bytes2(0x1234)), witnetSLA: Witnet.RadonSLA({ - committeeSize: 7, - witnessingFeeNanoWit: 10 ** 9 + witNumWitnesses: 7, + witUnitaryReward: 10 ** 9, + maxTallyResultSize: 32 }) }); } From f2bbf8d22df4b39a1915f6b0692a5c691faba799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sat, 3 Aug 2024 14:49:03 +0200 Subject: [PATCH 14/39] feat: IWitnetRandomness.randomize(Witnet.RadonSLA) --- contracts/apps/WitnetRandomnessV2.sol | 88 ++++++++++++++-------- contracts/interfaces/IWitnetRandomness.sol | 30 +++++--- 2 files changed, 75 insertions(+), 43 deletions(-) diff --git a/contracts/apps/WitnetRandomnessV2.sol b/contracts/apps/WitnetRandomnessV2.sol index 1dde05af..c29b7599 100644 --- a/contracts/apps/WitnetRandomnessV2.sol +++ b/contracts/apps/WitnetRandomnessV2.sol @@ -361,42 +361,29 @@ contract WitnetRandomnessV2 /// @notice Requests the Witnet oracle to generate an EVM-agnostic and trustless source of randomness. /// @dev Only one randomness request per block will be actually posted to the Witnet Oracle. - /// @return _evmRandomizeFee Funds actually paid as randomize fee. + /// @return Funds actually paid as randomize fee. function randomize() external payable virtual override - returns (uint256 _evmRandomizeFee) + returns (uint256) { - if (__storage().lastRandomizeBlock < block.number) { - _evmRandomizeFee = msg.value; - // Post the Witnet Randomness request: - uint _witnetQueryId = __witnet.postRequest{ - value: _evmRandomizeFee - }( - witnetRadHash, - __witnetDefaultSLA - ); - // Keep Randomize data in storage: - Randomize storage __randomize = __storage().randomize_[block.number]; - __randomize.witnetQueryId = _witnetQueryId; - // Update block links: - uint256 _prevBlock = __storage().lastRandomizeBlock; - __randomize.prevBlock = _prevBlock; - __storage().randomize_[_prevBlock].nextBlock = block.number; - __storage().lastRandomizeBlock = block.number; - // Throw event: - emit Randomizing( - block.number, - tx.gasprice, - _evmRandomizeFee, - _witnetQueryId, - __witnetDefaultSLA - ); - } - // Transfer back unused funds: - if (_evmRandomizeFee < msg.value) { - payable(msg.sender).transfer(msg.value - _evmRandomizeFee); - } + return __postRandomizeQuery(__witnetDefaultSLA); + } + + /// @notice Requests the Witnet oracle to generate an EVM-agnostic and trustless source of randomness. + /// @dev Only one randomness request per block will be actually posted to the Witnet Oracle. + /// @dev Reverts if given SLA security parameters are below witnetQuerySLA(). + /// @return Funds actually paid as randomize fee. + function randomize(Witnet.RadonSLA calldata _querySLA) + external payable + virtual override + returns (uint256) + { + _require( + _querySLA.equalOrGreaterThan(__witnetDefaultSLA), + "unsecure randomize" + ); + return __postRandomizeQuery(_querySLA); } /// @notice Returns the SLA parameters required for the Witnet Oracle blockchain to fulfill @@ -478,6 +465,43 @@ contract WitnetRandomnessV2 // ================================================================================================================ // --- Internal methods ------------------------------------------------------------------------------------------- + function __postRandomizeQuery(Witnet.RadonSLA memory _querySLA) + internal + returns (uint256 _evmUsedFunds) + { + uint256 _queryId; + Randomize storage __randomize = __storage().randomize_[block.number]; + if (__storage().lastRandomizeBlock < block.number) { + _evmUsedFunds = msg.value; + + // Post the Witnet Randomness request: + _queryId = __witnet.postRequest{ + value: msg.value + }( + witnetRadHash, + _querySLA + ); + + // Save Randomize metadata in storage: + __randomize.queryId = _queryId; + uint256 _prevBlock = __storage().lastRandomizeBlock; + __randomize.prevBlock = _prevBlock; + __storage().randomize_[_prevBlock].nextBlock = block.number; + __storage().lastRandomizeBlock = block.number; + } else { + _queryId = __storage().randomize_[block.number].queryId; + } + + // Transfer back unused funds: + if (_evmUsedFunds < msg.value) { + payable(msg.sender).transfer(msg.value - _evmUsedFunds); + } + + // Emit event upon every randomize call, even if multiple within same block: + // solhint-disable-next-line avoid-tx-origin + emit Randomizing(tx.origin, _msgSender(), _queryId); + } + function _require( bool _condition, string memory _message diff --git a/contracts/interfaces/IWitnetRandomness.sol b/contracts/interfaces/IWitnetRandomness.sol index ee0fb433..a9e29902 100644 --- a/contracts/interfaces/IWitnetRandomness.sol +++ b/contracts/interfaces/IWitnetRandomness.sol @@ -8,27 +8,27 @@ import "../WitnetOracle.sol"; /// @title The Witnet Randomness generator interface. /// @author Witnet Foundation. interface IWitnetRandomness { - + /// @notice Returns amount of wei required to be paid as a fee when requesting randomization with a /// transaction gas price as the one given. function estimateRandomizeFee(uint256 evmGasPrice) external view returns (uint256); /// @notice Retrieves the result of keccak256-hashing the given block number with the randomness value - /// @notice generated by the Witnet Oracle blockchain in response to the first non-errored randomize request solved + /// @notice generated by the Witnet Oracle blockchain in response to the first non-failing randomize request solved /// @notice after such block number. /// @dev Reverts if: /// @dev i. no `randomize()` was requested on neither the given block, nor afterwards. - /// @dev ii. the first non-errored `randomize()` request found on or after the given block is not solved yet. + /// @dev ii. the first non-failing `randomize()` request found on or after the given block is not solved yet. /// @dev iii. all `randomize()` requests that took place on or after the given block were solved with errors. /// @param blockNumber Block number from which the search will start. function fetchRandomnessAfter(uint256 blockNumber) external view returns (bytes32); /// @notice Retrieves the actual random value, unique hash and timestamp of the witnessing commit/reveal act that took - /// @notice place in the Witnet Oracle blockchain in response to the first non-errored randomize request + /// @notice place in the Witnet Oracle blockchain in response to the first non-failing randomize request /// @notice solved after the given block number. /// @dev Reverts if: /// @dev i. no `randomize()` was requested on neither the given block, nor afterwards. - /// @dev ii. the first non-errored `randomize()` request found on or after the given block is not solved yet. + /// @dev ii. the first non-failing `randomize()` request found on or after the given block is not solved yet. /// @dev iii. all `randomize()` requests that took place on or after the given block were solved with errors. /// @param blockNumber Block number from which the search will start. /// @return witnetResultRandomness Random value provided by the Witnet blockchain and used for solving randomness after given block. @@ -67,22 +67,22 @@ interface IWitnetRandomness { /// @return First block found before the given one, or `0` otherwise. function getRandomizePrevBlock(uint256 blockNumber) external view returns (uint256); - /// @notice Gets current status of the first non-errored randomize request posted on or after the given block number. + /// @notice Gets current status of the first non-failing randomize request posted on or after the given block number. /// @dev Possible values: /// @dev - 0 -> Void: no randomize request was actually posted on or after the given block number. /// @dev - 1 -> Awaiting: a randomize request was found but it's not yet solved by the Witnet blockchain. /// @dev - 2 -> Ready: a successfull randomize value was reported and ready to be read. /// @dev - 3 -> Error: all randomize resolutions after the given block were solved with errors. /// @dev - 4 -> Finalizing: a randomize resolution has been reported from the Witnet blockchain, but it's not yet final. - function getRandomizeStatus(uint256 blockNumber) external view returns (WitnetV2.ResponseStatus); + function getRandomizeStatus(uint256 blockNumber) external view returns (Witnet.ResponseStatus); /// @notice Returns `true` only if a successfull resolution from the Witnet blockchain is found for the first - /// @notice non-errored randomize request posted on or after the given block number. + /// @notice non-failing randomize request posted on or after the given block number. function isRandomized(uint256 blockNumber) external view returns (bool); /// @notice Generates a pseudo-random number uniformly distributed within the range [0 .. _range), by using - /// @notice the given `nonce` and the randomness returned by `getRandomnessAfter(blockNumber)`. - /// @dev Fails under same conditions as `getRandomnessAfter(uint256)` does. + /// @notice the given `nonce` and the randomness returned by `fetchRandomnessAfter(blockNumber)`. + /// @dev Fails under same conditions as `fetchRandomnessAfter(uint256)` does. /// @param range Range within which the uniformly-distributed random number will be generated. /// @param nonce Nonce value enabling multiple random numbers from the same randomness value. /// @param blockNumber Block number from which the search for the first randomize request solved aftewards will start. @@ -90,10 +90,18 @@ interface IWitnetRandomness { /// @notice Requests the Witnet oracle to generate an EVM-agnostic and trustless source of randomness. /// @dev Only one randomness request per block will be actually posted to the Witnet Oracle. - /// @dev Unused funds will be transfered back to the `msg.sender`. + /// @dev Unused funds will be transferred back to the `msg.sender`. /// @return Funds actually paid as randomize fee. function randomize() external payable returns (uint256); + /// @notice Requests the Witnet oracle to generate an EVM-agnostic and trustless source of randomness, + /// @notice while fulfilling the given SLA data security parameters. + /// @dev Only one randomness request per block will be actually posted to the Witnet Oracle. + /// @dev Unused funds will be transferred back to the `msg.sender`. + /// @dev Passed SLA security parameters must be equal or greater than `witnetQuerySLA()`. + /// @return Funds actually paid as randomize fee. + function randomize(Witnet.RadonSLA calldata) external payable returns (uint256); + /// @notice Returns the SLA parameters required for the Witnet Oracle blockchain to fulfill /// @notice when solving randomness requests: /// @notice - number of witnessing nodes contributing to randomness generation From f522574aebead3d1e779fa32809beaadfb2ef6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sat, 3 Aug 2024 14:54:46 +0200 Subject: [PATCH 15/39] chore: move contracts/mocks -> tests/mocks --- {contracts => test}/mocks/MyDapp.sol | 2 +- {contracts => test}/mocks/WitnetMockedOracle.sol | 2 +- {contracts => test}/mocks/WitnetMockedPriceFeeds.sol | 2 +- {contracts => test}/mocks/WitnetMockedRadonRegistry.sol | 2 +- {contracts => test}/mocks/WitnetMockedRandomness.sol | 2 +- {contracts => test}/mocks/WitnetMockedRequestFactory.sol | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename {contracts => test}/mocks/MyDapp.sol (97%) rename {contracts => test}/mocks/WitnetMockedOracle.sol (93%) rename {contracts => test}/mocks/WitnetMockedPriceFeeds.sol (90%) rename {contracts => test}/mocks/WitnetMockedRadonRegistry.sol (88%) rename {contracts => test}/mocks/WitnetMockedRandomness.sol (91%) rename {contracts => test}/mocks/WitnetMockedRequestFactory.sol (90%) diff --git a/contracts/mocks/MyDapp.sol b/test/mocks/MyDapp.sol similarity index 97% rename from contracts/mocks/MyDapp.sol rename to test/mocks/MyDapp.sol index 7ffcc045..8c4dca6b 100644 --- a/contracts/mocks/MyDapp.sol +++ b/test/mocks/MyDapp.sol @@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../apps/WitnetRandomnessRequestConsumer.sol"; +import "../../contracts/apps/WitnetRandomnessRequestConsumer.sol"; contract MyDapp is diff --git a/contracts/mocks/WitnetMockedOracle.sol b/test/mocks/WitnetMockedOracle.sol similarity index 93% rename from contracts/mocks/WitnetMockedOracle.sol rename to test/mocks/WitnetMockedOracle.sol index 8195bd09..a1f11d6f 100644 --- a/contracts/mocks/WitnetMockedOracle.sol +++ b/test/mocks/WitnetMockedOracle.sol @@ -5,7 +5,7 @@ pragma experimental ABIEncoderV2; import "./WitnetMockedRadonRegistry.sol"; import "./WitnetMockedRequestFactory.sol"; -import "../core/defaults/WitnetOracleTrustableDefault.sol"; +import "../../contracts/core/defaults/WitnetOracleTrustableDefault.sol"; import "./WitnetMockedPriceFeeds.sol"; import "./WitnetMockedRandomness.sol"; diff --git a/contracts/mocks/WitnetMockedPriceFeeds.sol b/test/mocks/WitnetMockedPriceFeeds.sol similarity index 90% rename from contracts/mocks/WitnetMockedPriceFeeds.sol rename to test/mocks/WitnetMockedPriceFeeds.sol index 517bfa72..733feeb7 100644 --- a/contracts/mocks/WitnetMockedPriceFeeds.sol +++ b/test/mocks/WitnetMockedPriceFeeds.sol @@ -4,7 +4,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "./WitnetMockedOracle.sol"; -import "../core/defaults/WitnetPriceFeedsDefault.sol"; +import "../../contracts/core/defaults/WitnetPriceFeedsDefault.sol"; /// @title Mocked implementation of `WitnetPriceFeeds`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. diff --git a/contracts/mocks/WitnetMockedRadonRegistry.sol b/test/mocks/WitnetMockedRadonRegistry.sol similarity index 88% rename from contracts/mocks/WitnetMockedRadonRegistry.sol rename to test/mocks/WitnetMockedRadonRegistry.sol index 9d7d9ef5..e125f786 100644 --- a/contracts/mocks/WitnetMockedRadonRegistry.sol +++ b/test/mocks/WitnetMockedRadonRegistry.sol @@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../core/defaults/WitnetRadonRegistryDefault.sol"; +import "../../contracts/core/defaults/WitnetRadonRegistryDefault.sol"; /// @title Mocked implementation of `WitnetRadonRegistry`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. diff --git a/contracts/mocks/WitnetMockedRandomness.sol b/test/mocks/WitnetMockedRandomness.sol similarity index 91% rename from contracts/mocks/WitnetMockedRandomness.sol rename to test/mocks/WitnetMockedRandomness.sol index 7535c858..e76ff7f6 100644 --- a/contracts/mocks/WitnetMockedRandomness.sol +++ b/test/mocks/WitnetMockedRandomness.sol @@ -4,7 +4,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "./WitnetMockedOracle.sol"; -import "../apps/WitnetRandomnessV2.sol"; +import "../../contracts/apps/WitnetRandomnessV2.sol"; /// @title Mocked implementation of `WitnetRandomness`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. diff --git a/contracts/mocks/WitnetMockedRequestFactory.sol b/test/mocks/WitnetMockedRequestFactory.sol similarity index 90% rename from contracts/mocks/WitnetMockedRequestFactory.sol rename to test/mocks/WitnetMockedRequestFactory.sol index deed09b0..c554455e 100644 --- a/contracts/mocks/WitnetMockedRequestFactory.sol +++ b/test/mocks/WitnetMockedRequestFactory.sol @@ -4,7 +4,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "./WitnetMockedOracle.sol"; -import "../core/defaults/WitnetRequestFactoryDefault.sol"; +import "../../contracts/core/defaults/WitnetRequestFactoryDefault.sol"; /// @title Mocked implementation of `WitnetRequestFactory`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. From 6b4b8c4912b2b16865cf34f18c130dd97c71fa6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sat, 3 Aug 2024 14:56:56 +0200 Subject: [PATCH 16/39] chore: move apps/Using|Consumer -> mocks/ --- contracts/{apps => mocks}/UsingWitnet.sol | 0 contracts/{apps => mocks}/UsingWitnetRandomness.sol | 0 contracts/{apps => mocks}/UsingWitnetRequest.sol | 0 contracts/{apps => mocks}/UsingWitnetRequestTemplate.sol | 0 contracts/{apps => mocks}/WitnetConsumer.sol | 0 contracts/{apps => mocks}/WitnetRandomnessRequestConsumer.sol | 0 contracts/{apps => mocks}/WitnetRequestConsumer.sol | 0 contracts/{apps => mocks}/WitnetRequestTemplateConsumer.sol | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename contracts/{apps => mocks}/UsingWitnet.sol (100%) rename contracts/{apps => mocks}/UsingWitnetRandomness.sol (100%) rename contracts/{apps => mocks}/UsingWitnetRequest.sol (100%) rename contracts/{apps => mocks}/UsingWitnetRequestTemplate.sol (100%) rename contracts/{apps => mocks}/WitnetConsumer.sol (100%) rename contracts/{apps => mocks}/WitnetRandomnessRequestConsumer.sol (100%) rename contracts/{apps => mocks}/WitnetRequestConsumer.sol (100%) rename contracts/{apps => mocks}/WitnetRequestTemplateConsumer.sol (100%) diff --git a/contracts/apps/UsingWitnet.sol b/contracts/mocks/UsingWitnet.sol similarity index 100% rename from contracts/apps/UsingWitnet.sol rename to contracts/mocks/UsingWitnet.sol diff --git a/contracts/apps/UsingWitnetRandomness.sol b/contracts/mocks/UsingWitnetRandomness.sol similarity index 100% rename from contracts/apps/UsingWitnetRandomness.sol rename to contracts/mocks/UsingWitnetRandomness.sol diff --git a/contracts/apps/UsingWitnetRequest.sol b/contracts/mocks/UsingWitnetRequest.sol similarity index 100% rename from contracts/apps/UsingWitnetRequest.sol rename to contracts/mocks/UsingWitnetRequest.sol diff --git a/contracts/apps/UsingWitnetRequestTemplate.sol b/contracts/mocks/UsingWitnetRequestTemplate.sol similarity index 100% rename from contracts/apps/UsingWitnetRequestTemplate.sol rename to contracts/mocks/UsingWitnetRequestTemplate.sol diff --git a/contracts/apps/WitnetConsumer.sol b/contracts/mocks/WitnetConsumer.sol similarity index 100% rename from contracts/apps/WitnetConsumer.sol rename to contracts/mocks/WitnetConsumer.sol diff --git a/contracts/apps/WitnetRandomnessRequestConsumer.sol b/contracts/mocks/WitnetRandomnessRequestConsumer.sol similarity index 100% rename from contracts/apps/WitnetRandomnessRequestConsumer.sol rename to contracts/mocks/WitnetRandomnessRequestConsumer.sol diff --git a/contracts/apps/WitnetRequestConsumer.sol b/contracts/mocks/WitnetRequestConsumer.sol similarity index 100% rename from contracts/apps/WitnetRequestConsumer.sol rename to contracts/mocks/WitnetRequestConsumer.sol diff --git a/contracts/apps/WitnetRequestTemplateConsumer.sol b/contracts/mocks/WitnetRequestTemplateConsumer.sol similarity index 100% rename from contracts/apps/WitnetRequestTemplateConsumer.sol rename to contracts/mocks/WitnetRequestTemplateConsumer.sol From 863a0c7aad4352892276a9fce0d2135ec43b60a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sat, 3 Aug 2024 14:59:02 +0200 Subject: [PATCH 17/39] refactor: WitnetRandomnessV2 -> WitnetRandomnessV21 --- .../{WitnetRandomnessV2.sol => WitnetRandomnessV21.sol} | 9 +++++---- migrations/scripts/5_apps.js | 2 +- settings/artifacts.js | 2 +- src/index.js | 2 +- test/mocks/WitnetMockedRandomness.sol | 6 +++--- 5 files changed, 11 insertions(+), 10 deletions(-) rename contracts/apps/{WitnetRandomnessV2.sol => WitnetRandomnessV21.sol} (98%) diff --git a/contracts/apps/WitnetRandomnessV2.sol b/contracts/apps/WitnetRandomnessV21.sol similarity index 98% rename from contracts/apps/WitnetRandomnessV2.sol rename to contracts/apps/WitnetRandomnessV21.sol index c29b7599..918a30d3 100644 --- a/contracts/apps/WitnetRandomnessV2.sol +++ b/contracts/apps/WitnetRandomnessV21.sol @@ -2,14 +2,15 @@ pragma solidity >=0.8.0 <0.9.0; +import "./mocks/UsingWitnet.sol"; + import "../WitnetRandomness.sol"; -import "../apps/UsingWitnet.sol"; import "../interfaces/IWitnetRandomnessAdmin.sol"; import "../patterns/Ownable2Step.sol"; -/// @title WitnetRandomnessV2: Unmalleable and provably-fair randomness generation based on the Witnet Oracle v2.*. +/// @title WitnetRandomnessV21: Unmalleable and provably-fair randomness generation based on the Witnet Oracle v2.*. /// @author The Witnet Foundation. -contract WitnetRandomnessV2 +contract WitnetRandomnessV21 is Ownable2Step, UsingWitnet, @@ -88,7 +89,7 @@ contract WitnetRandomnessV2 } function class() virtual override public pure returns (string memory) { - return type(WitnetRandomnessV2).name; + return type(WitnetRandomnessV21).name; } function specs() virtual override external pure returns (bytes4) { diff --git a/migrations/scripts/5_apps.js b/migrations/scripts/5_apps.js index de10fff9..6460864c 100644 --- a/migrations/scripts/5_apps.js +++ b/migrations/scripts/5_apps.js @@ -13,7 +13,7 @@ module.exports = async function (_, network, [, from]) { // once all core Witnet Oracle artifacts get deployed and initialized. // ========================================================================== - // --- WitnetRandomnessV2 -------------------------------------------------- + // --- WitnetRandomnessV21 -------------------------------------------------- if (!process.argv.includes("--no-randomness")) { await deploy({ diff --git a/settings/artifacts.js b/settings/artifacts.js index 89ba850d..5db99ea5 100644 --- a/settings/artifacts.js +++ b/settings/artifacts.js @@ -3,7 +3,7 @@ module.exports = { WitnetDeployer: "WitnetDeployer", WitnetOracle: "WitnetOracleTrustableDefault", WitnetPriceFeeds: "WitnetPriceFeedsDefault", - WitnetRandomness: "WitnetRandomnessV2", + WitnetRandomness: "WitnetRandomnessV21", WitnetRadonRegistry: "WitnetRadonRegistryDefault", WitnetRequestFactory: "WitnetRequestFactoryDefault", WitnetEncodingLib: "WitnetEncodingLib", diff --git a/src/index.js b/src/index.js index f14dad0b..2fe2d6b9 100644 --- a/src/index.js +++ b/src/index.js @@ -13,7 +13,7 @@ module.exports = { return { WitnetOracle: merged?.WitnetOracle, WitnetPriceFeeds: merged?.WitnetPriceFeeds, - WitnetRandomnessV2: merged?.WitnetRandomnessV2, + WitnetRandomnessV21: merged?.WitnetRandomnessV21, } } else { return {} diff --git a/test/mocks/WitnetMockedRandomness.sol b/test/mocks/WitnetMockedRandomness.sol index e76ff7f6..704ba50e 100644 --- a/test/mocks/WitnetMockedRandomness.sol +++ b/test/mocks/WitnetMockedRandomness.sol @@ -4,15 +4,15 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "./WitnetMockedOracle.sol"; -import "../../contracts/apps/WitnetRandomnessV2.sol"; +import "../../contracts/apps/WitnetRandomnessV21.sol"; /// @title Mocked implementation of `WitnetRandomness`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE /// @dev THE `WitnetRandomness` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. -contract WitnetMockedRandomness is WitnetRandomnessV2 { +contract WitnetMockedRandomness is WitnetRandomnessV21 { constructor(WitnetMockedOracle _wrb) - WitnetRandomnessV2(_wrb, msg.sender) + WitnetRandomnessV21(_wrb, msg.sender) {} } From 7097cb284eccc5918bbd6792caedd1dd89af3cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sat, 3 Aug 2024 15:05:27 +0200 Subject: [PATCH 18/39] chore: move .../WitnetPriceFeedsDefault -> apps/WitPriceFeedsV21 --- .../WitnetPriceFeedsV21.sol} | 23 ++-- contracts/apps/WitnetRandomnessV21.sol | 3 +- migrations/addresses.json | 102 +++++++++--------- migrations/constructorArgs.json | 54 +++++----- settings/artifacts.js | 2 +- test/mocks/WitnetMockedPriceFeeds.sol | 6 +- 6 files changed, 94 insertions(+), 96 deletions(-) rename contracts/{core/defaults/WitnetPriceFeedsDefault.sol => apps/WitnetPriceFeedsV21.sol} (98%) diff --git a/contracts/core/defaults/WitnetPriceFeedsDefault.sol b/contracts/apps/WitnetPriceFeedsV21.sol similarity index 98% rename from contracts/core/defaults/WitnetPriceFeedsDefault.sol rename to contracts/apps/WitnetPriceFeedsV21.sol index 49eae164..d83f6a27 100644 --- a/contracts/core/defaults/WitnetPriceFeedsDefault.sol +++ b/contracts/apps/WitnetPriceFeedsV21.sol @@ -3,21 +3,20 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../WitnetUpgradableBase.sol"; - -import "../../WitnetPriceFeeds.sol"; -import "../../data/WitnetPriceFeedsData.sol"; -import "../../interfaces/IWitnetFeedsAdmin.sol"; -import "../../interfaces/IWitnetFeedsLegacy.sol"; -import "../../interfaces/IWitnetPriceSolverDeployer.sol"; -import "../../interfaces/IWitnetOracleLegacy.sol"; -import "../../libs/WitnetPriceFeedsLib.sol"; -import "../../patterns/Ownable2Step.sol"; +import "../WitnetPriceFeeds.sol"; +import "../core/WitnetUpgradableBase.sol"; +import "../data/WitnetPriceFeedsData.sol"; +import "../interfaces/IWitnetFeedsAdmin.sol"; +import "../interfaces/IWitnetFeedsLegacy.sol"; +import "../interfaces/IWitnetPriceSolverDeployer.sol"; +import "../interfaces/IWitnetOracleLegacy.sol"; +import "../libs/WitnetPriceFeedsLib.sol"; +import "../patterns/Ownable2Step.sol"; /// @title WitnetPriceFeeds: Price Feeds live repository reliant on the Witnet Oracle blockchain. /// @author Guillermo Dรญaz -contract WitnetPriceFeedsDefault +contract WitnetPriceFeedsV21 is Ownable2Step, WitnetPriceFeeds, @@ -33,7 +32,7 @@ contract WitnetPriceFeedsDefault using Witnet for Witnet.RadonSLA; function class() virtual override(IWitnetAppliance, WitnetUpgradableBase) public view returns (string memory) { - return type(WitnetPriceFeedsDefault).name; + return type(WitnetPriceFeedsV21).name; } bytes4 immutable public override specs = type(WitnetPriceFeeds).interfaceId; diff --git a/contracts/apps/WitnetRandomnessV21.sol b/contracts/apps/WitnetRandomnessV21.sol index 918a30d3..f4f075d0 100644 --- a/contracts/apps/WitnetRandomnessV21.sol +++ b/contracts/apps/WitnetRandomnessV21.sol @@ -2,10 +2,9 @@ pragma solidity >=0.8.0 <0.9.0; -import "./mocks/UsingWitnet.sol"; - import "../WitnetRandomness.sol"; import "../interfaces/IWitnetRandomnessAdmin.sol"; +import "../mocks/UsingWitnet.sol"; import "../patterns/Ownable2Step.sol"; /// @title WitnetRandomnessV21: Unmalleable and provably-fair randomness generation based on the Witnet Oracle v2.*. diff --git a/migrations/addresses.json b/migrations/addresses.json index 1bdb7996..f7c28c68 100644 --- a/migrations/addresses.json +++ b/migrations/addresses.json @@ -16,7 +16,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "arbitrum:sepolia": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -24,7 +24,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x85cd7aaF5248fC0568B003EF24FB2a5329C95c28", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x682A7dF2852F3Df2d3B4b84803da69A38ba33180", + "WitnetPriceFeedsV21": "0x682A7dF2852F3Df2d3B4b84803da69A38ba33180", "WitnetRadonRegistryDefault": "0x03604d41a0289cb9325814A6aCA8BaBEf7492B44", "WitnetRequestFactoryDefault": "0x90a7Fc875dac0D453b43BF9E5AeE7dC68091CC24" }, @@ -36,7 +36,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "avalanche:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -44,7 +44,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x5B354083da3c7D034b8b95bE96aC5d114CcdA71f", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -54,7 +54,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableOvm2": "0x9F02CD498b47B928c5a12FdC7cEa36246d27a638", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0xcB61b81a775E56e9Ec8884d2E13352d668294141", + "WitnetPriceFeedsV21": "0xcB61b81a775E56e9Ec8884d2E13352d668294141", "WitnetRadonRegistryDefault": "0x730a88594d8287Ec898b2B7fE592aB155bE71590", "WitnetRequestFactoryDefault": "0xe1CDE456D3eC92640711625E01170A6800773b91" }, @@ -66,7 +66,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "boba:bnb:mainnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -76,7 +76,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0x0D929cFfa089cA99a644E10A7c7fe1C8C62F657f", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "boba:bnb:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -87,7 +87,7 @@ "WitnetRequestFactoryDefault": "0xFbb35731Fd5c35a84176aBccD214538843eAf5db", "WitnetRequestBoardTrustableOvm": "0xA126d29b0803CD0536c5487C831Daf9cB634318D", "WitnetOracleTrustableOvm2": "0xA126d29b0803CD0536c5487C831Daf9cB634318D", - "WitnetPriceFeedsDefault": "0x9E23a4CD5f903b4D0ED1358413250a1e2c459F63" + "WitnetPriceFeedsV21": "0x9E23a4CD5f903b4D0ED1358413250a1e2c459F63" }, "boba:eth:mainnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -97,7 +97,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "celo:alfajores": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -105,7 +105,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -115,7 +115,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04" }, @@ -129,7 +129,7 @@ "WitnetRadonRegistryDefault": "0x8C6cC510195f2B53abC65340346843Df91F6B940", "WitnetRequestFactoryCfxCore": "0x839d58dE8F143bC01549A7FD62fd508BCA922C8d", "WitnetOracleTrustableDefault": "0x8E6Ddf8bA76350A5fde230a05fc58559A90B878D", - "WitnetPriceFeedsDefault": "0x8af4262e9ECb7320a9ffdEe366172EAeA1D60e91", + "WitnetPriceFeedsV21": "0x8af4262e9ECb7320a9ffdEe366172EAeA1D60e91", "WitnetRadonRegistry": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", "WitnetRequestFactory": "0x8daDc231C8C810CBbe2d555338bDa94DA648f964", "WitnetOracle": "0x8346D6ba3b7a04923492007cC3A2eE7135Db7463", @@ -146,7 +146,7 @@ "WitnetOracleTrustableDefault": "0x857A67Cc046dB5D6414493ED9E65291FF2824116", "WitnetPriceFeeds": "0x8ba3C59e1029cd90010e8C731461ddFC5f49091b", "WitnetPriceFeedsLib": "0x8Ac628741A0983869d237AF759f39a553aE91e47", - "WitnetPriceFeedsDefault": "0x80050098a4fdd72409D6C8Ec72FD50ca460349E9", + "WitnetPriceFeedsV21": "0x80050098a4fdd72409D6C8Ec72FD50ca460349E9", "WitnetRandomnessV2": "0x897832C89ec306A74f9eC29abfFcaDBfCb11A13B", "WitnetRadonRegistry": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", "WitnetRadonRegistryDefault": "0x8176457C9620E8bb508aA22062E1967726179Cc9", @@ -161,7 +161,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "conflux:espace:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -169,7 +169,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x1B9D8186e901b6ED7848374e81B79C9eBf74801E", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -181,7 +181,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "cronos:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -189,7 +189,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x44C4C71c31aD14dB5B18520D3801B88aA26427B0", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -201,7 +201,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "elastos:mainnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -211,7 +211,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "elastos:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -219,7 +219,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -231,7 +231,7 @@ "WitnetRadonRegistryDefault": "0x4a2f2b2E137DD7D4a61389E07c935B14a562078d", "WitnetRequestFactoryDefault": "0x1a5cc6DeE6c7d873639e3eF49678b581f459bBa1", "WitnetOracleTrustableDefault": "0x7084a8C12100cDBB1995aa1B0393A83A0B868837", - "WitnetPriceFeedsDefault": "0xC815f56cC791E41a11DB3f0D2880AdB10316fca6" + "WitnetPriceFeedsV21": "0xC815f56cC791E41a11DB3f0D2880AdB10316fca6" }, "ethereum:sepolia": { "WitnetProxy": "0x21ac85A6c320E6fC89774A98732eAE733032651C", @@ -240,7 +240,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0xE790FdaEa7f1f4C4Bbd74B3493Cf94E79b24396a", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x327470b70d0cCF47cB89a1f3475DE23Ac2437c9e", + "WitnetPriceFeedsV21": "0x327470b70d0cCF47cB89a1f3475DE23Ac2437c9e", "WitnetRadonRegistryDefault": "0x34e6465f23aE086e5701A6ca8547aF7c29e0283C", "WitnetRequestFactoryDefault": "0x1869A7137dF26397999AA6DB90c7D6D029d13908" }, @@ -250,7 +250,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -262,7 +262,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "kava:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -270,7 +270,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -282,7 +282,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "kcc:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -290,7 +290,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -302,7 +302,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "klaytn:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -310,7 +310,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -322,7 +322,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "mantle:sepolia": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -330,7 +330,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableOvm2": "0x8423ddeb7d86Ce43a9C643bE3A420Ff69825Dd53", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x853DDf69DbEaDA2fc4A521a1dBA5Beb210a5c4d2", + "WitnetPriceFeedsV21": "0x853DDf69DbEaDA2fc4A521a1dBA5Beb210a5c4d2", "WitnetRadonRegistryDefault": "0xD1960cdC1593Bb9CA75263266dAB75EE33163187", "WitnetRequestFactoryDefault": "0x9ef37BF321828AD49F3D31Fd9Cd36921ee317190" }, @@ -340,7 +340,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -354,7 +354,7 @@ "WitnetRadonRegistryDefault": "0x14D3AAD34a7aB614Feaf72cc0eAab120E64d032F", "WitnetRequestFactoryCfxCore": "0x6Ee46D8db750607ffa5Ec3Eb0DAE969E1916F417", "WitnetOracleTrustableDefault": "0xB11b58238BAf7CBBb608C81e7792cEA29e4E19D0", - "WitnetPriceFeedsDefault": "0x7e701068365CFF4f217A32be8059550d8aEdc00D", + "WitnetPriceFeedsV21": "0x7e701068365CFF4f217A32be8059550d8aEdc00D", "WitnetRadonRegistry": "0xBa84D2ffA26c8fC7EF2c5Bd4839B4b2E4d56D330", "WitnetRequestFactory": "0xc5074dde3FEA0347d3B2E8C38e58e6A34FeEf8EF", "WitnetOracle": "0x1f28E4d955eccE989c00b3871446AB22B3Fa9Cc8", @@ -371,7 +371,7 @@ "WitnetRadonRegistryDefault": "0x8e1EDea211ed85316Bc7F115972C995b5fA897aF", "WitnetRequestFactoryDefault": "0xC69640F34267C5B9F58f716d1385A481D7dff10D", "WitnetOracleTrustableDefault": "0xb7dd2cD53790a5D87f5cfD265D3bD889ed5FC28d", - "WitnetPriceFeedsDefault": "0x89eE40cfb4F7D9f56Ee2E2E9B1580176361D84eC", + "WitnetPriceFeedsV21": "0x89eE40cfb4F7D9f56Ee2E2E9B1580176361D84eC", "WitnetRadonRegistry": "0x87E25Ad751306b21F9345494F163122e057B7b53", "WitnetRequestFactory": "0xd0b4512F4c9291de4104a1ad7be0c51956044bbC", "WitnetOracle": "0x51e12A16d52DE519f7b13bFeDa42Fb61214d32a0", @@ -387,7 +387,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "moonbeam:moonbase": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -395,7 +395,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -407,7 +407,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "okx:oktchain:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -415,7 +415,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -425,7 +425,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -436,7 +436,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04" }, @@ -447,7 +447,7 @@ "WitnetOracleDataLib": "0x25d57Cf8a047B14172Ba2a929C1441E1A77c3f9D", "WitnetOracleTrustableOvm2": "0xc1C158e77A91da158a1A2D0c2A154c68a8C7c0d2", "WitnetPriceFeedsLib": "0x85aa4A0fDa112c47d4216448EE4D49Afd072675e", - "WitnetPriceFeedsDefault": "0xA936f7F4909494Ea1F7D898C2759b2324912153d", + "WitnetPriceFeedsV21": "0xA936f7F4909494Ea1F7D898C2759b2324912153d", "WitnetRadonRegistryDefault": "0x2D8BCBC4F8c97CC227e770d95d19914324baBF2A", "WitnetRequestFactoryDefault": "0x3D551165020a4014A8d5b9E4b73D2b3Dbe401546" }, @@ -457,7 +457,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -469,7 +469,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "polygon:zkevm:mainnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -479,7 +479,7 @@ "WitnetRadonRegistryNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "reef:mainnet": { "WitnetDeployer": "0x94d6e5321039343f5e656aa7591dfbdbe81ff78f", @@ -491,7 +491,7 @@ "WitnetRadonRegistryDefault": "0x1A80B677A9dd6a6762273593FE2797927c4010A4", "WitnetRequestFactoryDefault": "0x71E2e26E5EfF3C05935A497282Fe018963b78F55", "WitnetOracleTrustableReef": "0x7950250D3d2ae1636a7Ca2a8A6ba53e46D1cB573", - "WitnetPriceFeedsDefault": "0x8af56567C7F0Deaf8979244d83194816a6ED144F", + "WitnetPriceFeedsV21": "0x8af56567C7F0Deaf8979244d83194816a6ED144F", "WitnetRadonRegistry": "0xC4b7a5aD8BAF8fea9DbeB18aB6F77cdf54CF297a", "WitnetRequestFactory": "0xEBa788A5de67E4B11869558a2414247e8Aa62179", "WitnetOracle": "0x604b98893335CEf7Dc40061731F40aC5C6239907", @@ -507,7 +507,7 @@ "WitnetRadonRegistryNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "scroll:sepolia": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -515,7 +515,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -527,7 +527,7 @@ "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773", "WitnetOracleTrustableOvm2": "0x9Bd67787019a6474ddE27f9c9A37260c87Da92B5", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" }, "ten:testnet": { "WitnetProxy": "0xaC3E870BF8D13Dc39f76936b6AF8279eF5a9211F", @@ -536,7 +536,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableObscuro": "0x2330f492635c2E7476bB2A3162e69129F6FEaB56", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -548,7 +548,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsDefault": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "ultron:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -558,6 +558,6 @@ "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", - "WitnetPriceFeedsDefault": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" + "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" } } \ No newline at end of file diff --git a/migrations/constructorArgs.json b/migrations/constructorArgs.json index 8e4dc30f..2e5b68c2 100644 --- a/migrations/constructorArgs.json +++ b/migrations/constructorArgs.json @@ -2,7 +2,7 @@ "default": { "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31322d61653734633030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRandomnessV2": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000f121b71715e71dded592f1125a06d4ed06f0694d", "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", @@ -12,25 +12,25 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "avalanche:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "base:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "boba:bnb:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "boba:bnb:testnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000", @@ -41,7 +41,7 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "celo:alfajores": { "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64383461343832000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" @@ -50,26 +50,26 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "conflux:core:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryCfxCore": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db746300000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "0000000000000000000000008dadc231c8c810cbbe2d555338bda94da648f96400000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetPriceFeedsV21": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRandomnessV2": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000001169bf81ecf738d02fd8d3824dfe02153b334ef7" }, "conflux:core:testnet": { "WitnetRequestFactoryCfxCore": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db746300000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "0000000000000000000000008dadc231c8c810cbbe2d555338bda94da648f96400000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitnetPriceFeedsV21": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRandomnessV2": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000001169bf81ecf738d02fd8d3824dfe02153b334ef7" }, "conflux:espace:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "conflux:espace:testnet": { "WitnetRequestFactoryCfxCore": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" @@ -78,31 +78,31 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "dogechain:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "elastos:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "ethereum:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000" }, "kava:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "kava:testnet": { "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" @@ -111,7 +111,7 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "kcc:testnet": { "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" @@ -120,7 +120,7 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "klaytn:testnet": { "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" @@ -129,19 +129,19 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "meter:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryCfxCore": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc8000000000000000000000000ba84d2ffa26c8fc7ef2c5bd4839b4b2e4d56d3300000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000c5074dde3fea0347d3b2e8c38e58e6a34feef8ef000000000000000000000000ba84d2ffa26c8fc7ef2c5bd4839b4b2e4d56d3300000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc80000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitnetPriceFeedsV21": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc80000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRandomnessV2": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc8000000000000000000000000e169bf81ecf738d02fd8d3824dfe02153b334ef7" }, "meter:testnet": { "WitnetRequestFactoryDefault": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a000000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000d0b4512f4c9291de4104a1ad7be0c51956044bbc00000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a00000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitnetPriceFeedsV21": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a00000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRandomnessV2": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a0000000000000000000000000e169bf81ecf738d02fd8d3824dfe02153b334ef7", "WitnetRequestFactoryCfxCore": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a000000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" }, @@ -152,31 +152,31 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "moonbeam:moonriver": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "optimism:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "polygon:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "polygon:zkevm:mainnet": { "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "reef:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d34333966396166000000000000000000000000000000000000" @@ -185,7 +185,7 @@ "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "syscoin:rollux:testnet": { "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" @@ -197,6 +197,6 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" } } \ No newline at end of file diff --git a/settings/artifacts.js b/settings/artifacts.js index 5db99ea5..c32ebdc6 100644 --- a/settings/artifacts.js +++ b/settings/artifacts.js @@ -2,7 +2,7 @@ module.exports = { default: { WitnetDeployer: "WitnetDeployer", WitnetOracle: "WitnetOracleTrustableDefault", - WitnetPriceFeeds: "WitnetPriceFeedsDefault", + WitnetPriceFeeds: "WitnetPriceFeedsV21", WitnetRandomness: "WitnetRandomnessV21", WitnetRadonRegistry: "WitnetRadonRegistryDefault", WitnetRequestFactory: "WitnetRequestFactoryDefault", diff --git a/test/mocks/WitnetMockedPriceFeeds.sol b/test/mocks/WitnetMockedPriceFeeds.sol index 733feeb7..2897713f 100644 --- a/test/mocks/WitnetMockedPriceFeeds.sol +++ b/test/mocks/WitnetMockedPriceFeeds.sol @@ -4,16 +4,16 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "./WitnetMockedOracle.sol"; -import "../../contracts/core/defaults/WitnetPriceFeedsDefault.sol"; +import "../../contracts/apps/WitnetPriceFeedsV21.sol"; /// @title Mocked implementation of `WitnetPriceFeeds`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE /// @dev THE `WitnetPriceFeeds` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. -contract WitnetMockedPriceFeeds is WitnetPriceFeedsDefault { +contract WitnetMockedPriceFeeds is WitnetPriceFeedsV21 { constructor(WitnetMockedOracle _wrb) - WitnetPriceFeedsDefault( + WitnetPriceFeedsV21( _wrb, false, bytes32("mocked") From 3eebab558f3aa99e4d927574b2ee83ca611a2ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sat, 3 Aug 2024 15:16:43 +0200 Subject: [PATCH 19/39] chore: rearrange contracts/core layout --- .../core/{defaults => trustable}/WitnetOracleTrustableBase.sol | 0 .../{defaults => trustable}/WitnetOracleTrustableDefault.sol | 0 .../{customs => trustable}/WitnetOracleTrustableObscuro.sol | 2 +- .../core/{customs => trustable}/WitnetOracleTrustableOvm2.sol | 2 +- .../core/{customs => trustable}/WitnetOracleTrustableReef.sol | 2 +- contracts/core/{customs => trustless}/WitnetDeployerCfxCore.sol | 0 contracts/core/{customs => trustless}/WitnetDeployerMeter.sol | 0 .../core/{defaults => trustless}/WitnetRadonRegistryDefault.sol | 0 .../core/{customs => trustless}/WitnetRadonRegistryNoSha256.sol | 2 +- .../core/{customs => trustless}/WitnetRequestFactoryCfxCore.sol | 2 +- .../{defaults => trustless}/WitnetRequestFactoryDefault.sol | 0 test/mocks/WitnetMockedOracle.sol | 2 +- test/mocks/WitnetMockedRadonRegistry.sol | 2 +- test/mocks/WitnetMockedRequestFactory.sol | 2 +- 14 files changed, 8 insertions(+), 8 deletions(-) rename contracts/core/{defaults => trustable}/WitnetOracleTrustableBase.sol (100%) rename contracts/core/{defaults => trustable}/WitnetOracleTrustableDefault.sol (100%) rename contracts/core/{customs => trustable}/WitnetOracleTrustableObscuro.sol (98%) rename contracts/core/{customs => trustable}/WitnetOracleTrustableOvm2.sol (99%) rename contracts/core/{customs => trustable}/WitnetOracleTrustableReef.sol (98%) rename contracts/core/{customs => trustless}/WitnetDeployerCfxCore.sol (100%) rename contracts/core/{customs => trustless}/WitnetDeployerMeter.sol (100%) rename contracts/core/{defaults => trustless}/WitnetRadonRegistryDefault.sol (100%) rename contracts/core/{customs => trustless}/WitnetRadonRegistryNoSha256.sol (91%) rename contracts/core/{customs => trustless}/WitnetRequestFactoryCfxCore.sol (93%) rename contracts/core/{defaults => trustless}/WitnetRequestFactoryDefault.sol (100%) diff --git a/contracts/core/defaults/WitnetOracleTrustableBase.sol b/contracts/core/trustable/WitnetOracleTrustableBase.sol similarity index 100% rename from contracts/core/defaults/WitnetOracleTrustableBase.sol rename to contracts/core/trustable/WitnetOracleTrustableBase.sol diff --git a/contracts/core/defaults/WitnetOracleTrustableDefault.sol b/contracts/core/trustable/WitnetOracleTrustableDefault.sol similarity index 100% rename from contracts/core/defaults/WitnetOracleTrustableDefault.sol rename to contracts/core/trustable/WitnetOracleTrustableDefault.sol diff --git a/contracts/core/customs/WitnetOracleTrustableObscuro.sol b/contracts/core/trustable/WitnetOracleTrustableObscuro.sol similarity index 98% rename from contracts/core/customs/WitnetOracleTrustableObscuro.sol rename to contracts/core/trustable/WitnetOracleTrustableObscuro.sol index 4c6293f6..e0834b59 100644 --- a/contracts/core/customs/WitnetOracleTrustableObscuro.sol +++ b/contracts/core/trustable/WitnetOracleTrustableObscuro.sol @@ -5,7 +5,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../defaults/WitnetOracleTrustableDefault.sol"; +import "./WitnetOracleTrustableDefault.sol"; /// @title Witnet Request Board "trustable" implementation contract. /// @notice Contract to bridge requests to Witnet Decentralized Oracle Network. diff --git a/contracts/core/customs/WitnetOracleTrustableOvm2.sol b/contracts/core/trustable/WitnetOracleTrustableOvm2.sol similarity index 99% rename from contracts/core/customs/WitnetOracleTrustableOvm2.sol rename to contracts/core/trustable/WitnetOracleTrustableOvm2.sol index 86500c9a..5201e614 100644 --- a/contracts/core/customs/WitnetOracleTrustableOvm2.sol +++ b/contracts/core/trustable/WitnetOracleTrustableOvm2.sol @@ -5,7 +5,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../defaults/WitnetOracleTrustableDefault.sol"; +import "./WitnetOracleTrustableDefault.sol"; // solhint-disable-next-line interface OVM_GasPriceOracle { diff --git a/contracts/core/customs/WitnetOracleTrustableReef.sol b/contracts/core/trustable/WitnetOracleTrustableReef.sol similarity index 98% rename from contracts/core/customs/WitnetOracleTrustableReef.sol rename to contracts/core/trustable/WitnetOracleTrustableReef.sol index e6485264..0285fc73 100644 --- a/contracts/core/customs/WitnetOracleTrustableReef.sol +++ b/contracts/core/trustable/WitnetOracleTrustableReef.sol @@ -6,7 +6,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; // Inherits from: -import "../defaults/WitnetOracleTrustableDefault.sol"; +import "./WitnetOracleTrustableDefault.sol"; /// @title Witnet Request Board OVM-compatible (Optimism) "trustable" implementation. /// @notice Contract to bridge requests to Witnet Decentralized Oracle Network. diff --git a/contracts/core/customs/WitnetDeployerCfxCore.sol b/contracts/core/trustless/WitnetDeployerCfxCore.sol similarity index 100% rename from contracts/core/customs/WitnetDeployerCfxCore.sol rename to contracts/core/trustless/WitnetDeployerCfxCore.sol diff --git a/contracts/core/customs/WitnetDeployerMeter.sol b/contracts/core/trustless/WitnetDeployerMeter.sol similarity index 100% rename from contracts/core/customs/WitnetDeployerMeter.sol rename to contracts/core/trustless/WitnetDeployerMeter.sol diff --git a/contracts/core/defaults/WitnetRadonRegistryDefault.sol b/contracts/core/trustless/WitnetRadonRegistryDefault.sol similarity index 100% rename from contracts/core/defaults/WitnetRadonRegistryDefault.sol rename to contracts/core/trustless/WitnetRadonRegistryDefault.sol diff --git a/contracts/core/customs/WitnetRadonRegistryNoSha256.sol b/contracts/core/trustless/WitnetRadonRegistryNoSha256.sol similarity index 91% rename from contracts/core/customs/WitnetRadonRegistryNoSha256.sol rename to contracts/core/trustless/WitnetRadonRegistryNoSha256.sol index 637cf1fc..a509d33c 100644 --- a/contracts/core/customs/WitnetRadonRegistryNoSha256.sol +++ b/contracts/core/trustless/WitnetRadonRegistryNoSha256.sol @@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../defaults/WitnetRadonRegistryDefault.sol"; +import "./WitnetRadonRegistryDefault.sol"; contract WitnetRadonRegistryNoSha256 is diff --git a/contracts/core/customs/WitnetRequestFactoryCfxCore.sol b/contracts/core/trustless/WitnetRequestFactoryCfxCore.sol similarity index 93% rename from contracts/core/customs/WitnetRequestFactoryCfxCore.sol rename to contracts/core/trustless/WitnetRequestFactoryCfxCore.sol index 86e4700f..d90bca51 100644 --- a/contracts/core/customs/WitnetRequestFactoryCfxCore.sol +++ b/contracts/core/trustless/WitnetRequestFactoryCfxCore.sol @@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../defaults/WitnetRequestFactoryDefault.sol"; +import "./WitnetRequestFactoryDefault.sol"; contract WitnetRequestFactoryCfxCore is diff --git a/contracts/core/defaults/WitnetRequestFactoryDefault.sol b/contracts/core/trustless/WitnetRequestFactoryDefault.sol similarity index 100% rename from contracts/core/defaults/WitnetRequestFactoryDefault.sol rename to contracts/core/trustless/WitnetRequestFactoryDefault.sol diff --git a/test/mocks/WitnetMockedOracle.sol b/test/mocks/WitnetMockedOracle.sol index a1f11d6f..332160ba 100644 --- a/test/mocks/WitnetMockedOracle.sol +++ b/test/mocks/WitnetMockedOracle.sol @@ -5,7 +5,7 @@ pragma experimental ABIEncoderV2; import "./WitnetMockedRadonRegistry.sol"; import "./WitnetMockedRequestFactory.sol"; -import "../../contracts/core/defaults/WitnetOracleTrustableDefault.sol"; +import "../../contracts/core/trustable/WitnetOracleTrustableDefault.sol"; import "./WitnetMockedPriceFeeds.sol"; import "./WitnetMockedRandomness.sol"; diff --git a/test/mocks/WitnetMockedRadonRegistry.sol b/test/mocks/WitnetMockedRadonRegistry.sol index e125f786..42d6818c 100644 --- a/test/mocks/WitnetMockedRadonRegistry.sol +++ b/test/mocks/WitnetMockedRadonRegistry.sol @@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../../contracts/core/defaults/WitnetRadonRegistryDefault.sol"; +import "../../contracts/core/trustless/WitnetRadonRegistryDefault.sol"; /// @title Mocked implementation of `WitnetRadonRegistry`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. diff --git a/test/mocks/WitnetMockedRequestFactory.sol b/test/mocks/WitnetMockedRequestFactory.sol index c554455e..723e3a25 100644 --- a/test/mocks/WitnetMockedRequestFactory.sol +++ b/test/mocks/WitnetMockedRequestFactory.sol @@ -4,7 +4,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "./WitnetMockedOracle.sol"; -import "../../contracts/core/defaults/WitnetRequestFactoryDefault.sol"; +import "../../contracts/core/trustless/WitnetRequestFactoryDefault.sol"; /// @title Mocked implementation of `WitnetRequestFactory`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. From b53cff87b54395df1d5dbe61e4e6f28d31152a93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sat, 3 Aug 2024 15:49:45 +0200 Subject: [PATCH 20/39] refactor: apps/Witnet* -> apps/Wit* --- ...PriceFeedsV21.sol => WitPriceFeedsV21.sol} | 38 +++---- ...RandomnessV21.sol => WitRandomnessV21.sol} | 6 +- .../trustless/WitPriceFeedsSolverBase.sol} | 18 ++-- contracts/interfaces/IWitnetPriceFeeds.sol | 8 +- ...Solver.sol => IWitnetPriceFeedsSolver.sol} | 2 +- ...ol => IWitnetPriceFeedsSolverDeployer.sol} | 4 +- contracts/libs/WitnetPriceFeedsLib.sol | 8 +- migrations/addresses.json | 102 +++++++++--------- migrations/constructorArgs.json | 54 +++++----- migrations/scripts/5_apps.js | 2 +- settings/artifacts.js | 4 +- src/index.js | 4 +- ...etMockedOracle.sol => WitMockedOracle.sol} | 12 +-- ...PriceFeeds.sol => WitMockedPriceFeeds.sol} | 10 +- ...egistry.sol => WitMockedRadonRegistry.sol} | 2 +- ...Randomness.sol => WitMockedRandomness.sol} | 12 +-- ...actory.sol => WitMockedRequestFactory.sol} | 6 +- 17 files changed, 146 insertions(+), 146 deletions(-) rename contracts/apps/{WitnetPriceFeedsV21.sol => WitPriceFeedsV21.sol} (95%) rename contracts/apps/{WitnetRandomnessV21.sol => WitRandomnessV21.sol} (99%) rename contracts/{apps/WitnetPriceSolverBase.sol => core/trustless/WitPriceFeedsSolverBase.sol} (75%) rename contracts/interfaces/{IWitnetPriceSolver.sol => IWitnetPriceFeedsSolver.sol} (93%) rename contracts/interfaces/{IWitnetPriceSolverDeployer.sol => IWitnetPriceFeedsSolverDeployer.sol} (70%) rename test/mocks/{WitnetMockedOracle.sol => WitMockedOracle.sol} (77%) rename test/mocks/{WitnetMockedPriceFeeds.sol => WitMockedPriceFeeds.sol} (67%) rename test/mocks/{WitnetMockedRadonRegistry.sol => WitMockedRadonRegistry.sol} (89%) rename test/mocks/{WitnetMockedRandomness.sol => WitMockedRandomness.sol} (56%) rename test/mocks/{WitnetMockedRequestFactory.sol => WitMockedRequestFactory.sol} (84%) diff --git a/contracts/apps/WitnetPriceFeedsV21.sol b/contracts/apps/WitPriceFeedsV21.sol similarity index 95% rename from contracts/apps/WitnetPriceFeedsV21.sol rename to contracts/apps/WitPriceFeedsV21.sol index d83f6a27..5e3690a7 100644 --- a/contracts/apps/WitnetPriceFeedsV21.sol +++ b/contracts/apps/WitPriceFeedsV21.sol @@ -8,7 +8,7 @@ import "../core/WitnetUpgradableBase.sol"; import "../data/WitnetPriceFeedsData.sol"; import "../interfaces/IWitnetFeedsAdmin.sol"; import "../interfaces/IWitnetFeedsLegacy.sol"; -import "../interfaces/IWitnetPriceSolverDeployer.sol"; +import "../interfaces/IWitnetPriceFeedsSolverDeployer.sol"; import "../interfaces/IWitnetOracleLegacy.sol"; import "../libs/WitnetPriceFeedsLib.sol"; import "../patterns/Ownable2Step.sol"; @@ -16,7 +16,7 @@ import "../patterns/Ownable2Step.sol"; /// @title WitnetPriceFeeds: Price Feeds live repository reliant on the Witnet Oracle blockchain. /// @author Guillermo Dรญaz -contract WitnetPriceFeedsV21 +contract WitPriceFeedsV21 is Ownable2Step, WitnetPriceFeeds, @@ -24,7 +24,7 @@ contract WitnetPriceFeedsV21 WitnetUpgradableBase, IWitnetFeedsAdmin, IWitnetFeedsLegacy, - IWitnetPriceSolverDeployer + IWitnetPriceFeedsSolverDeployer { using Witnet for bytes; using Witnet for Witnet.Result; @@ -32,7 +32,7 @@ contract WitnetPriceFeedsV21 using Witnet for Witnet.RadonSLA; function class() virtual override(IWitnetAppliance, WitnetUpgradableBase) public view returns (string memory) { - return type(WitnetPriceFeedsV21).name; + return type(WitPriceFeedsV21).name; } bytes4 immutable public override specs = type(WitnetPriceFeeds).interfaceId; @@ -64,7 +64,7 @@ contract WitnetPriceFeedsV21 // solhint-disable-next-line payable-fallback fallback() override external { if ( - msg.sig == IWitnetPriceSolver.solve.selector + msg.sig == IWitnetPriceFeedsSolver.solve.selector && msg.sender == address(this) ) { address _solver = __records_(bytes4(bytes8(msg.data) << 32)).solver; @@ -516,7 +516,7 @@ contract WitnetPriceFeedsV21 { // solhint-disable-next-line avoid-low-level-calls (bool _success, bytes memory _reason) = solver.delegatecall(abi.encodeWithSelector( - IWitnetPriceSolver.validate.selector, + IWitnetPriceFeedsSolver.validate.selector, feedId, deps )); @@ -534,7 +534,7 @@ contract WitnetPriceFeedsV21 { // solhint-disable-next-line avoid-low-level-calls (bool _success, bytes memory _reason) = address(this).staticcall(abi.encodeWithSelector( - IWitnetPriceSolver.solve.selector, + IWitnetPriceFeedsSolver.solve.selector, feedId )); if (!_success) { @@ -565,9 +565,9 @@ contract WitnetPriceFeedsV21 function lookupPriceSolver(bytes4 feedId) override external view - returns (IWitnetPriceSolver _solverAddress, string[] memory _solverDeps) + returns (IWitnetPriceFeedsSolver _solverAddress, string[] memory _solverDeps) { - _solverAddress = IWitnetPriceSolver(__records_(feedId).solver); + _solverAddress = IWitnetPriceFeedsSolver(__records_(feedId).solver); bytes4[] memory _deps = _depsOf(feedId); _solverDeps = new string[](_deps.length); for (uint _ix = 0; _ix < _deps.length; _ix ++) { @@ -578,13 +578,13 @@ contract WitnetPriceFeedsV21 function latestPrice(bytes4 feedId) virtual override public view - returns (IWitnetPriceSolver.Price memory) + returns (IWitnetPriceFeedsSolver.Price memory) { uint _queryId = _lastValidQueryId(feedId); if (_queryId > 0) { Witnet.Response memory _lastValidResponse = lastValidResponse(feedId); Witnet.Result memory _latestResult = _lastValidResponse.resultCborBytes.toWitnetResult(); - return IWitnetPriceSolver.Price({ + return IWitnetPriceFeedsSolver.Price({ value: _latestResult.asUint(), timestamp: _lastValidResponse.resultTimestamp, tallyHash: _lastValidResponse.resultTallyHash, @@ -595,7 +595,7 @@ contract WitnetPriceFeedsV21 if (_solver != address(0)) { // solhint-disable-next-line avoid-low-level-calls (bool _success, bytes memory _result) = address(this).staticcall(abi.encodeWithSelector( - IWitnetPriceSolver.solve.selector, + IWitnetPriceFeedsSolver.solve.selector, feedId )); if (!_success) { @@ -607,10 +607,10 @@ contract WitnetPriceFeedsV21 string(abi.decode(_result, (string))) ))); } else { - return abi.decode(_result, (IWitnetPriceSolver.Price)); + return abi.decode(_result, (IWitnetPriceFeedsSolver.Price)); } } else { - return IWitnetPriceSolver.Price({ + return IWitnetPriceFeedsSolver.Price({ value: 0, timestamp: 0, tallyHash: 0, @@ -623,9 +623,9 @@ contract WitnetPriceFeedsV21 function latestPrices(bytes4[] calldata feedIds) virtual override external view - returns (IWitnetPriceSolver.Price[] memory _prices) + returns (IWitnetPriceFeedsSolver.Price[] memory _prices) { - _prices = new IWitnetPriceSolver.Price[](feedIds.length); + _prices = new IWitnetPriceFeedsSolver.Price[](feedIds.length); for (uint _ix = 0; _ix < feedIds.length; _ix ++) { _prices[_ix] = latestPrice(feedIds[_ix]); } @@ -633,7 +633,7 @@ contract WitnetPriceFeedsV21 // ================================================================================================================ - // --- Implements 'IWitnetPriceSolverDeployer' --------------------------------------------------------------------- + // --- Implements 'IWitnetPriceFeedsSolverDeployer' --------------------------------------------------------------------- function deployPriceSolver(bytes calldata initcode, bytes calldata constructorParams) virtual override @@ -642,7 +642,7 @@ contract WitnetPriceFeedsV21 returns (address _solver) { _solver = WitnetPriceFeedsLib.deployPriceSolver(initcode, constructorParams); - emit WitnetPriceSolverDeployed( + emit NewPriceFeedsSolver( _solver, _solver.codehash, constructorParams @@ -666,7 +666,7 @@ contract WitnetPriceFeedsV21 external view returns (int256 _value, uint256 _timestamp, uint256 _status) { - IWitnetPriceSolver.Price memory _latestPrice = latestPrice(bytes4(feedId)); + IWitnetPriceFeedsSolver.Price memory _latestPrice = latestPrice(bytes4(feedId)); return ( int(_latestPrice.value), _latestPrice.timestamp, diff --git a/contracts/apps/WitnetRandomnessV21.sol b/contracts/apps/WitRandomnessV21.sol similarity index 99% rename from contracts/apps/WitnetRandomnessV21.sol rename to contracts/apps/WitRandomnessV21.sol index f4f075d0..60737eeb 100644 --- a/contracts/apps/WitnetRandomnessV21.sol +++ b/contracts/apps/WitRandomnessV21.sol @@ -7,9 +7,9 @@ import "../interfaces/IWitnetRandomnessAdmin.sol"; import "../mocks/UsingWitnet.sol"; import "../patterns/Ownable2Step.sol"; -/// @title WitnetRandomnessV21: Unmalleable and provably-fair randomness generation based on the Witnet Oracle v2.*. +/// @title WitRandomnessV21: Unmalleable and provably-fair randomness generation based on the Witnet Oracle v2.*. /// @author The Witnet Foundation. -contract WitnetRandomnessV21 +contract WitRandomnessV21 is Ownable2Step, UsingWitnet, @@ -88,7 +88,7 @@ contract WitnetRandomnessV21 } function class() virtual override public pure returns (string memory) { - return type(WitnetRandomnessV21).name; + return type(WitRandomnessV21).name; } function specs() virtual override external pure returns (bytes4) { diff --git a/contracts/apps/WitnetPriceSolverBase.sol b/contracts/core/trustless/WitPriceFeedsSolverBase.sol similarity index 75% rename from contracts/apps/WitnetPriceSolverBase.sol rename to contracts/core/trustless/WitPriceFeedsSolverBase.sol index b79c48ed..9d2ce43f 100644 --- a/contracts/apps/WitnetPriceSolverBase.sol +++ b/contracts/core/trustless/WitPriceFeedsSolverBase.sol @@ -2,12 +2,12 @@ pragma solidity >=0.8.0 <0.9.0; -import "../data/WitnetPriceFeedsData.sol"; -import "../interfaces/IWitnetPriceFeeds.sol"; +import "../../data/WitnetPriceFeedsData.sol"; +import "../../interfaces/IWitnetPriceFeeds.sol"; -abstract contract WitnetPriceSolverBase +abstract contract WitPriceFeedsSolverBase is - IWitnetPriceSolver, + IWitnetPriceFeedsSolver, WitnetPriceFeedsData { address public immutable override delegator; @@ -15,7 +15,7 @@ abstract contract WitnetPriceSolverBase modifier onlyDelegator { require( address(this) == delegator, - "WitnetPriceSolverBase: not the delegator" + "WitPriceFeedsSolverBase: not the delegator" ); _; } @@ -25,7 +25,7 @@ abstract contract WitnetPriceSolverBase } function specs() external pure returns (bytes4) { - return type(IWitnetPriceSolver).interfaceId; + return type(IWitnetPriceFeedsSolver).interfaceId; } function validate(bytes4 feedId, string[] calldata deps) virtual override external { @@ -33,7 +33,7 @@ abstract contract WitnetPriceSolverBase uint256 _innerDecimals; require( deps.length <= 8, - "WitnetPriceSolverBase: too many dependencies" + "WitPriceFeedsSolverBase: too many dependencies" ); for (uint _ix = 0; _ix < deps.length; _ix ++) { bytes4 _depsId4 = bytes4(keccak256(bytes(deps[_ix]))); @@ -41,14 +41,14 @@ abstract contract WitnetPriceSolverBase require( __depsFeed.index > 0, string(abi.encodePacked( - "WitnetPriceSolverBase: unsupported ", + "WitPriceFeedsSolverBase: unsupported ", deps[_ix] )) ); require( _depsId4 != feedId, string(abi.encodePacked( - "WitnetPriceSolverBase: loop on ", + "WitPriceFeedsSolverBase: loop on ", deps[_ix] )) ); diff --git a/contracts/interfaces/IWitnetPriceFeeds.sol b/contracts/interfaces/IWitnetPriceFeeds.sol index e221c6c3..af57a9fd 100644 --- a/contracts/interfaces/IWitnetPriceFeeds.sol +++ b/contracts/interfaces/IWitnetPriceFeeds.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.0 <0.9.0; -import "./IWitnetPriceSolver.sol"; +import "./IWitnetPriceFeedsSolver.sol"; interface IWitnetPriceFeeds { /// ====================================================================================================== @@ -10,13 +10,13 @@ interface IWitnetPriceFeeds { function lookupDecimals(bytes4 feedId) external view returns (uint8); function lookupPriceSolver(bytes4 feedId) external view returns ( - IWitnetPriceSolver solverAddress, + IWitnetPriceFeedsSolver solverAddress, string[] memory solverDeps ); /// ====================================================================================================== /// --- IWitnetFeeds extension --------------------------------------------------------------------------- - function latestPrice(bytes4 feedId) external view returns (IWitnetPriceSolver.Price memory); - function latestPrices(bytes4[] calldata feedIds) external view returns (IWitnetPriceSolver.Price[] memory); + function latestPrice(bytes4 feedId) external view returns (IWitnetPriceFeedsSolver.Price memory); + function latestPrices(bytes4[] calldata feedIds) external view returns (IWitnetPriceFeedsSolver.Price[] memory); } \ No newline at end of file diff --git a/contracts/interfaces/IWitnetPriceSolver.sol b/contracts/interfaces/IWitnetPriceFeedsSolver.sol similarity index 93% rename from contracts/interfaces/IWitnetPriceSolver.sol rename to contracts/interfaces/IWitnetPriceFeedsSolver.sol index 9169edd8..1828a4a5 100644 --- a/contracts/interfaces/IWitnetPriceSolver.sol +++ b/contracts/interfaces/IWitnetPriceFeedsSolver.sol @@ -4,7 +4,7 @@ pragma solidity >=0.8.0 <0.9.0; import "../libs/Witnet.sol"; -interface IWitnetPriceSolver { +interface IWitnetPriceFeedsSolver { struct Price { uint value; uint timestamp; diff --git a/contracts/interfaces/IWitnetPriceSolverDeployer.sol b/contracts/interfaces/IWitnetPriceFeedsSolverDeployer.sol similarity index 70% rename from contracts/interfaces/IWitnetPriceSolverDeployer.sol rename to contracts/interfaces/IWitnetPriceFeedsSolverDeployer.sol index 1ec3a4e7..8483672e 100644 --- a/contracts/interfaces/IWitnetPriceSolverDeployer.sol +++ b/contracts/interfaces/IWitnetPriceFeedsSolverDeployer.sol @@ -2,8 +2,8 @@ pragma solidity >=0.8.0 <0.9.0; -interface IWitnetPriceSolverDeployer { - event WitnetPriceSolverDeployed(address solver, bytes32 codehash, bytes constructorParams); +interface IWitnetPriceFeedsSolverDeployer { + event NewPriceFeedsSolver(address solver, bytes32 codehash, bytes constructorParams); function deployPriceSolver(bytes calldata initcode, bytes calldata additionalParams) external returns (address); function determinePriceSolverAddress(bytes calldata initcode, bytes calldata additionalParams) external view returns (address); } \ No newline at end of file diff --git a/contracts/libs/WitnetPriceFeedsLib.sol b/contracts/libs/WitnetPriceFeedsLib.sol index d6445892..ea6f3c18 100644 --- a/contracts/libs/WitnetPriceFeedsLib.sol +++ b/contracts/libs/WitnetPriceFeedsLib.sol @@ -3,14 +3,14 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../interfaces/IWitnetPriceSolver.sol"; -import "../interfaces/IWitnetPriceSolverDeployer.sol"; +import "../interfaces/IWitnetPriceFeedsSolver.sol"; +import "../interfaces/IWitnetPriceFeedsSolverDeployer.sol"; import "../libs/Slices.sol"; /// @title Ancillary deployable library for WitnetPriceFeeds. /// @dev Features: -/// @dev - deployment of counter-factual IWitnetPriceSolver instances. +/// @dev - deployment of counter-factual IWitnetPriceFeedsSolver instances. /// @dev - validation of feed caption strings. /// @author The Witnet Foundation. library WitnetPriceFeedsLib { @@ -40,7 +40,7 @@ library WitnetPriceFeedsLib { // assert(_solver == _createdContract); // fails on TEN chains _solver = _createdContract; require( - IWitnetPriceSolver(_solver).specs() == type(IWitnetPriceSolver).interfaceId, + IWitnetPriceFeedsSolver(_solver).specs() == type(IWitnetPriceFeedsSolver).interfaceId, "WitnetPriceFeedsLib: uncompliant solver implementation" ); } diff --git a/migrations/addresses.json b/migrations/addresses.json index f7c28c68..8476c3e6 100644 --- a/migrations/addresses.json +++ b/migrations/addresses.json @@ -16,7 +16,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "arbitrum:sepolia": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -24,7 +24,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x85cd7aaF5248fC0568B003EF24FB2a5329C95c28", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x682A7dF2852F3Df2d3B4b84803da69A38ba33180", + "WitPriceFeedsV21": "0x682A7dF2852F3Df2d3B4b84803da69A38ba33180", "WitnetRadonRegistryDefault": "0x03604d41a0289cb9325814A6aCA8BaBEf7492B44", "WitnetRequestFactoryDefault": "0x90a7Fc875dac0D453b43BF9E5AeE7dC68091CC24" }, @@ -36,7 +36,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "avalanche:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -44,7 +44,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x5B354083da3c7D034b8b95bE96aC5d114CcdA71f", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -54,7 +54,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableOvm2": "0x9F02CD498b47B928c5a12FdC7cEa36246d27a638", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0xcB61b81a775E56e9Ec8884d2E13352d668294141", + "WitPriceFeedsV21": "0xcB61b81a775E56e9Ec8884d2E13352d668294141", "WitnetRadonRegistryDefault": "0x730a88594d8287Ec898b2B7fE592aB155bE71590", "WitnetRequestFactoryDefault": "0xe1CDE456D3eC92640711625E01170A6800773b91" }, @@ -66,7 +66,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "boba:bnb:mainnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -76,7 +76,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0x0D929cFfa089cA99a644E10A7c7fe1C8C62F657f", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "boba:bnb:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -87,7 +87,7 @@ "WitnetRequestFactoryDefault": "0xFbb35731Fd5c35a84176aBccD214538843eAf5db", "WitnetRequestBoardTrustableOvm": "0xA126d29b0803CD0536c5487C831Daf9cB634318D", "WitnetOracleTrustableOvm2": "0xA126d29b0803CD0536c5487C831Daf9cB634318D", - "WitnetPriceFeedsV21": "0x9E23a4CD5f903b4D0ED1358413250a1e2c459F63" + "WitPriceFeedsV21": "0x9E23a4CD5f903b4D0ED1358413250a1e2c459F63" }, "boba:eth:mainnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -97,7 +97,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "celo:alfajores": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -105,7 +105,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -115,7 +115,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04" }, @@ -129,7 +129,7 @@ "WitnetRadonRegistryDefault": "0x8C6cC510195f2B53abC65340346843Df91F6B940", "WitnetRequestFactoryCfxCore": "0x839d58dE8F143bC01549A7FD62fd508BCA922C8d", "WitnetOracleTrustableDefault": "0x8E6Ddf8bA76350A5fde230a05fc58559A90B878D", - "WitnetPriceFeedsV21": "0x8af4262e9ECb7320a9ffdEe366172EAeA1D60e91", + "WitPriceFeedsV21": "0x8af4262e9ECb7320a9ffdEe366172EAeA1D60e91", "WitnetRadonRegistry": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", "WitnetRequestFactory": "0x8daDc231C8C810CBbe2d555338bDa94DA648f964", "WitnetOracle": "0x8346D6ba3b7a04923492007cC3A2eE7135Db7463", @@ -146,7 +146,7 @@ "WitnetOracleTrustableDefault": "0x857A67Cc046dB5D6414493ED9E65291FF2824116", "WitnetPriceFeeds": "0x8ba3C59e1029cd90010e8C731461ddFC5f49091b", "WitnetPriceFeedsLib": "0x8Ac628741A0983869d237AF759f39a553aE91e47", - "WitnetPriceFeedsV21": "0x80050098a4fdd72409D6C8Ec72FD50ca460349E9", + "WitPriceFeedsV21": "0x80050098a4fdd72409D6C8Ec72FD50ca460349E9", "WitnetRandomnessV2": "0x897832C89ec306A74f9eC29abfFcaDBfCb11A13B", "WitnetRadonRegistry": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", "WitnetRadonRegistryDefault": "0x8176457C9620E8bb508aA22062E1967726179Cc9", @@ -161,7 +161,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "conflux:espace:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -169,7 +169,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x1B9D8186e901b6ED7848374e81B79C9eBf74801E", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -181,7 +181,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "cronos:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -189,7 +189,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x44C4C71c31aD14dB5B18520D3801B88aA26427B0", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -201,7 +201,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "elastos:mainnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -211,7 +211,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "elastos:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -219,7 +219,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -231,7 +231,7 @@ "WitnetRadonRegistryDefault": "0x4a2f2b2E137DD7D4a61389E07c935B14a562078d", "WitnetRequestFactoryDefault": "0x1a5cc6DeE6c7d873639e3eF49678b581f459bBa1", "WitnetOracleTrustableDefault": "0x7084a8C12100cDBB1995aa1B0393A83A0B868837", - "WitnetPriceFeedsV21": "0xC815f56cC791E41a11DB3f0D2880AdB10316fca6" + "WitPriceFeedsV21": "0xC815f56cC791E41a11DB3f0D2880AdB10316fca6" }, "ethereum:sepolia": { "WitnetProxy": "0x21ac85A6c320E6fC89774A98732eAE733032651C", @@ -240,7 +240,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0xE790FdaEa7f1f4C4Bbd74B3493Cf94E79b24396a", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x327470b70d0cCF47cB89a1f3475DE23Ac2437c9e", + "WitPriceFeedsV21": "0x327470b70d0cCF47cB89a1f3475DE23Ac2437c9e", "WitnetRadonRegistryDefault": "0x34e6465f23aE086e5701A6ca8547aF7c29e0283C", "WitnetRequestFactoryDefault": "0x1869A7137dF26397999AA6DB90c7D6D029d13908" }, @@ -250,7 +250,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -262,7 +262,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "kava:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -270,7 +270,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -282,7 +282,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "kcc:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -290,7 +290,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -302,7 +302,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "klaytn:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -310,7 +310,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -322,7 +322,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "mantle:sepolia": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -330,7 +330,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableOvm2": "0x8423ddeb7d86Ce43a9C643bE3A420Ff69825Dd53", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x853DDf69DbEaDA2fc4A521a1dBA5Beb210a5c4d2", + "WitPriceFeedsV21": "0x853DDf69DbEaDA2fc4A521a1dBA5Beb210a5c4d2", "WitnetRadonRegistryDefault": "0xD1960cdC1593Bb9CA75263266dAB75EE33163187", "WitnetRequestFactoryDefault": "0x9ef37BF321828AD49F3D31Fd9Cd36921ee317190" }, @@ -340,7 +340,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -354,7 +354,7 @@ "WitnetRadonRegistryDefault": "0x14D3AAD34a7aB614Feaf72cc0eAab120E64d032F", "WitnetRequestFactoryCfxCore": "0x6Ee46D8db750607ffa5Ec3Eb0DAE969E1916F417", "WitnetOracleTrustableDefault": "0xB11b58238BAf7CBBb608C81e7792cEA29e4E19D0", - "WitnetPriceFeedsV21": "0x7e701068365CFF4f217A32be8059550d8aEdc00D", + "WitPriceFeedsV21": "0x7e701068365CFF4f217A32be8059550d8aEdc00D", "WitnetRadonRegistry": "0xBa84D2ffA26c8fC7EF2c5Bd4839B4b2E4d56D330", "WitnetRequestFactory": "0xc5074dde3FEA0347d3B2E8C38e58e6A34FeEf8EF", "WitnetOracle": "0x1f28E4d955eccE989c00b3871446AB22B3Fa9Cc8", @@ -371,7 +371,7 @@ "WitnetRadonRegistryDefault": "0x8e1EDea211ed85316Bc7F115972C995b5fA897aF", "WitnetRequestFactoryDefault": "0xC69640F34267C5B9F58f716d1385A481D7dff10D", "WitnetOracleTrustableDefault": "0xb7dd2cD53790a5D87f5cfD265D3bD889ed5FC28d", - "WitnetPriceFeedsV21": "0x89eE40cfb4F7D9f56Ee2E2E9B1580176361D84eC", + "WitPriceFeedsV21": "0x89eE40cfb4F7D9f56Ee2E2E9B1580176361D84eC", "WitnetRadonRegistry": "0x87E25Ad751306b21F9345494F163122e057B7b53", "WitnetRequestFactory": "0xd0b4512F4c9291de4104a1ad7be0c51956044bbC", "WitnetOracle": "0x51e12A16d52DE519f7b13bFeDa42Fb61214d32a0", @@ -387,7 +387,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "moonbeam:moonbase": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -395,7 +395,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -407,7 +407,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "okx:oktchain:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -415,7 +415,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -425,7 +425,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -436,7 +436,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04" }, @@ -447,7 +447,7 @@ "WitnetOracleDataLib": "0x25d57Cf8a047B14172Ba2a929C1441E1A77c3f9D", "WitnetOracleTrustableOvm2": "0xc1C158e77A91da158a1A2D0c2A154c68a8C7c0d2", "WitnetPriceFeedsLib": "0x85aa4A0fDa112c47d4216448EE4D49Afd072675e", - "WitnetPriceFeedsV21": "0xA936f7F4909494Ea1F7D898C2759b2324912153d", + "WitPriceFeedsV21": "0xA936f7F4909494Ea1F7D898C2759b2324912153d", "WitnetRadonRegistryDefault": "0x2D8BCBC4F8c97CC227e770d95d19914324baBF2A", "WitnetRequestFactoryDefault": "0x3D551165020a4014A8d5b9E4b73D2b3Dbe401546" }, @@ -457,7 +457,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -469,7 +469,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "polygon:zkevm:mainnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -479,7 +479,7 @@ "WitnetRadonRegistryNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "reef:mainnet": { "WitnetDeployer": "0x94d6e5321039343f5e656aa7591dfbdbe81ff78f", @@ -491,7 +491,7 @@ "WitnetRadonRegistryDefault": "0x1A80B677A9dd6a6762273593FE2797927c4010A4", "WitnetRequestFactoryDefault": "0x71E2e26E5EfF3C05935A497282Fe018963b78F55", "WitnetOracleTrustableReef": "0x7950250D3d2ae1636a7Ca2a8A6ba53e46D1cB573", - "WitnetPriceFeedsV21": "0x8af56567C7F0Deaf8979244d83194816a6ED144F", + "WitPriceFeedsV21": "0x8af56567C7F0Deaf8979244d83194816a6ED144F", "WitnetRadonRegistry": "0xC4b7a5aD8BAF8fea9DbeB18aB6F77cdf54CF297a", "WitnetRequestFactory": "0xEBa788A5de67E4B11869558a2414247e8Aa62179", "WitnetOracle": "0x604b98893335CEf7Dc40061731F40aC5C6239907", @@ -507,7 +507,7 @@ "WitnetRadonRegistryNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "scroll:sepolia": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -515,7 +515,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -527,7 +527,7 @@ "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773", "WitnetOracleTrustableOvm2": "0x9Bd67787019a6474ddE27f9c9A37260c87Da92B5", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" }, "ten:testnet": { "WitnetProxy": "0xaC3E870BF8D13Dc39f76936b6AF8279eF5a9211F", @@ -536,7 +536,7 @@ "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", "WitnetOracleTrustableObscuro": "0x2330f492635c2E7476bB2A3162e69129F6FEaB56", "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, @@ -548,7 +548,7 @@ "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", - "WitnetPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" + "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "ultron:testnet": { "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", @@ -558,6 +558,6 @@ "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773", "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", - "WitnetPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" + "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" } } \ No newline at end of file diff --git a/migrations/constructorArgs.json b/migrations/constructorArgs.json index 2e5b68c2..a6090948 100644 --- a/migrations/constructorArgs.json +++ b/migrations/constructorArgs.json @@ -2,7 +2,7 @@ "default": { "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31322d61653734633030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRandomnessV2": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000f121b71715e71dded592f1125a06d4ed06f0694d", "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", @@ -12,25 +12,25 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "avalanche:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "base:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "boba:bnb:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "boba:bnb:testnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000", @@ -41,7 +41,7 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "celo:alfajores": { "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64383461343832000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" @@ -50,26 +50,26 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "conflux:core:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryCfxCore": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db746300000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "0000000000000000000000008dadc231c8c810cbbe2d555338bda94da648f96400000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitPriceFeedsV21": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRandomnessV2": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000001169bf81ecf738d02fd8d3824dfe02153b334ef7" }, "conflux:core:testnet": { "WitnetRequestFactoryCfxCore": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db746300000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "0000000000000000000000008dadc231c8c810cbbe2d555338bda94da648f96400000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitPriceFeedsV21": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRandomnessV2": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000001169bf81ecf738d02fd8d3824dfe02153b334ef7" }, "conflux:espace:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "conflux:espace:testnet": { "WitnetRequestFactoryCfxCore": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" @@ -78,31 +78,31 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "dogechain:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "elastos:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "ethereum:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000" }, "kava:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "kava:testnet": { "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" @@ -111,7 +111,7 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "kcc:testnet": { "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" @@ -120,7 +120,7 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "klaytn:testnet": { "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" @@ -129,19 +129,19 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "meter:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryCfxCore": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc8000000000000000000000000ba84d2ffa26c8fc7ef2c5bd4839b4b2e4d56d3300000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000c5074dde3fea0347d3b2e8c38e58e6a34feef8ef000000000000000000000000ba84d2ffa26c8fc7ef2c5bd4839b4b2e4d56d3300000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc80000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitPriceFeedsV21": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc80000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRandomnessV2": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc8000000000000000000000000e169bf81ecf738d02fd8d3824dfe02153b334ef7" }, "meter:testnet": { "WitnetRequestFactoryDefault": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a000000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000d0b4512f4c9291de4104a1ad7be0c51956044bbc00000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a00000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitPriceFeedsV21": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a00000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRandomnessV2": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a0000000000000000000000000e169bf81ecf738d02fd8d3824dfe02153b334ef7", "WitnetRequestFactoryCfxCore": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a000000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" }, @@ -152,31 +152,31 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "moonbeam:moonriver": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "optimism:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "polygon:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "polygon:zkevm:mainnet": { "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "reef:mainnet": { "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d34333966396166000000000000000000000000000000000000" @@ -185,7 +185,7 @@ "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "syscoin:rollux:testnet": { "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" @@ -197,6 +197,6 @@ "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" + "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" } } \ No newline at end of file diff --git a/migrations/scripts/5_apps.js b/migrations/scripts/5_apps.js index 6460864c..4d955307 100644 --- a/migrations/scripts/5_apps.js +++ b/migrations/scripts/5_apps.js @@ -13,7 +13,7 @@ module.exports = async function (_, network, [, from]) { // once all core Witnet Oracle artifacts get deployed and initialized. // ========================================================================== - // --- WitnetRandomnessV21 -------------------------------------------------- + // --- WitRandomnessV21 -------------------------------------------------- if (!process.argv.includes("--no-randomness")) { await deploy({ diff --git a/settings/artifacts.js b/settings/artifacts.js index c32ebdc6..587a0b95 100644 --- a/settings/artifacts.js +++ b/settings/artifacts.js @@ -2,8 +2,8 @@ module.exports = { default: { WitnetDeployer: "WitnetDeployer", WitnetOracle: "WitnetOracleTrustableDefault", - WitnetPriceFeeds: "WitnetPriceFeedsV21", - WitnetRandomness: "WitnetRandomnessV21", + WitnetPriceFeeds: "WitPriceFeedsV21", + WitnetRandomness: "WitRandomnessV21", WitnetRadonRegistry: "WitnetRadonRegistryDefault", WitnetRequestFactory: "WitnetRequestFactoryDefault", WitnetEncodingLib: "WitnetEncodingLib", diff --git a/src/index.js b/src/index.js index 2fe2d6b9..1dc4c6f8 100644 --- a/src/index.js +++ b/src/index.js @@ -13,7 +13,7 @@ module.exports = { return { WitnetOracle: merged?.WitnetOracle, WitnetPriceFeeds: merged?.WitnetPriceFeeds, - WitnetRandomnessV21: merged?.WitnetRandomnessV21, + WitRandomnessV21: merged?.WitRandomnessV21, } } else { return {} @@ -33,7 +33,7 @@ module.exports = { artifacts: { WitnetOracle: require("../artifacts/contracts/WitnetOracle.sol/WitnetOracle.json"), WitnetPriceFeeds: require("../artifacts/contracts/WitnetPriceFeeds.sol/WitnetPriceFeeds.json"), - WitnetPriceRouteSolver: require("../artifacts/contracts/interfaces/IWitnetPriceSolver.sol/IWitnetPriceSolver.json"), + WitnetPriceRouteSolver: require("../artifacts/contracts/interfaces/IWitnetPriceFeedsSolver.sol/IWitnetPriceFeedsSolver.json"), WitnetRandomness: require("../artifacts/contracts/WitnetRandomness.sol/WitnetRandomness.json"), WitnetRequest: require("../artifacts/contracts/WitnetRequest.sol/WitnetRequest.json"), WitnetRadonRegistry: require("../artifacts/contracts/WitnetRadonRegistry.sol/WitnetRadonRegistry.json"), diff --git a/test/mocks/WitnetMockedOracle.sol b/test/mocks/WitMockedOracle.sol similarity index 77% rename from test/mocks/WitnetMockedOracle.sol rename to test/mocks/WitMockedOracle.sol index 332160ba..94cfd191 100644 --- a/test/mocks/WitnetMockedOracle.sol +++ b/test/mocks/WitMockedOracle.sol @@ -3,23 +3,23 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetMockedRadonRegistry.sol"; -import "./WitnetMockedRequestFactory.sol"; +import "./WitMockedRadonRegistry.sol"; +import "./WitMockedRequestFactory.sol"; import "../../contracts/core/trustable/WitnetOracleTrustableDefault.sol"; -import "./WitnetMockedPriceFeeds.sol"; -import "./WitnetMockedRandomness.sol"; +import "./WitMockedPriceFeeds.sol"; +import "./WitMockedRandomness.sol"; /// @title Mocked implementation of `WitnetOracle`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE /// @dev THE `WitnetOracle` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. -contract WitnetMockedOracle +contract WitMockedOracle is WitnetOracleTrustableDefault { - constructor(WitnetMockedRadonRegistry _registry) + constructor(WitMockedRadonRegistry _registry) WitnetOracleTrustableDefault( WitnetRadonRegistry(_registry), WitnetRequestFactory(address(0)), diff --git a/test/mocks/WitnetMockedPriceFeeds.sol b/test/mocks/WitMockedPriceFeeds.sol similarity index 67% rename from test/mocks/WitnetMockedPriceFeeds.sol rename to test/mocks/WitMockedPriceFeeds.sol index 2897713f..8b86b8b6 100644 --- a/test/mocks/WitnetMockedPriceFeeds.sol +++ b/test/mocks/WitMockedPriceFeeds.sol @@ -3,17 +3,17 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetMockedOracle.sol"; -import "../../contracts/apps/WitnetPriceFeedsV21.sol"; +import "./WitMockedOracle.sol"; +import "../../contracts/apps/WitPriceFeedsV21.sol"; /// @title Mocked implementation of `WitnetPriceFeeds`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE /// @dev THE `WitnetPriceFeeds` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. -contract WitnetMockedPriceFeeds is WitnetPriceFeedsV21 { - constructor(WitnetMockedOracle _wrb) - WitnetPriceFeedsV21( +contract WitMockedPriceFeeds is WitPriceFeedsV21 { + constructor(WitMockedOracle _wrb) + WitPriceFeedsV21( _wrb, false, bytes32("mocked") diff --git a/test/mocks/WitnetMockedRadonRegistry.sol b/test/mocks/WitMockedRadonRegistry.sol similarity index 89% rename from test/mocks/WitnetMockedRadonRegistry.sol rename to test/mocks/WitMockedRadonRegistry.sol index 42d6818c..b604f7d9 100644 --- a/test/mocks/WitnetMockedRadonRegistry.sol +++ b/test/mocks/WitMockedRadonRegistry.sol @@ -10,7 +10,7 @@ import "../../contracts/core/trustless/WitnetRadonRegistryDefault.sol"; /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE /// @dev THE `WitnetRadonRegistry` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. -contract WitnetMockedRadonRegistry is WitnetRadonRegistryDefault { +contract WitMockedRadonRegistry is WitnetRadonRegistryDefault { constructor() WitnetRadonRegistryDefault( false, diff --git a/test/mocks/WitnetMockedRandomness.sol b/test/mocks/WitMockedRandomness.sol similarity index 56% rename from test/mocks/WitnetMockedRandomness.sol rename to test/mocks/WitMockedRandomness.sol index 704ba50e..97f48e5e 100644 --- a/test/mocks/WitnetMockedRandomness.sol +++ b/test/mocks/WitMockedRandomness.sol @@ -1,18 +1,18 @@ -// SPDX-License-Identifier: MIT +ยบ// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetMockedOracle.sol"; -import "../../contracts/apps/WitnetRandomnessV21.sol"; +import "./WitMockedOracle.sol"; +import "../../contracts/apps/WitRandomnessV21.sol"; /// @title Mocked implementation of `WitnetRandomness`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE /// @dev THE `WitnetRandomness` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. -contract WitnetMockedRandomness is WitnetRandomnessV21 { - constructor(WitnetMockedOracle _wrb) - WitnetRandomnessV21(_wrb, msg.sender) +contract WitMockedRandomness is WitRandomnessV21 { + constructor(WitMockedOracle _wrb) + WitRandomnessV21(_wrb, msg.sender) {} } diff --git a/test/mocks/WitnetMockedRequestFactory.sol b/test/mocks/WitMockedRequestFactory.sol similarity index 84% rename from test/mocks/WitnetMockedRequestFactory.sol rename to test/mocks/WitMockedRequestFactory.sol index 723e3a25..48eeb16f 100644 --- a/test/mocks/WitnetMockedRequestFactory.sol +++ b/test/mocks/WitMockedRequestFactory.sol @@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetMockedOracle.sol"; +import "./WitMockedOracle.sol"; import "../../contracts/core/trustless/WitnetRequestFactoryDefault.sol"; /// @title Mocked implementation of `WitnetRequestFactory`. @@ -11,11 +11,11 @@ import "../../contracts/core/trustless/WitnetRequestFactoryDefault.sol"; /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE /// @dev THE `WitnetRequestFactory` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. -contract WitnetMockedRequestFactory +contract WitMockedRequestFactory is WitnetRequestFactoryDefault { - constructor (WitnetMockedOracle _wrb) + constructor (WitMockedOracle _wrb) WitnetRequestFactoryDefault( WitnetOracle(address(_wrb)), false, From fd9f1fee76ceca5fb4094118ea758a34063e2dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sun, 4 Aug 2024 16:21:37 +0200 Subject: [PATCH 21/39] refactor: *Witnet* -> *Wit* | *WitOracle* --- README.md | 14 +- contracts/{WitnetFeeds.sol => WitFeeds.sol} | 16 +- contracts/WitOracle.sol | 19 + contracts/WitOracleRadonRegistry.sol | 15 + contracts/WitOracleRequest.sol | 13 + contracts/WitOracleRequestFactory.sol | 17 + contracts/WitOracleRequestTemplate.sol | 17 + contracts/WitPriceFeeds.sol | 18 + contracts/WitRandomness.sol | 16 + contracts/WitnetOracle.sol | 19 - contracts/WitnetPriceFeeds.sol | 18 - contracts/WitnetRadonRegistry.sol | 15 - contracts/WitnetRandomness.sol | 16 - contracts/WitnetRequest.sol | 13 - contracts/WitnetRequestFactory.sol | 17 - contracts/WitnetRequestTemplate.sol | 17 - contracts/apps/WitPriceFeedsV21.sol | 98 +-- contracts/apps/WitRandomnessV21.sol | 40 +- .../{trustless => }/WitnetDeployerCfxCore.sol | 2 +- .../{trustless => }/WitnetDeployerMeter.sol | 2 +- ...bleBase.sol => WitOracleTrustableBase.sol} | 132 +-- ...ault.sol => WitOracleTrustableDefault.sol} | 18 +- ...curo.sol => WitOracleTrustableObscuro.sol} | 22 +- ...bleOvm2.sol => WitOracleTrustableOvm2.sol} | 36 +- ...bleReef.sol => WitOracleTrustableReef.sol} | 20 +- ....sol => WitOracleRadonRegistryDefault.sol} | 44 +- ...sol => WitOracleRadonRegistryNoSha256.sol} | 10 +- ...sol => WitOracleRequestFactoryCfxCore.sol} | 10 +- ...sol => WitOracleRequestFactoryDefault.sol} | 136 ++-- .../trustless/WitPriceFeedsSolverBase.sol | 10 +- ...OracleDataLib.sol => WitOracleDataLib.sol} | 10 +- ...ata.sol => WitOracleRadonRegistryData.sol} | 6 +- ...ta.sol => WitOracleRequestFactoryData.sol} | 30 +- ...iceFeedsData.sol => WitPriceFeedsData.sol} | 8 +- contracts/interfaces/IFeeds.sol | 2 +- ...IWitnetAppliance.sol => IWitAppliance.sol} | 2 +- .../{IWitnetFeeds.sol => IWitFeeds.sol} | 12 +- ...itnetFeedsAdmin.sol => IWitFeedsAdmin.sol} | 10 +- ...netFeedsEvents.sol => IWitFeedsEvents.sol} | 2 +- ...netFeedsLegacy.sol => IWitFeedsLegacy.sol} | 2 +- .../{IWitnetOracle.sol => IWitOracle.sol} | 50 +- ...uestBoardAdmin.sol => IWitOracleAdmin.sol} | 2 +- ...dAdminACLs.sol => IWitOracleAdminACLs.sol} | 2 +- contracts/interfaces/IWitOracleAppliance.sol | 13 + ...netConsumer.sol => IWitOracleConsumer.sol} | 18 +- ...tOracleEvents.sol => IWitOracleEvents.sol} | 4 +- ...tOracleLegacy.sol => IWitOracleLegacy.sol} | 4 +- ...gistry.sol => IWitOracleRadonRegistry.sol} | 2 +- ....sol => IWitOracleRadonRegistryEvents.sol} | 8 +- ....sol => IWitOracleRadonRegistryLegacy.sol} | 2 +- ...cleReporter.sol => IWitOracleReporter.sol} | 2 +- ...itnetRequest.sol => IWitOracleRequest.sol} | 12 +- ...ctory.sol => IWitOracleRequestFactory.sol} | 12 +- .../IWitOracleRequestFactoryEvents.sol | 12 + ...late.sol => IWitOracleRequestTemplate.sol} | 22 +- ...itnetPriceFeeds.sol => IWitPriceFeeds.sol} | 12 +- ...edsSolver.sol => IWitPriceFeedsSolver.sol} | 2 +- ...er.sol => IWitPriceFeedsSolverFactory.sol} | 2 +- ...itnetRandomness.sol => IWitRandomness.sol} | 4 +- ...mnessAdmin.sol => IWitRandomnessAdmin.sol} | 2 +- ...essEvents.sol => IWitRandomnessEvents.sol} | 2 +- .../interfaces/IWitnetOracleAppliance.sol | 13 - .../IWitnetRequestFactoryEvents.sol | 12 - ...gLib.sol => WitOracleRadonEncodingLib.sol} | 20 +- ...rsLib.sol => WitOracleResultErrorsLib.sol} | 8 +- ...PriceFeedsLib.sol => WitPriceFeedsLib.sol} | 18 +- .../{UsingWitnet.sol => UsingWitOracle.sol} | 22 +- contracts/mocks/UsingWitOracleRandomness.sol | 30 + ...tRequest.sol => UsingWitOracleRequest.sol} | 20 +- ....sol => UsingWitOracleRequestTemplate.sol} | 26 +- contracts/mocks/UsingWitnetRandomness.sol | 30 - .../{WitnetConsumer.sol => WitConsumer.sol} | 20 +- ...sumer.sol => WitOracleRequestConsumer.sol} | 24 +- ...l => WitOracleRequestTemplateConsumer.sol} | 24 +- ...r.sol => WitRandomnessRequestConsumer.sol} | 20 +- migrations/addresses.json | 766 +++++++++--------- migrations/constructorArgs.json | 188 ++--- migrations/scripts/2_libs.js | 8 +- migrations/scripts/3_core.js | 48 +- migrations/scripts/4_proxies.js | 12 +- migrations/scripts/5_apps.js | 10 +- package.json | 2 +- scripts/verify-apps.js | 2 +- scripts/verify-core.js | 8 +- scripts/verify-impls.js | 8 +- scripts/verify-libs.js | 8 +- settings/artifacts.js | 50 +- settings/specs.js | 46 +- src/index.js | 20 +- ....sol => TestWitOracleRadonEncodingLib.sol} | 34 +- test/TestWitnetV2.sol | 8 +- test/mocks/MyDapp.sol | 14 +- test/mocks/WitMockedOracle.sol | 14 +- test/mocks/WitMockedPriceFeeds.sol | 4 +- test/mocks/WitMockedRadonRegistry.sol | 10 +- test/mocks/WitMockedRandomness.sol | 4 +- test/mocks/WitMockedRequestFactory.sol | 12 +- test/witnet_bytecodes.test.js | 24 +- 98 files changed, 1350 insertions(+), 1350 deletions(-) rename contracts/{WitnetFeeds.sol => WitFeeds.sol} (69%) create mode 100644 contracts/WitOracle.sol create mode 100644 contracts/WitOracleRadonRegistry.sol create mode 100644 contracts/WitOracleRequest.sol create mode 100644 contracts/WitOracleRequestFactory.sol create mode 100644 contracts/WitOracleRequestTemplate.sol create mode 100644 contracts/WitPriceFeeds.sol create mode 100644 contracts/WitRandomness.sol delete mode 100644 contracts/WitnetOracle.sol delete mode 100644 contracts/WitnetPriceFeeds.sol delete mode 100644 contracts/WitnetRadonRegistry.sol delete mode 100644 contracts/WitnetRandomness.sol delete mode 100644 contracts/WitnetRequest.sol delete mode 100644 contracts/WitnetRequestFactory.sol delete mode 100644 contracts/WitnetRequestTemplate.sol rename contracts/core/{trustless => }/WitnetDeployerCfxCore.sol (99%) rename contracts/core/{trustless => }/WitnetDeployerMeter.sol (99%) rename contracts/core/trustable/{WitnetOracleTrustableBase.sol => WitOracleTrustableBase.sol} (88%) rename contracts/core/trustable/{WitnetOracleTrustableDefault.sol => WitOracleTrustableDefault.sol} (92%) rename contracts/core/trustable/{WitnetOracleTrustableObscuro.sol => WitOracleTrustableObscuro.sol} (80%) rename contracts/core/trustable/{WitnetOracleTrustableOvm2.sol => WitOracleTrustableOvm2.sol} (82%) rename contracts/core/trustable/{WitnetOracleTrustableReef.sol => WitOracleTrustableReef.sol} (81%) rename contracts/core/trustless/{WitnetRadonRegistryDefault.sol => WitOracleRadonRegistryDefault.sol} (92%) rename contracts/core/trustless/{WitnetRadonRegistryNoSha256.sol => WitOracleRadonRegistryNoSha256.sol} (61%) rename contracts/core/trustless/{WitnetRequestFactoryCfxCore.sol => WitOracleRequestFactoryCfxCore.sol} (70%) rename contracts/core/trustless/{WitnetRequestFactoryDefault.sol => WitOracleRequestFactoryDefault.sol} (79%) rename contracts/data/{WitnetOracleDataLib.sol => WitOracleDataLib.sol} (94%) rename contracts/data/{WitnetRadonRegistryData.sol => WitOracleRadonRegistryData.sol} (92%) rename contracts/data/{WitnetRequestFactoryData.sol => WitOracleRequestFactoryData.sol} (61%) rename contracts/data/{WitnetPriceFeedsData.sol => WitPriceFeedsData.sol} (92%) rename contracts/interfaces/{IWitnetAppliance.sol => IWitAppliance.sol} (92%) rename contracts/interfaces/{IWitnetFeeds.sol => IWitFeeds.sol} (92%) rename contracts/interfaces/{IWitnetFeedsAdmin.sol => IWitFeedsAdmin.sol} (76%) rename contracts/interfaces/{IWitnetFeedsEvents.sol => IWitFeedsEvents.sol} (93%) rename contracts/interfaces/{IWitnetFeedsLegacy.sol => IWitFeedsLegacy.sol} (88%) rename contracts/interfaces/{IWitnetOracle.sol => IWitOracle.sol} (86%) rename contracts/interfaces/{IWitnetRequestBoardAdmin.sol => IWitOracleAdmin.sol} (92%) rename contracts/interfaces/{IWitnetRequestBoardAdminACLs.sol => IWitOracleAdminACLs.sol} (95%) create mode 100644 contracts/interfaces/IWitOracleAppliance.sol rename contracts/interfaces/{IWitnetConsumer.sol => IWitOracleConsumer.sol} (80%) rename contracts/interfaces/{IWitnetOracleEvents.sol => IWitOracleEvents.sol} (95%) rename contracts/interfaces/{IWitnetOracleLegacy.sol => IWitOracleLegacy.sol} (95%) rename contracts/interfaces/{IWitnetRadonRegistry.sol => IWitOracleRadonRegistry.sol} (99%) rename contracts/interfaces/{IWitnetRadonRegistryEvents.sol => IWitOracleRadonRegistryEvents.sol} (71%) rename contracts/interfaces/{IWitnetRadonRegistryLegacy.sol => IWitOracleRadonRegistryLegacy.sol} (93%) rename contracts/interfaces/{IWitnetOracleReporter.sol => IWitOracleReporter.sol} (99%) rename contracts/interfaces/{IWitnetRequest.sol => IWitOracleRequest.sol} (85%) rename contracts/interfaces/{IWitnetRequestFactory.sol => IWitOracleRequestFactory.sol} (88%) create mode 100644 contracts/interfaces/IWitOracleRequestFactoryEvents.sol rename contracts/interfaces/{IWitnetRequestTemplate.sol => IWitOracleRequestTemplate.sol} (77%) rename contracts/interfaces/{IWitnetPriceFeeds.sol => IWitPriceFeeds.sol} (69%) rename contracts/interfaces/{IWitnetPriceFeedsSolver.sol => IWitPriceFeedsSolver.sol} (93%) rename contracts/interfaces/{IWitnetPriceFeedsSolverDeployer.sol => IWitPriceFeedsSolverFactory.sol} (90%) rename contracts/interfaces/{IWitnetRandomness.sol => IWitRandomness.sol} (99%) rename contracts/interfaces/{IWitnetRandomnessAdmin.sol => IWitRandomnessAdmin.sol} (93%) rename contracts/interfaces/{IWitnetRandomnessEvents.sol => IWitRandomnessEvents.sol} (91%) delete mode 100644 contracts/interfaces/IWitnetOracleAppliance.sol delete mode 100644 contracts/interfaces/IWitnetRequestFactoryEvents.sol rename contracts/libs/{WitnetEncodingLib.sol => WitOracleRadonEncodingLib.sol} (94%) rename contracts/libs/{WitnetErrorsLib.sol => WitOracleResultErrorsLib.sol} (97%) rename contracts/libs/{WitnetPriceFeedsLib.sol => WitPriceFeedsLib.sol} (81%) rename contracts/mocks/{UsingWitnet.sol => UsingWitOracle.sol} (86%) create mode 100644 contracts/mocks/UsingWitOracleRandomness.sol rename contracts/mocks/{UsingWitnetRequest.sol => UsingWitOracleRequest.sol} (66%) rename contracts/mocks/{UsingWitnetRequestTemplate.sol => UsingWitOracleRequestTemplate.sol} (63%) delete mode 100644 contracts/mocks/UsingWitnetRandomness.sol rename contracts/mocks/{WitnetConsumer.sol => WitConsumer.sol} (74%) rename contracts/mocks/{WitnetRequestConsumer.sol => WitOracleRequestConsumer.sol} (62%) rename contracts/mocks/{WitnetRequestTemplateConsumer.sol => WitOracleRequestTemplateConsumer.sol} (61%) rename contracts/mocks/{WitnetRandomnessRequestConsumer.sol => WitRandomnessRequestConsumer.sol} (87%) rename test/{TestWitnetEncodingLib.sol => TestWitOracleRadonEncodingLib.sol} (77%) diff --git a/README.md b/README.md index 03bf7dc2..3dd714e1 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Should any artifact require customized contract implementations: When modifying the existing source code, or the contents of `settings/artifacts` or `settings/specs`, you may need to upgrade some of the artifacts on certain networks. Just add the `--artifacts` parameter and a comma-separated list of the artifacts you need to upgrade. For instance: -`$ pnpm run migrate : WitnetErrorsLib,WitnetPriceFeeds` +`$ pnpm run migrate : WitOracleResultErrorsLib,WitPriceFeeds` When specifying deployable library artifacts, the depending contracts will be attempted to be upgraded as well. @@ -56,13 +56,13 @@ Javacript methods and resources: - WEB addresses at a given chain: - `getAddresses(network)` - WEB artifacts: - - `assets.WitnetOracle` - - `assets.WitnetPriceFeeds` + - `assets.WitOracle` + - `assets.WitPriceFeeds` - `assets.WitnetPriceRouteSolver` - - `assets.WitnetRequest` - - `assets.WitnetRadonRegistry` - - `assets.WitnetRequestFactory` - - `assets.WitnetRequestTemplate` + - `assets.WitOracleRequest` + - `assets.WitOracleRadonRegistry` + - `assets.WitOracleRequestFactory` + - `assets.WitOracleRequestTemplate` - `assets.WitnetUpgrableBase` ### `require("witnet-solidity-bridge/utils")` diff --git a/contracts/WitnetFeeds.sol b/contracts/WitFeeds.sol similarity index 69% rename from contracts/WitnetFeeds.sol rename to contracts/WitFeeds.sol index 720bc108..9248d04c 100644 --- a/contracts/WitnetFeeds.sol +++ b/contracts/WitFeeds.sol @@ -3,20 +3,20 @@ pragma solidity >=0.7.0 <0.9.0; import "./interfaces/IFeeds.sol"; -import "./interfaces/IWitnetFeeds.sol"; -import "./interfaces/IWitnetFeedsEvents.sol"; -import "./interfaces/IWitnetOracleAppliance.sol"; +import "./interfaces/IWitFeeds.sol"; +import "./interfaces/IWitFeedsEvents.sol"; +import "./interfaces/IWitOracleAppliance.sol"; import "ado-contracts/contracts/interfaces/IERC2362.sol"; -abstract contract WitnetFeeds +abstract contract WitFeeds is IERC2362, IFeeds, - IWitnetFeeds, - IWitnetFeedsEvents, - IWitnetOracleAppliance, - IWitnetOracleEvents + IWitFeeds, + IWitFeedsEvents, + IWitOracleAppliance, + IWitOracleEvents { Witnet.RadonDataTypes immutable public override dataType; bytes32 immutable internal __prefix; diff --git a/contracts/WitOracle.sol b/contracts/WitOracle.sol new file mode 100644 index 00000000..0ffef52e --- /dev/null +++ b/contracts/WitOracle.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; + +import "./WitOracleRadonRegistry.sol"; +import "./WitOracleRequestFactory.sol"; + +import "./interfaces/IWitAppliance.sol"; +import "./interfaces/IWitOracle.sol"; +import "./interfaces/IWitOracleEvents.sol"; + +/// @title Witnet Request Board functionality base contract. +/// @author The Witnet Foundation. +abstract contract WitOracle + is + IWitAppliance, + IWitOracle, + IWitOracleEvents +{} diff --git a/contracts/WitOracleRadonRegistry.sol b/contracts/WitOracleRadonRegistry.sol new file mode 100644 index 00000000..f928082a --- /dev/null +++ b/contracts/WitOracleRadonRegistry.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; +pragma experimental ABIEncoderV2; + +import "./interfaces/IWitAppliance.sol"; +import "./interfaces/IWitOracleRadonRegistry.sol"; +import "./interfaces/IWitOracleRadonRegistryEvents.sol"; + +abstract contract WitOracleRadonRegistry + is + IWitAppliance, + IWitOracleRadonRegistry, + IWitOracleRadonRegistryEvents +{} diff --git a/contracts/WitOracleRequest.sol b/contracts/WitOracleRequest.sol new file mode 100644 index 00000000..86b97390 --- /dev/null +++ b/contracts/WitOracleRequest.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; +pragma experimental ABIEncoderV2; + +import "./interfaces/IWitOracleAppliance.sol"; +import "./interfaces/IWitOracleRequest.sol"; + +abstract contract WitOracleRequest + is + IWitOracleAppliance, + IWitOracleRequest +{} diff --git a/contracts/WitOracleRequestFactory.sol b/contracts/WitOracleRequestFactory.sol new file mode 100644 index 00000000..9193089b --- /dev/null +++ b/contracts/WitOracleRequestFactory.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; +pragma experimental ABIEncoderV2; + +import "./interfaces/IWitOracleAppliance.sol"; +import "./interfaces/IWitOracleRadonRegistryEvents.sol"; +import "./interfaces/IWitOracleRequestFactory.sol"; +import "./interfaces/IWitOracleRequestFactoryEvents.sol"; + +abstract contract WitOracleRequestFactory + is + IWitOracleAppliance, + IWitOracleRadonRegistryEvents, + IWitOracleRequestFactory, + IWitOracleRequestFactoryEvents +{} diff --git a/contracts/WitOracleRequestTemplate.sol b/contracts/WitOracleRequestTemplate.sol new file mode 100644 index 00000000..e61c034a --- /dev/null +++ b/contracts/WitOracleRequestTemplate.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; +pragma experimental ABIEncoderV2; + +import "./interfaces/IWitOracleAppliance.sol"; +import "./interfaces/IWitOracleRadonRegistryEvents.sol"; +import "./interfaces/IWitOracleRequestFactoryEvents.sol"; +import "./interfaces/IWitOracleRequestTemplate.sol"; + +abstract contract WitOracleRequestTemplate + is + IWitOracleAppliance, + IWitOracleRadonRegistryEvents, + IWitOracleRequestFactoryEvents, + IWitOracleRequestTemplate +{} diff --git a/contracts/WitPriceFeeds.sol b/contracts/WitPriceFeeds.sol new file mode 100644 index 00000000..e2de2b55 --- /dev/null +++ b/contracts/WitPriceFeeds.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; + +import "./WitFeeds.sol"; +import "./interfaces/IWitPriceFeeds.sol"; + +/// @title WitPriceFeeds: Price Feeds live repository reliant on the Witnet Oracle blockchain. +/// @author The Witnet Foundation. +abstract contract WitPriceFeeds + is + WitFeeds, + IWitPriceFeeds +{ + constructor() + WitFeeds(Witnet.RadonDataTypes.Integer, "Price-") + {} +} diff --git a/contracts/WitRandomness.sol b/contracts/WitRandomness.sol new file mode 100644 index 00000000..25502574 --- /dev/null +++ b/contracts/WitRandomness.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.8.0 <0.9.0; + +import "./interfaces/IWitOracleAppliance.sol"; +import "./interfaces/IWitOracleEvents.sol"; +import "./interfaces/IWitRandomness.sol"; +import "./interfaces/IWitRandomnessEvents.sol"; + +abstract contract WitRandomness + is + IWitOracleAppliance, + IWitOracleEvents, + IWitRandomness, + IWitRandomnessEvents +{} diff --git a/contracts/WitnetOracle.sol b/contracts/WitnetOracle.sol deleted file mode 100644 index 934e291b..00000000 --- a/contracts/WitnetOracle.sol +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.7.0 <0.9.0; - -import "./WitnetRadonRegistry.sol"; -import "./WitnetRequestFactory.sol"; - -import "./interfaces/IWitnetAppliance.sol"; -import "./interfaces/IWitnetOracle.sol"; -import "./interfaces/IWitnetOracleEvents.sol"; - -/// @title Witnet Request Board functionality base contract. -/// @author The Witnet Foundation. -abstract contract WitnetOracle - is - IWitnetAppliance, - IWitnetOracle, - IWitnetOracleEvents -{} diff --git a/contracts/WitnetPriceFeeds.sol b/contracts/WitnetPriceFeeds.sol deleted file mode 100644 index 2db722cb..00000000 --- a/contracts/WitnetPriceFeeds.sol +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.7.0 <0.9.0; - -import "./WitnetFeeds.sol"; -import "./interfaces/IWitnetPriceFeeds.sol"; - -/// @title WitnetPriceFeeds: Price Feeds live repository reliant on the Witnet Oracle blockchain. -/// @author The Witnet Foundation. -abstract contract WitnetPriceFeeds - is - WitnetFeeds, - IWitnetPriceFeeds -{ - constructor() - WitnetFeeds(Witnet.RadonDataTypes.Integer, "Price-") - {} -} diff --git a/contracts/WitnetRadonRegistry.sol b/contracts/WitnetRadonRegistry.sol deleted file mode 100644 index 58f085a2..00000000 --- a/contracts/WitnetRadonRegistry.sol +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.7.0 <0.9.0; -pragma experimental ABIEncoderV2; - -import "./interfaces/IWitnetAppliance.sol"; -import "./interfaces/IWitnetRadonRegistry.sol"; -import "./interfaces/IWitnetRadonRegistryEvents.sol"; - -abstract contract WitnetRadonRegistry - is - IWitnetAppliance, - IWitnetRadonRegistry, - IWitnetRadonRegistryEvents -{} diff --git a/contracts/WitnetRandomness.sol b/contracts/WitnetRandomness.sol deleted file mode 100644 index 08c8cf1f..00000000 --- a/contracts/WitnetRandomness.sol +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.8.0 <0.9.0; - -import "./interfaces/IWitnetOracleAppliance.sol"; -import "./interfaces/IWitnetOracleEvents.sol"; -import "./interfaces/IWitnetRandomness.sol"; -import "./interfaces/IWitnetRandomnessEvents.sol"; - -abstract contract WitnetRandomness - is - IWitnetOracleAppliance, - IWitnetOracleEvents, - IWitnetRandomness, - IWitnetRandomnessEvents -{} diff --git a/contracts/WitnetRequest.sol b/contracts/WitnetRequest.sol deleted file mode 100644 index aa1c666f..00000000 --- a/contracts/WitnetRequest.sol +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.7.0 <0.9.0; -pragma experimental ABIEncoderV2; - -import "./interfaces/IWitnetOracleAppliance.sol"; -import "./interfaces/IWitnetRequest.sol"; - -abstract contract WitnetRequest - is - IWitnetOracleAppliance, - IWitnetRequest -{} diff --git a/contracts/WitnetRequestFactory.sol b/contracts/WitnetRequestFactory.sol deleted file mode 100644 index 86951895..00000000 --- a/contracts/WitnetRequestFactory.sol +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.7.0 <0.9.0; -pragma experimental ABIEncoderV2; - -import "./interfaces/IWitnetOracleAppliance.sol"; -import "./interfaces/IWitnetRadonRegistryEvents.sol"; -import "./interfaces/IWitnetRequestFactory.sol"; -import "./interfaces/IWitnetRequestFactoryEvents.sol"; - -abstract contract WitnetRequestFactory - is - IWitnetOracleAppliance, - IWitnetRadonRegistryEvents, - IWitnetRequestFactory, - IWitnetRequestFactoryEvents -{} diff --git a/contracts/WitnetRequestTemplate.sol b/contracts/WitnetRequestTemplate.sol deleted file mode 100644 index 74a08beb..00000000 --- a/contracts/WitnetRequestTemplate.sol +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.7.0 <0.9.0; -pragma experimental ABIEncoderV2; - -import "./interfaces/IWitnetOracleAppliance.sol"; -import "./interfaces/IWitnetRadonRegistryEvents.sol"; -import "./interfaces/IWitnetRequestFactoryEvents.sol"; -import "./interfaces/IWitnetRequestTemplate.sol"; - -abstract contract WitnetRequestTemplate - is - IWitnetOracleAppliance, - IWitnetRadonRegistryEvents, - IWitnetRequestFactoryEvents, - IWitnetRequestTemplate -{} diff --git a/contracts/apps/WitPriceFeedsV21.sol b/contracts/apps/WitPriceFeedsV21.sol index 5e3690a7..a6025725 100644 --- a/contracts/apps/WitPriceFeedsV21.sol +++ b/contracts/apps/WitPriceFeedsV21.sol @@ -3,47 +3,47 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../WitnetPriceFeeds.sol"; +import "../WitPriceFeeds.sol"; import "../core/WitnetUpgradableBase.sol"; -import "../data/WitnetPriceFeedsData.sol"; -import "../interfaces/IWitnetFeedsAdmin.sol"; -import "../interfaces/IWitnetFeedsLegacy.sol"; -import "../interfaces/IWitnetPriceFeedsSolverDeployer.sol"; -import "../interfaces/IWitnetOracleLegacy.sol"; -import "../libs/WitnetPriceFeedsLib.sol"; +import "../data/WitPriceFeedsData.sol"; +import "../interfaces/IWitFeedsAdmin.sol"; +import "../interfaces/IWitFeedsLegacy.sol"; +import "../interfaces/IWitPriceFeedsSolverFactory.sol"; +import "../interfaces/IWitOracleLegacy.sol"; +import "../libs/WitPriceFeedsLib.sol"; import "../patterns/Ownable2Step.sol"; -/// @title WitnetPriceFeeds: Price Feeds live repository reliant on the Witnet Oracle blockchain. +/// @title WitPriceFeeds: Price Feeds live repository reliant on the Witnet Oracle blockchain. /// @author Guillermo Dรญaz contract WitPriceFeedsV21 is Ownable2Step, - WitnetPriceFeeds, - WitnetPriceFeedsData, + WitPriceFeeds, + WitPriceFeedsData, WitnetUpgradableBase, - IWitnetFeedsAdmin, - IWitnetFeedsLegacy, - IWitnetPriceFeedsSolverDeployer + IWitFeedsAdmin, + IWitFeedsLegacy, + IWitPriceFeedsSolverFactory { using Witnet for bytes; using Witnet for Witnet.Result; using Witnet for Witnet.Response; using Witnet for Witnet.RadonSLA; - function class() virtual override(IWitnetAppliance, WitnetUpgradableBase) public view returns (string memory) { + function class() virtual override(IWitAppliance, WitnetUpgradableBase) public view returns (string memory) { return type(WitPriceFeedsV21).name; } - bytes4 immutable public override specs = type(WitnetPriceFeeds).interfaceId; - WitnetOracle immutable public override witnet; - WitnetRadonRegistry immutable internal __registry; + bytes4 immutable public override specs = type(WitPriceFeeds).interfaceId; + WitOracle immutable public override witnet; + WitOracleRadonRegistry immutable internal __registry; Witnet.RadonSLA private __defaultRadonSLA; uint16 private __baseFeeOverheadPercentage; constructor( - WitnetOracle _wrb, + WitOracle _wrb, bool _upgradable, bytes32 _versionTag ) @@ -57,14 +57,14 @@ contract WitPriceFeedsV21 witnet = _wrb; } - function _registry() virtual internal view returns (WitnetRadonRegistry) { + function _registry() virtual internal view returns (WitOracleRadonRegistry) { return witnet.registry(); } // solhint-disable-next-line payable-fallback fallback() override external { if ( - msg.sig == IWitnetPriceFeedsSolver.solve.selector + msg.sig == IWitPriceFeedsSolver.solve.selector && msg.sender == address(this) ) { address _solver = __records_(bytes4(bytes8(msg.data) << 32)).solver; @@ -131,7 +131,7 @@ contract WitPriceFeedsV21 "inexistent oracle" ); _require( - witnet.specs() == type(WitnetOracle).interfaceId, + witnet.specs() == type(WitOracle).interfaceId, "uncompliant oracle" ); emit Upgraded(_owner, base(), codehash(), version()); @@ -218,7 +218,7 @@ contract WitPriceFeedsV21 // ================================================================================================================ - // --- Implements 'IWitnetFeeds' ---------------------------------------------------------------------------------- + // --- Implements 'IWitFeeds' ---------------------------------------------------------------------------------- function defaultRadonSLA() override @@ -233,7 +233,7 @@ contract WitPriceFeedsV21 public view returns (uint) { - return (IWitnetOracleLegacy(address(witnet)).estimateBaseFee(_evmGasPrice, 32) + return (IWitOracleLegacy(address(witnet)).estimateBaseFee(_evmGasPrice, 32) * (100 + __baseFeeOverheadPercentage) ) / 100; } @@ -335,7 +335,7 @@ contract WitPriceFeedsV21 return __requestUpdate(feedId, updateSLA); } - function requestUpdate(bytes4 feedId, IWitnetFeedsLegacy.RadonSLA memory updateSLA) + function requestUpdate(bytes4 feedId, IWitFeedsLegacy.RadonSLA memory updateSLA) external payable virtual override returns (uint256) @@ -352,10 +352,10 @@ contract WitPriceFeedsV21 // ================================================================================================================ - // --- Implements 'IWitnetFeedsAdmin' ----------------------------------------------------------------------------- + // --- Implements 'IWitFeedsAdmin' ----------------------------------------------------------------------------- function owner() - virtual override (IWitnetFeedsAdmin, Ownable) + virtual override (IWitFeedsAdmin, Ownable) public view returns (address) { @@ -363,7 +363,7 @@ contract WitPriceFeedsV21 } function acceptOwnership() - virtual override (IWitnetFeedsAdmin, Ownable2Step) + virtual override (IWitFeedsAdmin, Ownable2Step) public { Ownable2Step.acceptOwnership(); @@ -378,7 +378,7 @@ contract WitPriceFeedsV21 } function pendingOwner() - virtual override (IWitnetFeedsAdmin, Ownable2Step) + virtual override (IWitFeedsAdmin, Ownable2Step) public view returns (address) { @@ -386,7 +386,7 @@ contract WitPriceFeedsV21 } function transferOwnership(address _newOwner) - virtual override (IWitnetFeedsAdmin, Ownable2Step) + virtual override (IWitFeedsAdmin, Ownable2Step) public onlyOwner { @@ -468,7 +468,7 @@ contract WitPriceFeedsV21 emit WitnetFeedSettled(feedId, radHash); } - function settleFeedRequest(string calldata caption, WitnetRequest request) + function settleFeedRequest(string calldata caption, WitOracleRequest request) override external onlyOwner { @@ -477,7 +477,7 @@ contract WitPriceFeedsV21 function settleFeedRequest( string calldata caption, - WitnetRequestTemplate template, + WitOracleRequestTemplate template, string[][] calldata args ) override external @@ -516,7 +516,7 @@ contract WitPriceFeedsV21 { // solhint-disable-next-line avoid-low-level-calls (bool _success, bytes memory _reason) = solver.delegatecall(abi.encodeWithSelector( - IWitnetPriceFeedsSolver.validate.selector, + IWitPriceFeedsSolver.validate.selector, feedId, deps )); @@ -534,7 +534,7 @@ contract WitPriceFeedsV21 { // solhint-disable-next-line avoid-low-level-calls (bool _success, bytes memory _reason) = address(this).staticcall(abi.encodeWithSelector( - IWitnetPriceFeedsSolver.solve.selector, + IWitPriceFeedsSolver.solve.selector, feedId )); if (!_success) { @@ -552,7 +552,7 @@ contract WitPriceFeedsV21 // ================================================================================================================ - // --- Implements 'IWitnetPriceFeeds' ----------------------------------------------------------------------------- + // --- Implements 'IWitPriceFeeds' ----------------------------------------------------------------------------- function lookupDecimals(bytes4 feedId) override @@ -565,9 +565,9 @@ contract WitPriceFeedsV21 function lookupPriceSolver(bytes4 feedId) override external view - returns (IWitnetPriceFeedsSolver _solverAddress, string[] memory _solverDeps) + returns (IWitPriceFeedsSolver _solverAddress, string[] memory _solverDeps) { - _solverAddress = IWitnetPriceFeedsSolver(__records_(feedId).solver); + _solverAddress = IWitPriceFeedsSolver(__records_(feedId).solver); bytes4[] memory _deps = _depsOf(feedId); _solverDeps = new string[](_deps.length); for (uint _ix = 0; _ix < _deps.length; _ix ++) { @@ -578,13 +578,13 @@ contract WitPriceFeedsV21 function latestPrice(bytes4 feedId) virtual override public view - returns (IWitnetPriceFeedsSolver.Price memory) + returns (IWitPriceFeedsSolver.Price memory) { uint _queryId = _lastValidQueryId(feedId); if (_queryId > 0) { Witnet.Response memory _lastValidResponse = lastValidResponse(feedId); Witnet.Result memory _latestResult = _lastValidResponse.resultCborBytes.toWitnetResult(); - return IWitnetPriceFeedsSolver.Price({ + return IWitPriceFeedsSolver.Price({ value: _latestResult.asUint(), timestamp: _lastValidResponse.resultTimestamp, tallyHash: _lastValidResponse.resultTallyHash, @@ -595,7 +595,7 @@ contract WitPriceFeedsV21 if (_solver != address(0)) { // solhint-disable-next-line avoid-low-level-calls (bool _success, bytes memory _result) = address(this).staticcall(abi.encodeWithSelector( - IWitnetPriceFeedsSolver.solve.selector, + IWitPriceFeedsSolver.solve.selector, feedId )); if (!_success) { @@ -603,14 +603,14 @@ contract WitPriceFeedsV21 _result := add(_result, 4) } revert(string(abi.encodePacked( - "WitnetPriceFeeds: ", + "WitPriceFeeds: ", string(abi.decode(_result, (string))) ))); } else { - return abi.decode(_result, (IWitnetPriceFeedsSolver.Price)); + return abi.decode(_result, (IWitPriceFeedsSolver.Price)); } } else { - return IWitnetPriceFeedsSolver.Price({ + return IWitPriceFeedsSolver.Price({ value: 0, timestamp: 0, tallyHash: 0, @@ -623,9 +623,9 @@ contract WitPriceFeedsV21 function latestPrices(bytes4[] calldata feedIds) virtual override external view - returns (IWitnetPriceFeedsSolver.Price[] memory _prices) + returns (IWitPriceFeedsSolver.Price[] memory _prices) { - _prices = new IWitnetPriceFeedsSolver.Price[](feedIds.length); + _prices = new IWitPriceFeedsSolver.Price[](feedIds.length); for (uint _ix = 0; _ix < feedIds.length; _ix ++) { _prices[_ix] = latestPrice(feedIds[_ix]); } @@ -633,7 +633,7 @@ contract WitPriceFeedsV21 // ================================================================================================================ - // --- Implements 'IWitnetPriceFeedsSolverDeployer' --------------------------------------------------------------------- + // --- Implements 'IWitPriceFeedsSolverFactory' --------------------------------------------------------------------- function deployPriceSolver(bytes calldata initcode, bytes calldata constructorParams) virtual override @@ -641,7 +641,7 @@ contract WitPriceFeedsV21 onlyOwner returns (address _solver) { - _solver = WitnetPriceFeedsLib.deployPriceSolver(initcode, constructorParams); + _solver = WitPriceFeedsLib.deployPriceSolver(initcode, constructorParams); emit NewPriceFeedsSolver( _solver, _solver.codehash, @@ -654,7 +654,7 @@ contract WitPriceFeedsV21 public view returns (address _address) { - return WitnetPriceFeedsLib.determinePriceSolverAddress(initcode, constructorParams); + return WitPriceFeedsLib.determinePriceSolverAddress(initcode, constructorParams); } @@ -666,7 +666,7 @@ contract WitPriceFeedsV21 external view returns (int256 _value, uint256 _timestamp, uint256 _status) { - IWitnetPriceFeedsSolver.Price memory _latestPrice = latestPrice(bytes4(feedId)); + IWitPriceFeedsSolver.Price memory _latestPrice = latestPrice(bytes4(feedId)); return ( int(_latestPrice.value), _latestPrice.timestamp, @@ -720,7 +720,7 @@ contract WitPriceFeedsV21 function _validateCaption(string calldata caption) internal view returns (uint8) { - try WitnetPriceFeedsLib.validateCaption(__prefix, caption) returns (uint8 _decimals) { + try WitPriceFeedsLib.validateCaption(__prefix, caption) returns (uint8 _decimals) { return _decimals; } catch Error(string memory reason) { _revert(reason); diff --git a/contracts/apps/WitRandomnessV21.sol b/contracts/apps/WitRandomnessV21.sol index 60737eeb..0d29defb 100644 --- a/contracts/apps/WitRandomnessV21.sol +++ b/contracts/apps/WitRandomnessV21.sol @@ -2,9 +2,9 @@ pragma solidity >=0.8.0 <0.9.0; -import "../WitnetRandomness.sol"; -import "../interfaces/IWitnetRandomnessAdmin.sol"; -import "../mocks/UsingWitnet.sol"; +import "../WitRandomness.sol"; +import "../interfaces/IWitRandomnessAdmin.sol"; +import "../mocks/UsingWitOracle.sol"; import "../patterns/Ownable2Step.sol"; /// @title WitRandomnessV21: Unmalleable and provably-fair randomness generation based on the Witnet Oracle v2.*. @@ -12,9 +12,9 @@ import "../patterns/Ownable2Step.sol"; contract WitRandomnessV21 is Ownable2Step, - UsingWitnet, - WitnetRandomness, - IWitnetRandomnessAdmin + UsingWitOracle, + WitRandomness, + IWitRandomnessAdmin { using Witnet for bytes; using Witnet for Witnet.Result; @@ -36,19 +36,19 @@ contract WitRandomnessV21 bytes32 immutable public override witnetRadHash; constructor( - WitnetOracle _witnet, + WitOracle _witnet, address _operator ) Ownable(_operator) - UsingWitnet(_witnet) + UsingWitOracle(_witnet) { _require( address(_witnet) == address(0) - || _witnet.specs() == type(WitnetOracle).interfaceId, + || _witnet.specs() == type(WitOracle).interfaceId, "uncompliant oracle" ); // Build Witnet-compliant randomness request: - WitnetRadonRegistry _registry = witnet().registry(); + WitOracleRadonRegistry _registry = witnet().registry(); witnetRadHash = _registry.verifyRadonRequest( abi.decode( abi.encode([ @@ -92,18 +92,18 @@ contract WitRandomnessV21 } function specs() virtual override external pure returns (bytes4) { - return type(WitnetRandomness).interfaceId; + return type(WitRandomness).interfaceId; } - function witnet() override (IWitnetOracleAppliance, UsingWitnet) - public view returns (WitnetOracle) + function witnet() override (IWitOracleAppliance, UsingWitOracle) + public view returns (WitOracle) { - return UsingWitnet.witnet(); + return UsingWitOracle.witnet(); } /// =============================================================================================================== - /// --- 'IWitnetRandomness' implementation ------------------------------------------------------------------------ + /// --- 'IWitRandomness' implementation ------------------------------------------------------------------------ /// Returns amount of wei required to be paid as a fee when requesting randomization with a /// transaction gas price as the one given. @@ -400,10 +400,10 @@ contract WitRandomnessV21 /// =============================================================================================================== - /// --- 'IWitnetRandomnessAdmin' implementation ------------------------------------------------------------------- + /// --- 'IWitRandomnessAdmin' implementation ------------------------------------------------------------------- function acceptOwnership() - virtual override (IWitnetRandomnessAdmin, Ownable2Step) + virtual override (IWitRandomnessAdmin, Ownable2Step) public { Ownable2Step.acceptOwnership(); @@ -418,7 +418,7 @@ contract WitRandomnessV21 } function owner() - virtual override (IWitnetRandomnessAdmin, Ownable) + virtual override (IWitRandomnessAdmin, Ownable) public view returns (address) { @@ -426,7 +426,7 @@ contract WitRandomnessV21 } function pendingOwner() - virtual override (IWitnetRandomnessAdmin, Ownable2Step) + virtual override (IWitRandomnessAdmin, Ownable2Step) public view returns (address) { @@ -434,7 +434,7 @@ contract WitRandomnessV21 } function transferOwnership(address _newOwner) - virtual override (IWitnetRandomnessAdmin, Ownable2Step) + virtual override (IWitRandomnessAdmin, Ownable2Step) public onlyOwner { diff --git a/contracts/core/trustless/WitnetDeployerCfxCore.sol b/contracts/core/WitnetDeployerCfxCore.sol similarity index 99% rename from contracts/core/trustless/WitnetDeployerCfxCore.sol rename to contracts/core/WitnetDeployerCfxCore.sol index 26b5c99e..d5cf870a 100644 --- a/contracts/core/trustless/WitnetDeployerCfxCore.sol +++ b/contracts/core/WitnetDeployerCfxCore.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.0 <0.9.0; -import "../WitnetProxy.sol"; +import "./WitnetProxy.sol"; /// @notice WitnetDeployer contract used both as CREATE2 factory (EIP-1014) for Witnet artifacts, /// @notice and CREATE3 factory (EIP-3171) for Witnet proxies, on the Conflux Core Ecosystem. diff --git a/contracts/core/trustless/WitnetDeployerMeter.sol b/contracts/core/WitnetDeployerMeter.sol similarity index 99% rename from contracts/core/trustless/WitnetDeployerMeter.sol rename to contracts/core/WitnetDeployerMeter.sol index 8322464a..e60620a6 100644 --- a/contracts/core/trustless/WitnetDeployerMeter.sol +++ b/contracts/core/WitnetDeployerMeter.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.0 <0.9.0; -import "../WitnetProxy.sol"; +import "./WitnetProxy.sol"; /// @notice WitnetDeployer contract used both as CREATE2 factory (EIP-1014) for Witnet artifacts, /// @notice and CREATE3 factory (EIP-3171) for Witnet proxies, on the Meter Ecosystem. diff --git a/contracts/core/trustable/WitnetOracleTrustableBase.sol b/contracts/core/trustable/WitOracleTrustableBase.sol similarity index 88% rename from contracts/core/trustable/WitnetOracleTrustableBase.sol rename to contracts/core/trustable/WitOracleTrustableBase.sol index 9eeae2d3..4ab5ca90 100644 --- a/contracts/core/trustable/WitnetOracleTrustableBase.sol +++ b/contracts/core/trustable/WitOracleTrustableBase.sol @@ -4,13 +4,13 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "../WitnetUpgradableBase.sol"; -import "../../WitnetOracle.sol"; -import "../../data/WitnetOracleDataLib.sol"; -import "../..//interfaces/IWitnetOracleLegacy.sol"; -import "../../interfaces/IWitnetOracleReporter.sol"; -import "../../interfaces/IWitnetRequestBoardAdminACLs.sol"; -import "../../interfaces/IWitnetConsumer.sol"; -import "../../libs/WitnetErrorsLib.sol"; +import "../../WitOracle.sol"; +import "../../data/WitOracleDataLib.sol"; +import "../..//interfaces/IWitOracleLegacy.sol"; +import "../../interfaces/IWitOracleReporter.sol"; +import "../../interfaces/IWitOracleAdminACLs.sol"; +import "../../interfaces/IWitOracleConsumer.sol"; +import "../../libs/WitOracleResultErrorsLib.sol"; import "../../patterns/Payable.sol"; /// @title Witnet Request Board "trustable" base implementation contract. @@ -18,14 +18,14 @@ import "../../patterns/Payable.sol"; /// @dev This contract enables posting requests that Witnet bridges will insert into the Witnet network. /// The result of the requests will be posted back to this contract by the bridge nodes too. /// @author The Witnet Foundation -abstract contract WitnetOracleTrustableBase +abstract contract WitOracleTrustableBase is Payable, - WitnetOracle, + WitOracle, WitnetUpgradableBase, - IWitnetOracleLegacy, - IWitnetOracleReporter, - IWitnetRequestBoardAdminACLs + IWitOracleLegacy, + IWitOracleReporter, + IWitOracleAdminACLs { using Witnet for bytes; using Witnet for Witnet.RadonSLA; @@ -34,10 +34,10 @@ abstract contract WitnetOracleTrustableBase using Witnet for Witnet.Result; using WitnetCBOR for WitnetCBOR.CBOR; - WitnetRequestFactory public immutable override factory; - WitnetRadonRegistry public immutable override registry; + WitOracleRequestFactory public immutable override factory; + WitOracleRadonRegistry public immutable override registry; - bytes4 public immutable override specs = type(WitnetOracle).interfaceId; + bytes4 public immutable override specs = type(WitOracle).interfaceId; function channel() virtual override public view returns (bytes4) { return bytes4(keccak256(abi.encode(address(this), block.chainid))); @@ -45,15 +45,15 @@ abstract contract WitnetOracleTrustableBase function class() public view - virtual override(IWitnetAppliance, WitnetUpgradableBase) + virtual override(IWitAppliance, WitnetUpgradableBase) returns (string memory) { - return type(WitnetOracleTrustableBase).name; + return type(WitOracleTrustableBase).name; } modifier checkCallbackRecipient(address _addr, uint24 _callbackGasLimit) { _require( - _addr.code.length > 0 && IWitnetConsumer(_addr).reportableFrom(address(this)) && _callbackGasLimit > 0, + _addr.code.length > 0 && IWitOracleConsumer(_addr).reportableFrom(address(this)) && _callbackGasLimit > 0, "invalid callback" ); _; } @@ -79,8 +79,8 @@ abstract contract WitnetOracleTrustableBase /// Asserts the given query is currently in the given status. modifier inStatus(uint256 _queryId, Witnet.QueryStatus _status) { - if (WitnetOracleDataLib.seekQueryStatus(_queryId) != _status) { - _revert(WitnetOracleDataLib.notInStatusRevertMessage(_status)); + if (WitOracleDataLib.seekQueryStatus(_queryId) != _status) { + _revert(WitOracleDataLib.notInStatusRevertMessage(_status)); } else { _; } @@ -89,7 +89,7 @@ abstract contract WitnetOracleTrustableBase /// Asserts the caller actually posted the referred query. modifier onlyRequester(uint256 _queryId) { _require( - msg.sender == WitnetOracleDataLib.seekQueryRequest(_queryId).requester, + msg.sender == WitOracleDataLib.seekQueryRequest(_queryId).requester, "not the requester" ); _; } @@ -104,8 +104,8 @@ abstract contract WitnetOracleTrustableBase } constructor( - WitnetRadonRegistry _registry, - WitnetRequestFactory _factory, + WitOracleRadonRegistry _registry, + WitOracleRequestFactory _factory, bool _upgradable, bytes32 _versionTag, address _currency @@ -127,7 +127,7 @@ abstract contract WitnetOracleTrustableBase } /// @dev Provide backwards compatibility for dapps bound to versions <= 0.6.1 - /// @dev (i.e. calling methods in IWitnetOracle) + /// @dev (i.e. calling methods in IWitOracle) /// @dev (Until 'function ... abi(...)' modifier is allegedly supported in solc versions >= 0.9.1) /* solhint-disable payable-fallback */ /* solhint-disable no-complex-fallback */ @@ -203,7 +203,7 @@ abstract contract WitnetOracleTrustableBase __proxiable().codehash = codehash(); _require(address(registry).code.length > 0, "inexistent registry"); - _require(registry.specs() == type(WitnetRadonRegistry).interfaceId, "uncompliant registry"); + _require(registry.specs() == type(WitOracleRadonRegistry).interfaceId, "uncompliant registry"); _require(address(factory).code.length > 0, "inexistent factory"); _require(address(factory.witnet()) == address(this), "discordant factory"); @@ -224,7 +224,7 @@ abstract contract WitnetOracleTrustableBase // ================================================================================================================ - // --- Partial implementation of IWitnetOracle -------------------------------------------------------------- + // --- Partial implementation of IWitOracle -------------------------------------------------------------- /// Retrieves copy of all response data related to a previously posted request, removing the whole query from storage. /// @dev Fails if the `_witnetQueryId` is not in 'Reported' status, or called from an address different to @@ -237,7 +237,7 @@ abstract contract WitnetOracleTrustableBase onlyRequester(_witnetQueryId) returns (Witnet.Response memory _response) { - _response = WitnetOracleDataLib.seekQuery(_witnetQueryId).response; + _response = WitOracleDataLib.seekQuery(_witnetQueryId).response; delete __storage().queries[_witnetQueryId]; } @@ -266,7 +266,7 @@ abstract contract WitnetOracleTrustableBase override returns (Witnet.Request memory) { - return WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); + return WitOracleDataLib.seekQueryRequest(_witnetQueryId); } /// Retrieves the Witnet-provable result, and metadata, to a previously posted request. @@ -277,7 +277,7 @@ abstract contract WitnetOracleTrustableBase virtual override returns (Witnet.Response memory) { - return WitnetOracleDataLib.seekQueryResponse(_witnetQueryId); + return WitOracleDataLib.seekQueryResponse(_witnetQueryId); } /// @notice Returns query's result current status from a requester's point of view: @@ -290,7 +290,7 @@ abstract contract WitnetOracleTrustableBase virtual override public view returns (Witnet.ResponseStatus) { - return WitnetOracleDataLib.seekQueryResponseStatus(_witnetQueryId); + return WitOracleDataLib.seekQueryResponseStatus(_witnetQueryId); } /// @notice Retrieves the CBOR-encoded buffer containing the Witnet-provided result to the given query. @@ -300,7 +300,7 @@ abstract contract WitnetOracleTrustableBase virtual override returns (bytes memory) { - return WitnetOracleDataLib.seekQueryResponse(_witnetQueryId).resultCborBytes; + return WitOracleDataLib.seekQueryResponse(_witnetQueryId).resultCborBytes; } /// @notice Gets error code identifying some possible failure on the resolution of the given query. @@ -310,8 +310,8 @@ abstract contract WitnetOracleTrustableBase public view returns (Witnet.ResultError memory) { - Witnet.ResponseStatus _status = WitnetOracleDataLib.seekQueryResponseStatus(_witnetQueryId); - try WitnetErrorsLib.asResultError(_status, WitnetOracleDataLib.seekQueryResponse(_witnetQueryId).resultCborBytes) + Witnet.ResponseStatus _status = WitOracleDataLib.seekQueryResponseStatus(_witnetQueryId); + try WitOracleResultErrorsLib.asResultError(_status, WitOracleDataLib.seekQueryResponse(_witnetQueryId).resultCborBytes) returns (Witnet.ResultError memory _resultError) { return _resultError; @@ -319,13 +319,13 @@ abstract contract WitnetOracleTrustableBase catch Error(string memory _reason) { return Witnet.ResultError({ code: Witnet.ResultErrorCodes.Unknown, - reason: string(abi.encodePacked("WitnetErrorsLib: ", _reason)) + reason: string(abi.encodePacked("WitOracleResultErrorsLib: ", _reason)) }); } catch (bytes memory) { return Witnet.ResultError({ code: Witnet.ResultErrorCodes.Unknown, - reason: "WitnetErrorsLib: assertion failed" + reason: "WitOracleResultErrorsLib: assertion failed" }); } } @@ -336,7 +336,7 @@ abstract contract WitnetOracleTrustableBase override returns (Witnet.QueryStatus) { - return WitnetOracleDataLib.seekQueryStatus(_witnetQueryId); + return WitOracleDataLib.seekQueryStatus(_witnetQueryId); } function getQueryStatusBatch(uint256[] calldata _witnetQueryIds) @@ -346,7 +346,7 @@ abstract contract WitnetOracleTrustableBase { _status = new Witnet.QueryStatus[](_witnetQueryIds.length); for (uint _ix = 0; _ix < _witnetQueryIds.length; _ix ++) { - _status[_ix] = WitnetOracleDataLib.seekQueryStatus(_witnetQueryIds[_ix]); + _status[_ix] = WitOracleDataLib.seekQueryStatus(_witnetQueryIds[_ix]); } } @@ -363,7 +363,7 @@ abstract contract WitnetOracleTrustableBase /// @notice solved by the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be /// @notice transferred to the reporter who relays back the Witnet-provable result to this request. /// @dev Reasons to fail: - /// @dev - the RAD hash was not previously verified by the WitnetRadonRegistry registry; + /// @dev - the RAD hash was not previously verified by the WitOracleRadonRegistry registry; /// @dev - invalid SLA parameters were provided; /// @dev - insufficient value is paid as reward. /// @param _queryRAD The RAD hash of the data request to be solved by Witnet. @@ -397,8 +397,8 @@ abstract contract WitnetOracleTrustableBase /// @notice directly to the requesting contract. If the report callback fails for any reason, an `WitnetQueryResponseDeliveryFailed` /// @notice will be triggered, and the Witnet audit trail will be saved in storage, but not so the actual CBOR-encoded result. /// @dev Reasons to fail: - /// @dev - the caller is not a contract implementing the IWitnetConsumer interface; - /// @dev - the RAD hash was not previously verified by the WitnetRadonRegistry registry; + /// @dev - the caller is not a contract implementing the IWitOracleConsumer interface; + /// @dev - the RAD hash was not previously verified by the WitOracleRadonRegistry registry; /// @dev - invalid SLA parameters were provided; /// @dev - zero callback gas limit is provided; /// @dev - insufficient value is paid as reward. @@ -439,7 +439,7 @@ abstract contract WitnetOracleTrustableBase /// @notice directly to the requesting contract. If the report callback fails for any reason, a `WitnetQueryResponseDeliveryFailed` /// @notice event will be triggered, and the Witnet audit trail will be saved in storage, but not so the CBOR-encoded result. /// @dev Reasons to fail: - /// @dev - the caller is not a contract implementing the IWitnetConsumer interface; + /// @dev - the caller is not a contract implementing the IWitOracleConsumer interface; /// @dev - the provided bytecode is empty; /// @dev - invalid SLA parameters were provided; /// @dev - zero callback gas limit is provided; @@ -465,7 +465,7 @@ abstract contract WitnetOracleTrustableBase _querySLA, _queryCallbackGasLimit ); - WitnetOracleDataLib.seekQueryRequest(_queryId).witnetBytecode = _queryUnverifiedBytecode; + WitOracleDataLib.seekQueryRequest(_queryId).witnetBytecode = _queryUnverifiedBytecode; emit WitnetQuery( _msgSender(), _getGasPrice(), @@ -484,7 +484,7 @@ abstract contract WitnetOracleTrustableBase virtual override inStatus(_witnetQueryId, Witnet.QueryStatus.Posted) { - Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); + Witnet.Request storage __request = WitOracleDataLib.seekQueryRequest(_witnetQueryId); __request.evmReward += uint72(_getMsgValue()); emit WitnetQueryUpgrade( _witnetQueryId, @@ -496,7 +496,7 @@ abstract contract WitnetOracleTrustableBase /// =============================================================================================================== - /// --- IWitnetOracleLegacy --------------------------------------------------------------------------------------- + /// --- IWitOracleLegacy --------------------------------------------------------------------------------------- /// @notice Estimate the minimum reward required for posting a data request. /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. @@ -508,7 +508,7 @@ abstract contract WitnetOracleTrustableBase /// @notice Estimate the minimum reward required for posting a data request. /// @dev Underestimates if the size of returned data is greater than `resultMaxSize`. /// @param gasPrice Expected gas price to pay upon posting the data request. - /// @param radHash The hash of some Witnet Data Request previously posted in the WitnetRadonRegistry registry. + /// @param radHash The hash of some Witnet Data Request previously posted in the WitOracleRadonRegistry registry. function estimateBaseFee(uint256 gasPrice, bytes32 radHash) public view virtual override @@ -523,7 +523,7 @@ abstract contract WitnetOracleTrustableBase function postRequest( bytes32 _queryRadHash, - IWitnetOracleLegacy.RadonSLA calldata _querySLA + IWitOracleLegacy.RadonSLA calldata _querySLA ) virtual override external payable @@ -541,7 +541,7 @@ abstract contract WitnetOracleTrustableBase function postRequestWithCallback( bytes32 _queryRadHash, - IWitnetOracleLegacy.RadonSLA calldata _querySLA, + IWitOracleLegacy.RadonSLA calldata _querySLA, uint24 _queryCallbackGas ) virtual override @@ -561,7 +561,7 @@ abstract contract WitnetOracleTrustableBase function postRequestWithCallback( bytes calldata _queryRadBytecode, - IWitnetOracleLegacy.RadonSLA calldata _querySLA, + IWitOracleLegacy.RadonSLA calldata _querySLA, uint24 _queryCallbackGas ) virtual override @@ -581,7 +581,7 @@ abstract contract WitnetOracleTrustableBase // ================================================================================================================ - // --- Full implementation of IWitnetOracleReporter --------------------------------------------------------- + // --- Full implementation of IWitOracleReporter --------------------------------------------------------- /// @notice Estimates the actual earnings (or loss), in WEI, that a reporter would get by reporting result to given query, /// @notice based on the gas price of the calling transaction. Data requesters should consider upgrading the reward on @@ -598,9 +598,9 @@ abstract contract WitnetOracleTrustableBase { for (uint _ix = 0; _ix < _queryIds.length; _ix ++) { if ( - WitnetOracleDataLib.seekQueryStatus(_queryIds[_ix]) == Witnet.QueryStatus.Posted + WitOracleDataLib.seekQueryStatus(_queryIds[_ix]) == Witnet.QueryStatus.Posted ) { - Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_queryIds[_ix]); + Witnet.Request storage __request = WitOracleDataLib.seekQueryRequest(_queryIds[_ix]); if (__request.gasCallback > 0) { _expenses += ( estimateBaseFeeWithCallback(_evmGasPrice, __request.gasCallback) @@ -638,7 +638,7 @@ abstract contract WitnetOracleTrustableBase virtual override returns (bytes[] memory _bytecodes) { - return WitnetOracleDataLib.extractWitnetDataRequests(registry, _queryIds); + return WitOracleDataLib.extractWitnetDataRequests(registry, _queryIds); } /// Reports the Witnet-provable result to a previously posted request. @@ -725,19 +725,19 @@ abstract contract WitnetOracleTrustableBase /// - timestamp of the solving tally txs in Witnet. If zero is provided, EVM-timestamp will be used instead; /// - hash of the corresponding data request tx at the Witnet side-chain level; /// - data request result in raw bytes. - function reportResultBatch(IWitnetOracleReporter.BatchResult[] calldata _batchResults) + function reportResultBatch(IWitOracleReporter.BatchResult[] calldata _batchResults) external override onlyReporters returns (uint256 _batchReward) { for ( uint _i = 0; _i < _batchResults.length; _i ++) { if ( - WitnetOracleDataLib.seekQueryStatus(_batchResults[_i].queryId) + WitOracleDataLib.seekQueryStatus(_batchResults[_i].queryId) != Witnet.QueryStatus.Posted ) { emit BatchReportError( _batchResults[_i].queryId, - WitnetOracleDataLib.notInStatusRevertMessage(Witnet.QueryStatus.Posted) + WitOracleDataLib.notInStatusRevertMessage(Witnet.QueryStatus.Posted) ); } else if ( uint256(_batchResults[_i].queryResultTimestamp) > block.timestamp @@ -771,12 +771,12 @@ abstract contract WitnetOracleTrustableBase // ================================================================================================================ - // --- Full implementation of 'IWitnetRequestBoardAdminACLs' ------------------------------------------------------ + // --- Full implementation of 'IWitOracleAdminACLs' ------------------------------------------------------ /// Tells whether given address is included in the active reporters control list. /// @param _reporter The address to be checked. function isReporter(address _reporter) public view override returns (bool) { - return WitnetOracleDataLib.isReporter(_reporter); + return WitOracleDataLib.isReporter(_reporter); } /// Adds given addresses to the active reporters control list. @@ -833,7 +833,7 @@ abstract contract WitnetOracleTrustableBase returns (uint256 _witnetQueryId) { _witnetQueryId = ++ __storage().nonce; //__newQueryId(_radHash, _packedSLA); - Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); + Witnet.Request storage __request = WitOracleDataLib.seekQueryRequest(_witnetQueryId); _require(__request.requester == address(0), "already posted"); { __request.requester = msg.sender; @@ -854,7 +854,7 @@ abstract contract WitnetOracleTrustableBase returns (uint256 _evmReward) { // read requester address and whether a callback was requested: - Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_witnetQueryId); + Witnet.Request storage __request = WitOracleDataLib.seekQueryRequest(_witnetQueryId); // read query EVM reward: _evmReward = __request.evmReward; @@ -891,7 +891,7 @@ abstract contract WitnetOracleTrustableBase _evmCallbackActualGas, bytes(_evmCallbackRevertMessage).length > 0 ? _evmCallbackRevertMessage - : "WitnetOracle: callback exceeded gas limit", + : "WitOracle: callback exceeded gas limit", _witnetQueryResultCborBytes ); } @@ -961,7 +961,7 @@ abstract contract WitnetOracleTrustableBase WitnetCBOR.CBOR[] memory _errors = WitnetCBOR.fromBytes(_witnetQueryResultCborBytes).readArray(); if (_errors.length < 2) { // try to report result with unknown error: - try IWitnetConsumer(_evmRequester).reportWitnetQueryError{gas: _evmCallbackGasLimit}( + try IWitOracleConsumer(_evmRequester).reportWitnetQueryError{gas: _evmCallbackGasLimit}( _witnetQueryId, _witnetQueryResultTimestamp, _witnetQueryResultTallyHash, @@ -982,7 +982,7 @@ abstract contract WitnetOracleTrustableBase } } else { // try to report result with parsable error: - try IWitnetConsumer(_evmRequester).reportWitnetQueryError{gas: _evmCallbackGasLimit}( + try IWitOracleConsumer(_evmRequester).reportWitnetQueryError{gas: _evmCallbackGasLimit}( _witnetQueryId, _witnetQueryResultTimestamp, _witnetQueryResultTallyHash, @@ -997,7 +997,7 @@ abstract contract WitnetOracleTrustableBase } } else { // try to report result result with no error : - try IWitnetConsumer(_evmRequester).reportWitnetQueryResult{gas: _evmCallbackGasLimit}( + try IWitOracleConsumer(_evmRequester).reportWitnetQueryResult{gas: _evmCallbackGasLimit}( _witnetQueryId, _witnetQueryResultTimestamp, _witnetQueryResultTallyHash, @@ -1023,8 +1023,8 @@ abstract contract WitnetOracleTrustableBase } /// Returns storage pointer to contents of 'WitnetBoardState' struct. - function __storage() virtual internal pure returns (WitnetOracleDataLib.Storage storage _ptr) { - return WitnetOracleDataLib.data(); + function __storage() virtual internal pure returns (WitOracleDataLib.Storage storage _ptr) { + return WitOracleDataLib.data(); } function __writeQueryResponse( @@ -1035,7 +1035,7 @@ abstract contract WitnetOracleTrustableBase ) virtual internal { - WitnetOracleDataLib.seekQuery(_witnetQueryId).response = Witnet.Response({ + WitOracleDataLib.seekQuery(_witnetQueryId).response = Witnet.Response({ reporter: msg.sender, finality: uint64(block.number), resultTimestamp: _witnetQueryResultTimestamp, diff --git a/contracts/core/trustable/WitnetOracleTrustableDefault.sol b/contracts/core/trustable/WitOracleTrustableDefault.sol similarity index 92% rename from contracts/core/trustable/WitnetOracleTrustableDefault.sol rename to contracts/core/trustable/WitOracleTrustableDefault.sol index daa3578d..1b328c47 100644 --- a/contracts/core/trustable/WitnetOracleTrustableDefault.sol +++ b/contracts/core/trustable/WitOracleTrustableDefault.sol @@ -5,21 +5,21 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetOracleTrustableBase.sol"; +import "./WitOracleTrustableBase.sol"; /// @title Witnet Request Board "trustable" implementation contract. /// @notice Contract to bridge requests to Witnet Decentralized Oracle Network. /// @dev This contract enables posting requests that Witnet bridges will insert into the Witnet network. /// The result of the requests will be posted back to this contract by the bridge nodes too. /// @author The Witnet Foundation -contract WitnetOracleTrustableDefault +contract WitOracleTrustableDefault is - WitnetOracleTrustableBase + WitOracleTrustableBase { using Witnet for Witnet.RadonSLA; function class() virtual override public view returns (string memory) { - return type(WitnetOracleTrustableDefault).name; + return type(WitOracleTrustableDefault).name; } uint256 internal immutable __reportResultGasBase; @@ -28,8 +28,8 @@ contract WitnetOracleTrustableDefault uint256 internal immutable __sstoreFromZeroGas; constructor( - WitnetRadonRegistry _registry, - WitnetRequestFactory _factory, + WitOracleRadonRegistry _registry, + WitOracleRequestFactory _factory, bool _upgradable, bytes32 _versionTag, uint256 _reportResultGasBase, @@ -37,7 +37,7 @@ contract WitnetOracleTrustableDefault uint256 _reportResultWithCallbackRevertGasBase, uint256 _sstoreFromZeroGas ) - WitnetOracleTrustableBase( + WitOracleTrustableBase( _registry, _factory, _upgradable, @@ -53,7 +53,7 @@ contract WitnetOracleTrustableDefault // ================================================================================================================ - // --- Overrides 'IWitnetOracle' ---------------------------------------------------------------------------- + // --- Overrides 'IWitOracle' ---------------------------------------------------------------------------- /// @notice Estimate the minimum reward required for posting a data request. /// @param _gasPrice Expected gas price to pay upon posting the data request. @@ -126,7 +126,7 @@ contract WitnetOracleTrustableDefault /// =============================================================================================================== - /// --- IWitnetOracleLegacy --------------------------------------------------------------------------------------- + /// --- IWitOracleLegacy --------------------------------------------------------------------------------------- /// @notice Estimate the minimum reward required for posting a data request. /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. diff --git a/contracts/core/trustable/WitnetOracleTrustableObscuro.sol b/contracts/core/trustable/WitOracleTrustableObscuro.sol similarity index 80% rename from contracts/core/trustable/WitnetOracleTrustableObscuro.sol rename to contracts/core/trustable/WitOracleTrustableObscuro.sol index e0834b59..72437a7b 100644 --- a/contracts/core/trustable/WitnetOracleTrustableObscuro.sol +++ b/contracts/core/trustable/WitOracleTrustableObscuro.sol @@ -5,24 +5,24 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetOracleTrustableDefault.sol"; +import "./WitOracleTrustableDefault.sol"; /// @title Witnet Request Board "trustable" implementation contract. /// @notice Contract to bridge requests to Witnet Decentralized Oracle Network. /// @dev This contract enables posting requests that Witnet bridges will insert into the Witnet network. /// The result of the requests will be posted back to this contract by the bridge nodes too. /// @author The Witnet Foundation -contract WitnetOracleTrustableObscuro +contract WitOracleTrustableObscuro is - WitnetOracleTrustableDefault + WitOracleTrustableDefault { function class() virtual override public view returns (string memory) { - return type(WitnetOracleTrustableObscuro).name; + return type(WitOracleTrustableObscuro).name; } constructor( - WitnetRadonRegistry _registry, - WitnetRequestFactory _factory, + WitOracleRadonRegistry _registry, + WitOracleRequestFactory _factory, bool _upgradable, bytes32 _versionTag, uint256 _reportResultGasBase, @@ -30,7 +30,7 @@ contract WitnetOracleTrustableObscuro uint256 _reportResultWithCallbackRevertGasBase, uint256 _sstoreFromZeroGas ) - WitnetOracleTrustableDefault( + WitOracleTrustableDefault( _registry, _factory, _upgradable, @@ -44,7 +44,7 @@ contract WitnetOracleTrustableObscuro // ================================================================================================================ - // --- Overrides implementation of 'IWitnetOracleView' ------------------------------------------------------ + // --- Overrides implementation of 'IWitOracleView' ------------------------------------------------------ /// @notice Gets the whole Query data contents, if any, no matter its current status. /// @dev Fails if or if `msg.sender` is not the actual requester. @@ -54,7 +54,7 @@ contract WitnetOracleTrustableObscuro onlyRequester(_queryId) returns (Witnet.Query memory) { - return WitnetOracleTrustableBase.getQuery(_queryId); + return WitOracleTrustableBase.getQuery(_queryId); } /// @notice Retrieves the whole `Witnet.Response` record referred to a previously posted Witnet Data Request. @@ -66,7 +66,7 @@ contract WitnetOracleTrustableObscuro onlyRequester(_queryId) returns (Witnet.Response memory _response) { - return WitnetOracleTrustableBase.getQueryResponse(_queryId); + return WitOracleTrustableBase.getQueryResponse(_queryId); } /// @notice Gets error code identifying some possible failure on the resolution of the given query. @@ -77,7 +77,7 @@ contract WitnetOracleTrustableObscuro onlyRequester(_queryId) returns (Witnet.ResultError memory) { - return WitnetOracleTrustableBase.getQueryResultError(_queryId); + return WitOracleTrustableBase.getQueryResultError(_queryId); } } diff --git a/contracts/core/trustable/WitnetOracleTrustableOvm2.sol b/contracts/core/trustable/WitOracleTrustableOvm2.sol similarity index 82% rename from contracts/core/trustable/WitnetOracleTrustableOvm2.sol rename to contracts/core/trustable/WitOracleTrustableOvm2.sol index 5201e614..37489441 100644 --- a/contracts/core/trustable/WitnetOracleTrustableOvm2.sol +++ b/contracts/core/trustable/WitOracleTrustableOvm2.sol @@ -5,7 +5,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetOracleTrustableDefault.sol"; +import "./WitOracleTrustableDefault.sol"; // solhint-disable-next-line interface OVM_GasPriceOracle { @@ -17,19 +17,19 @@ interface OVM_GasPriceOracle { /// @dev This contract enables posting requests that Witnet bridges will insert into the Witnet network. /// The result of the requests will be posted back to this contract by the bridge nodes too. /// @author The Witnet Foundation -contract WitnetOracleTrustableOvm2 +contract WitOracleTrustableOvm2 is - WitnetOracleTrustableDefault + WitOracleTrustableDefault { using Witnet for Witnet.RadonSLA; function class() virtual override public view returns (string memory) { - return type(WitnetOracleTrustableOvm2).name; + return type(WitOracleTrustableOvm2).name; } constructor( - WitnetRadonRegistry _registry, - WitnetRequestFactory _factory, + WitOracleRadonRegistry _registry, + WitOracleRequestFactory _factory, bool _upgradable, bytes32 _versionTag, uint256 _reportResultGasBase, @@ -37,7 +37,7 @@ contract WitnetOracleTrustableOvm2 uint256 _reportResultWithCallbackRevertGasBase, uint256 _sstoreFromZeroGas ) - WitnetOracleTrustableDefault( + WitOracleTrustableDefault( _registry, _factory, _upgradable, @@ -76,7 +76,7 @@ contract WitnetOracleTrustableOvm2 } // ================================================================================================================ - // --- Overrides 'IWitnetOracle' ---------------------------------------------------------------------------- + // --- Overrides 'IWitOracle' ---------------------------------------------------------------------------- /// @notice Estimate the minimum reward required for posting a data request. /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. @@ -87,7 +87,7 @@ contract WitnetOracleTrustableOvm2 virtual override returns (uint256) { - return _getCurrentL1Fee(_resultMaxSize) + WitnetOracleTrustableDefault.estimateBaseFee(_gasPrice, _resultMaxSize); + return _getCurrentL1Fee(_resultMaxSize) + WitOracleTrustableDefault.estimateBaseFee(_gasPrice, _resultMaxSize); } /// @notice Estimate the minimum reward required for posting a data request with a callback. @@ -98,7 +98,7 @@ contract WitnetOracleTrustableOvm2 virtual override returns (uint256) { - return _getCurrentL1Fee(32) + WitnetOracleTrustableDefault.estimateBaseFeeWithCallback(_gasPrice, _callbackGasLimit); + return _getCurrentL1Fee(32) + WitOracleTrustableDefault.estimateBaseFeeWithCallback(_gasPrice, _callbackGasLimit); } /// @notice Estimate the extra reward (i.e. over the base fee) to be paid when posting a new @@ -119,7 +119,7 @@ contract WitnetOracleTrustableOvm2 { return ( _getCurrentL1Fee(_querySLA.maxTallyResultSize) - + WitnetOracleTrustableDefault.estimateExtraFee( + + WitOracleTrustableDefault.estimateExtraFee( _evmGasPrice, _evmWitPrice, _querySLA @@ -128,7 +128,7 @@ contract WitnetOracleTrustableOvm2 } // ================================================================================================================ - // --- Overrides 'IWitnetOracleReporter' -------------------------------------------------------------------------- + // --- Overrides 'IWitOracleReporter' -------------------------------------------------------------------------- /// @notice Estimates the actual earnings (or loss), in WEI, that a reporter would get by reporting result to given query, /// @notice based on the gas price of the calling transaction. Data requesters should consider upgrading the reward on @@ -145,13 +145,13 @@ contract WitnetOracleTrustableOvm2 { for (uint _ix = 0; _ix < _queryIds.length; _ix ++) { if ( - WitnetOracleDataLib.seekQueryStatus(_queryIds[_ix]) == Witnet.QueryStatus.Posted + WitOracleDataLib.seekQueryStatus(_queryIds[_ix]) == Witnet.QueryStatus.Posted ) { - Witnet.Request storage __request = WitnetOracleDataLib.seekQueryRequest(_queryIds[_ix]); + Witnet.Request storage __request = WitOracleDataLib.seekQueryRequest(_queryIds[_ix]); if (__request.gasCallback > 0) { _expenses += ( - WitnetOracleTrustableDefault.estimateBaseFeeWithCallback(_evmGasPrice, __request.gasCallback) - + WitnetOracleTrustableDefault.estimateExtraFee( + WitOracleTrustableDefault.estimateBaseFeeWithCallback(_evmGasPrice, __request.gasCallback) + + WitOracleTrustableDefault.estimateExtraFee( _evmGasPrice, _evmWitPrice, Witnet.RadonSLA({ @@ -163,8 +163,8 @@ contract WitnetOracleTrustableOvm2 ); } else { _expenses += ( - WitnetOracleTrustableDefault.estimateBaseFee(_evmGasPrice) - + WitnetOracleTrustableDefault.estimateExtraFee( + WitOracleTrustableDefault.estimateBaseFee(_evmGasPrice) + + WitOracleTrustableDefault.estimateExtraFee( _evmGasPrice, _evmWitPrice, __request.witnetSLA diff --git a/contracts/core/trustable/WitnetOracleTrustableReef.sol b/contracts/core/trustable/WitOracleTrustableReef.sol similarity index 81% rename from contracts/core/trustable/WitnetOracleTrustableReef.sol rename to contracts/core/trustable/WitOracleTrustableReef.sol index 0285fc73..f6067b04 100644 --- a/contracts/core/trustable/WitnetOracleTrustableReef.sol +++ b/contracts/core/trustable/WitOracleTrustableReef.sol @@ -6,24 +6,24 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; // Inherits from: -import "./WitnetOracleTrustableDefault.sol"; +import "./WitOracleTrustableDefault.sol"; /// @title Witnet Request Board OVM-compatible (Optimism) "trustable" implementation. /// @notice Contract to bridge requests to Witnet Decentralized Oracle Network. /// @dev This contract enables posting requests that Witnet bridges will insert into the Witnet network. /// The result of the requests will be posted back to this contract by the bridge nodes too. /// @author The Witnet Foundation -contract WitnetOracleTrustableReef +contract WitOracleTrustableReef is - WitnetOracleTrustableDefault + WitOracleTrustableDefault { function class() virtual override public view returns (string memory) { - return type(WitnetOracleTrustableReef).name; + return type(WitOracleTrustableReef).name; } constructor( - WitnetRadonRegistry _registry, - WitnetRequestFactory _factory, + WitOracleRadonRegistry _registry, + WitOracleRequestFactory _factory, bool _upgradable, bytes32 _versionTag, uint256 _reportResultGasBase, @@ -31,7 +31,7 @@ contract WitnetOracleTrustableReef uint256 _reportResultWithCallbackRevertGasBase, uint256 _sstoreFromZeroGas ) - WitnetOracleTrustableDefault( + WitOracleTrustableDefault( _registry, _factory, _upgradable, @@ -44,7 +44,7 @@ contract WitnetOracleTrustableReef {} // ================================================================================================================ - // --- Overrides 'IWitnetOracle' ---------------------------------------------------------------------------- + // --- Overrides 'IWitOracle' ---------------------------------------------------------------------------- /// @notice Estimate the minimum reward required for posting a data request. /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. @@ -54,7 +54,7 @@ contract WitnetOracleTrustableReef virtual override returns (uint256) { - return WitnetOracleTrustableDefault.estimateBaseFee(1, _resultMaxSize); + return WitOracleTrustableDefault.estimateBaseFee(1, _resultMaxSize); } /// @notice Estimate the minimum reward required for posting a data request with a callback. @@ -64,7 +64,7 @@ contract WitnetOracleTrustableReef virtual override returns (uint256) { - return WitnetOracleTrustableDefault.estimateBaseFeeWithCallback(1, _callbackGasLimit); + return WitOracleTrustableDefault.estimateBaseFeeWithCallback(1, _callbackGasLimit); } diff --git a/contracts/core/trustless/WitnetRadonRegistryDefault.sol b/contracts/core/trustless/WitOracleRadonRegistryDefault.sol similarity index 92% rename from contracts/core/trustless/WitnetRadonRegistryDefault.sol rename to contracts/core/trustless/WitOracleRadonRegistryDefault.sol index 069ee2bc..08028f2f 100644 --- a/contracts/core/trustless/WitnetRadonRegistryDefault.sol +++ b/contracts/core/trustless/WitOracleRadonRegistryDefault.sol @@ -3,39 +3,39 @@ pragma solidity >=0.8.4 <0.9.0; import "../WitnetUpgradableBase.sol"; -import "../../WitnetRadonRegistry.sol"; -import "../../data/WitnetRadonRegistryData.sol"; -import "../../interfaces/IWitnetRadonRegistryLegacy.sol"; -import "../../libs/WitnetEncodingLib.sol"; +import "../../WitOracleRadonRegistry.sol"; +import "../../data/WitOracleRadonRegistryData.sol"; +import "../../interfaces/IWitOracleRadonRegistryLegacy.sol"; +import "../../libs/WitOracleRadonEncodingLib.sol"; /// @title Witnet Request Board EVM-default implementation contract. /// @notice Contract to bridge requests to Witnet Decentralized Oracle Network. /// @dev This contract enables posting requests that Witnet bridges will insert into the Witnet network. /// The result of the requests will be posted back to this contract by the bridge nodes too. /// @author The Witnet Foundation -contract WitnetRadonRegistryDefault +contract WitOracleRadonRegistryDefault is - WitnetRadonRegistry, - WitnetRadonRegistryData, + WitOracleRadonRegistry, + WitOracleRadonRegistryData, WitnetUpgradableBase, - IWitnetRadonRegistryLegacy + IWitOracleRadonRegistryLegacy { using Witnet for bytes; using Witnet for string; using Witnet for Witnet.RadonSLA; - using WitnetEncodingLib for Witnet.RadonDataTypes; - using WitnetEncodingLib for Witnet.RadonReducer; - using WitnetEncodingLib for Witnet.RadonRetrieval; - using WitnetEncodingLib for Witnet.RadonRetrieval[]; - using WitnetEncodingLib for Witnet.RadonRetrievalMethods; - using WitnetEncodingLib for Witnet.RadonSLAv1; + using WitOracleRadonEncodingLib for Witnet.RadonDataTypes; + using WitOracleRadonEncodingLib for Witnet.RadonReducer; + using WitOracleRadonEncodingLib for Witnet.RadonRetrieval; + using WitOracleRadonEncodingLib for Witnet.RadonRetrieval[]; + using WitOracleRadonEncodingLib for Witnet.RadonRetrievalMethods; + using WitOracleRadonEncodingLib for Witnet.RadonSLAv1; - function class() public view virtual override(IWitnetAppliance, WitnetUpgradableBase) returns (string memory) { - return type(WitnetRadonRegistryDefault).name; + function class() public view virtual override(IWitAppliance, WitnetUpgradableBase) returns (string memory) { + return type(WitOracleRadonRegistryDefault).name; } - bytes4 public immutable override specs = type(WitnetRadonRegistry).interfaceId; + bytes4 public immutable override specs = type(WitOracleRadonRegistry).interfaceId; modifier radonRequestExists(bytes32 _radHash) { _require( @@ -161,7 +161,7 @@ contract WitnetRadonRegistryDefault // ================================================================================================================ - // --- Implementation of 'IWitnetRadonRegistry' ----------------------------------------------------------------------- + // --- Implementation of 'IWitOracleRadonRegistry' ----------------------------------------------------------------------- function bytecodeOf(bytes32 _radHash) public view @@ -177,7 +177,7 @@ contract WitnetRadonRegistryDefault { bytes memory _radBytecode = bytecodeOf(_radHash); return abi.encodePacked( - WitnetEncodingLib.encode(uint64(_radBytecode.length), 0x0a), + WitOracleRadonEncodingLib.encode(uint64(_radBytecode.length), 0x0a), _radBytecode, _sla.toV1().encode() ); @@ -188,7 +188,7 @@ contract WitnetRadonRegistryDefault returns (bytes memory) { return abi.encodePacked( - WitnetEncodingLib.encode(uint64(_radBytecode.length), 0x0a), + WitOracleRadonEncodingLib.encode(uint64(_radBytecode.length), 0x0a), _radBytecode, _sla.toV1().encode() ); @@ -380,7 +380,7 @@ contract WitnetRadonRegistryDefault _requestMethod, dataType: - WitnetEncodingLib.verifyRadonScriptResultDataType(_requestRadonScript), + WitOracleRadonEncodingLib.verifyRadonScriptResultDataType(_requestRadonScript), url: _requestURL, @@ -400,7 +400,7 @@ contract WitnetRadonRegistryDefault // ================================================================================================================ - // --- IWitnetRadonRegistryLegacy --------------------------------------------------------------------------------- + // --- IWitOracleRadonRegistryLegacy --------------------------------------------------------------------------------- function lookupRadonRequestResultMaxSize(bytes32) override external pure returns (uint16) { return 32; diff --git a/contracts/core/trustless/WitnetRadonRegistryNoSha256.sol b/contracts/core/trustless/WitOracleRadonRegistryNoSha256.sol similarity index 61% rename from contracts/core/trustless/WitnetRadonRegistryNoSha256.sol rename to contracts/core/trustless/WitOracleRadonRegistryNoSha256.sol index a509d33c..82a36e56 100644 --- a/contracts/core/trustless/WitnetRadonRegistryNoSha256.sol +++ b/contracts/core/trustless/WitOracleRadonRegistryNoSha256.sol @@ -3,18 +3,18 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetRadonRegistryDefault.sol"; +import "./WitOracleRadonRegistryDefault.sol"; -contract WitnetRadonRegistryNoSha256 +contract WitOracleRadonRegistryNoSha256 is - WitnetRadonRegistryDefault + WitOracleRadonRegistryDefault { function class() virtual override public view returns (string memory) { - return type(WitnetRadonRegistryNoSha256).name; + return type(WitOracleRadonRegistryNoSha256).name; } constructor(bool _upgradable, bytes32 _versionTag) - WitnetRadonRegistryDefault(_upgradable, _versionTag) + WitOracleRadonRegistryDefault(_upgradable, _versionTag) {} function _witnetHash(bytes memory chunk) virtual override internal pure returns (bytes32) { diff --git a/contracts/core/trustless/WitnetRequestFactoryCfxCore.sol b/contracts/core/trustless/WitOracleRequestFactoryCfxCore.sol similarity index 70% rename from contracts/core/trustless/WitnetRequestFactoryCfxCore.sol rename to contracts/core/trustless/WitOracleRequestFactoryCfxCore.sol index d90bca51..f3408d61 100644 --- a/contracts/core/trustless/WitnetRequestFactoryCfxCore.sol +++ b/contracts/core/trustless/WitOracleRequestFactoryCfxCore.sol @@ -3,18 +3,18 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetRequestFactoryDefault.sol"; +import "./WitOracleRequestFactoryDefault.sol"; -contract WitnetRequestFactoryCfxCore +contract WitOracleRequestFactoryCfxCore is - WitnetRequestFactoryDefault + WitOracleRequestFactoryDefault { constructor( - WitnetOracle _witnet, + WitOracle _witnet, bool _upgradable, bytes32 _versionTag ) - WitnetRequestFactoryDefault(_witnet, _upgradable, _versionTag) + WitOracleRequestFactoryDefault(_witnet, _upgradable, _versionTag) {} function _cloneDeterministic(bytes32 _salt) diff --git a/contracts/core/trustless/WitnetRequestFactoryDefault.sol b/contracts/core/trustless/WitOracleRequestFactoryDefault.sol similarity index 79% rename from contracts/core/trustless/WitnetRequestFactoryDefault.sol rename to contracts/core/trustless/WitOracleRequestFactoryDefault.sol index a1076dac..2361d61c 100644 --- a/contracts/core/trustless/WitnetRequestFactoryDefault.sol +++ b/contracts/core/trustless/WitOracleRequestFactoryDefault.sol @@ -4,23 +4,23 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "../WitnetUpgradableBase.sol"; -import "../../WitnetRadonRegistry.sol"; -import "../../WitnetRequestFactory.sol"; -import "../../data/WitnetRequestFactoryData.sol"; -import "../../interfaces/IWitnetRadonRegistryLegacy.sol"; +import "../../WitOracleRadonRegistry.sol"; +import "../../WitOracleRequestFactory.sol"; +import "../../data/WitOracleRequestFactoryData.sol"; +import "../../interfaces/IWitOracleRadonRegistryLegacy.sol"; import "../../patterns/Clonable.sol"; -contract WitnetRequestFactoryDefault +contract WitOracleRequestFactoryDefault is Clonable, - WitnetRequest, - WitnetRequestFactory, - WitnetRequestFactoryData, - WitnetRequestTemplate, + WitOracleRequest, + WitOracleRequestFactory, + WitOracleRequestFactoryData, + WitOracleRequestTemplate, WitnetUpgradableBase { /// @notice Reference to the Witnet Request Board that all templates built out from this factory will refer to. - WitnetOracle immutable public override witnet; + WitOracle immutable public override witnet; modifier notOnFactory { _require( @@ -60,7 +60,7 @@ contract WitnetRequestFactoryDefault } constructor( - WitnetOracle _witnet, + WitOracle _witnet, bool _upgradable, bytes32 _versionTag ) @@ -78,11 +78,11 @@ contract WitnetRequestFactoryDefault __witnetRequestFactory().owner = address(0); } - function _getWitnetRadonRegistry() virtual internal view returns (WitnetRadonRegistry) { + function _getWitOracleRadonRegistry() virtual internal view returns (WitOracleRadonRegistry) { return witnet.registry(); } - function initializeWitnetRequest(bytes32 _radHash) + function initializeWitOracleRequest(bytes32 _radHash) virtual public initializer returns (address) { @@ -91,7 +91,7 @@ contract WitnetRequestFactoryDefault return address(this); } - function initializeWitnetRequestTemplate( + function initializeWitOracleRequestTemplate( bytes32[] calldata _retrieveHashes, bytes16 _aggregateReduceHash, bytes16 _tallyReduceHash @@ -103,7 +103,7 @@ contract WitnetRequestFactoryDefault _require(_aggregateReduceHash != bytes16(0), "no aggregate reducer?"); _require(_tallyReduceHash != bytes16(0), "no tally reducer?"); - WitnetRequestTemplateStorage storage __data = __witnetRequestTemplate(); + WitOracleRequestTemplateStorage storage __data = __witnetRequestTemplate(); __data.retrieveHashes = _retrieveHashes; __data.aggregateReduceHash = _aggregateReduceHash; __data.tallyReduceHash = _tallyReduceHash; @@ -191,7 +191,7 @@ contract WitnetRequestFactoryDefault __proxiable().implementation = base(); _require(address(witnet).code.length > 0, "inexistent request board"); - _require(witnet.specs() == type(WitnetOracle).interfaceId, "uncompliant request board"); + _require(witnet.specs() == type(WitOracle).interfaceId, "uncompliant request board"); emit Upgraded(msg.sender, base(), codehash(), version()); } @@ -212,7 +212,7 @@ contract WitnetRequestFactoryDefault // ================================================================================================================ /// --- Clonable implementation and override ---------------------------------------------------------------------- - /// @notice Tells whether a WitnetRequest or a WitnetRequestTemplate has been properly initialized. + /// @notice Tells whether a WitOracleRequest or a WitOracleRequestTemplate has been properly initialized. function initialized() virtual override(Clonable) public view @@ -239,19 +239,19 @@ contract WitnetRequestFactoryDefault /// =============================================================================================================== - /// --- IWitnetRequestFactory, IWitnetRequestTemplate, IWitnetRequest polymorphic methods ------------------------- + /// --- IWitOracleRequestFactory, IWitOracleRequestTemplate, IWitOracleRequest polymorphic methods ------------------------- function class() - virtual override(IWitnetAppliance, WitnetUpgradableBase) + virtual override(IWitAppliance, WitnetUpgradableBase) public view returns (string memory) { if (__witnetRequest().radHash != bytes32(0)) { - return type(WitnetRequest).name; + return type(WitOracleRequest).name; } else if (__witnetRequestTemplate().tallyReduceHash != bytes16(0)) { - return type(WitnetRequestTemplate).name; + return type(WitOracleRequestTemplate).name; } else { - return type(WitnetRequestFactory).name; + return type(WitOracleRequestFactory).name; } } @@ -261,25 +261,25 @@ contract WitnetRequestFactoryDefault returns (bytes4) { if (__witnetRequest().radHash != bytes32(0)) { - return type(WitnetRequest).interfaceId; + return type(WitOracleRequest).interfaceId; } else if (__witnetRequestTemplate().tallyReduceHash != bytes16(0)) { - return type(WitnetRequestTemplate).interfaceId; + return type(WitOracleRequestTemplate).interfaceId; } else { - return type(WitnetRequestFactory).interfaceId; + return type(WitOracleRequestFactory).interfaceId; } } /// =============================================================================================================== - /// --- IWitnetRequestTemplate, IWitnetRequest polymorphic methods ------------------------------------------------ + /// --- IWitOracleRequestTemplate, IWitOracleRequest polymorphic methods ------------------------------------------------ function getRadonReducers() - virtual override (IWitnetRequest, IWitnetRequestTemplate) + virtual override (IWitOracleRequest, IWitOracleRequestTemplate) external view notOnFactory returns (Witnet.RadonReducer memory, Witnet.RadonReducer memory) { - WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); + WitOracleRadonRegistry _registry = _getWitOracleRadonRegistry(); if (__witnetRequest().radHash != bytes32(0)) { return ( _registry.lookupRadonRequestAggregator(__witnetRequest().radHash), @@ -294,13 +294,13 @@ contract WitnetRequestFactoryDefault } function getRadonRetrievalByIndex(uint256 _index) - virtual override (IWitnetRequest, IWitnetRequestTemplate) + virtual override (IWitOracleRequest, IWitOracleRequestTemplate) external view notOnFactory returns (Witnet.RadonRetrieval memory) { if (__witnetRequest().radHash != bytes32(0)) { - return _getWitnetRadonRegistry().lookupRadonRequestRetrievalByIndex( + return _getWitOracleRadonRegistry().lookupRadonRequestRetrievalByIndex( __witnetRequest().radHash, _index ); @@ -309,19 +309,19 @@ contract WitnetRequestFactoryDefault _index < __witnetRequestTemplate().retrieveHashes.length, "index out of range" ); - return _getWitnetRadonRegistry().lookupRadonRetrieval( + return _getWitOracleRadonRegistry().lookupRadonRetrieval( __witnetRequestTemplate().retrieveHashes[_index] ); } } function getRadonRetrievals() - virtual override (IWitnetRequest, IWitnetRequestTemplate) + virtual override (IWitOracleRequest, IWitOracleRequestTemplate) external view notOnFactory returns (Witnet.RadonRetrieval[] memory _retrievals) { - WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); + WitOracleRadonRegistry _registry = _getWitOracleRadonRegistry(); if (__witnetRequest().radHash != bytes32(0)) { return _registry.lookupRadonRequestRetrievals( __witnetRequest().radHash @@ -337,24 +337,24 @@ contract WitnetRequestFactoryDefault } function getResultDataType() - virtual override (IWitnetRequest, IWitnetRequestTemplate) + virtual override (IWitOracleRequest, IWitOracleRequestTemplate) external view notOnFactory returns (Witnet.RadonDataTypes) { if (__witnetRequest().radHash != bytes32(0)) { - return _getWitnetRadonRegistry().lookupRadonRequestResultDataType( + return _getWitOracleRadonRegistry().lookupRadonRequestResultDataType( __witnetRequest().radHash ); } else { - return _getWitnetRadonRegistry().lookupRadonRetrievalResultDataType( + return _getWitOracleRadonRegistry().lookupRadonRetrievalResultDataType( __witnetRequestTemplate().retrieveHashes[0] ); } } function version() - virtual override(IWitnetRequest, IWitnetRequestTemplate, WitnetUpgradableBase) + virtual override(IWitOracleRequest, IWitOracleRequestTemplate, WitnetUpgradableBase) public view returns (string memory) { @@ -363,9 +363,9 @@ contract WitnetRequestFactoryDefault /// =============================================================================================================== - /// --- IWitnetRequestFactory implementation ---------------------------------------------------------------------- + /// --- IWitOracleRequestFactory implementation ---------------------------------------------------------------------- - function buildWitnetRequest( + function buildWitOracleRequest( bytes32[] calldata _retrieveHashes, Witnet.RadonReducer calldata _aggregate, Witnet.RadonReducer calldata _tally @@ -374,7 +374,7 @@ contract WitnetRequestFactoryDefault onlyOnFactory returns (address) { - WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); + WitOracleRadonRegistry _registry = _getWitOracleRadonRegistry(); // TODO: checks and reducers verification should be done by the registry instead ... @@ -389,7 +389,7 @@ contract WitnetRequestFactoryDefault bytes16 _tallyReduceHash = _registry.verifyRadonReducer(_tally); // Verify Radon Request: - bytes32 _radHash = IWitnetRadonRegistryLegacy(address(_registry)).verifyRadonRequest( + bytes32 _radHash = IWitOracleRadonRegistryLegacy(address(_registry)).verifyRadonRequest( _retrieveHashes, bytes32(_aggregateReduceHash), bytes32(_tallyReduceHash), @@ -398,22 +398,22 @@ contract WitnetRequestFactoryDefault ); // Determine request's minimal-proxy counter-factual salt and address: - (address _requestAddr, bytes32 _requestSalt) = _determineWitnetRequestAddressAndSalt(_radHash); + (address _requestAddr, bytes32 _requestSalt) = _determineWitOracleRequestAddressAndSalt(_radHash); // Create and initialize counter-factual request just once: if (_requestAddr.code.length == 0) { - _requestAddr = WitnetRequestFactoryDefault(_cloneDeterministic(_requestSalt)) - .initializeWitnetRequest( + _requestAddr = WitOracleRequestFactoryDefault(_cloneDeterministic(_requestSalt)) + .initializeWitOracleRequest( _radHash ); } // Emit event even when building same request more than once - emit WitnetRequestBuilt(_requestAddr); + emit WitOracleRequestBuilt(_requestAddr); return _requestAddr; } - function buildWitnetRequestTemplate( + function buildWitOracleRequestTemplate( bytes32[] calldata _retrieveHashes, Witnet.RadonReducer calldata _aggregate, Witnet.RadonReducer calldata _tally @@ -422,7 +422,7 @@ contract WitnetRequestFactoryDefault onlyOnFactory returns (address) { - WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); + WitOracleRadonRegistry _registry = _getWitOracleRadonRegistry(); // Check input retrievals: _require( @@ -435,7 +435,7 @@ contract WitnetRequestFactoryDefault bytes16 _tallyReduceHash = _registry.verifyRadonReducer(_tally); // Determine template's minimal-proxy counter-factual salt and address: - (address _templateAddr, bytes32 _templateSalt) = _determineWitnetRequestTemplateAddressAndSalt( + (address _templateAddr, bytes32 _templateSalt) = _determineWitOracleRequestTemplateAddressAndSalt( _retrieveHashes, _aggregateReduceHash, _tallyReduceHash @@ -444,8 +444,8 @@ contract WitnetRequestFactoryDefault // Create and initialize counter-factual template just once: if (_templateAddr.code.length == 0) { _templateAddr = address( - WitnetRequestFactoryDefault(_cloneDeterministic(_templateSalt)) - .initializeWitnetRequestTemplate( + WitOracleRequestFactoryDefault(_cloneDeterministic(_templateSalt)) + .initializeWitOracleRequestTemplate( _retrieveHashes, _aggregateReduceHash, _tallyReduceHash @@ -454,7 +454,7 @@ contract WitnetRequestFactoryDefault } // Emit event even when building same template more than one - emit WitnetRequestTemplateBuilt(_templateAddr); + emit WitOracleRequestTemplateBuilt(_templateAddr); return _templateAddr; } @@ -469,7 +469,7 @@ contract WitnetRequestFactoryDefault onlyOnFactory returns (bytes32 _retrievalHash) { - return _getWitnetRadonRegistry().verifyRadonRetrieval( + return _getWitOracleRadonRegistry().verifyRadonRetrieval( _requestMethod, _requestURL, _requestBody, @@ -480,19 +480,19 @@ contract WitnetRequestFactoryDefault /// =============================================================================================================== - /// --- IWitnetRequestTemplate implementation --------------------------------------------------------------------- + /// --- IWitOracleRequestTemplate implementation --------------------------------------------------------------------- - function buildWitnetRequest(string[][] calldata _retrieveArgs) + function buildWitOracleRequest(string[][] calldata _retrieveArgs) override external onlyOnTemplates returns (address _request) { - WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); - WitnetRequestTemplateStorage storage __template = __witnetRequestTemplate(); + WitOracleRadonRegistry _registry = _getWitOracleRadonRegistry(); + WitOracleRequestTemplateStorage storage __template = __witnetRequestTemplate(); // Verify Radon Request using template's retrieve hashes, aggregate and tally reducers, // and given args: - bytes32 _radHash = IWitnetRadonRegistryLegacy(address(_registry)).verifyRadonRequest( + bytes32 _radHash = IWitOracleRadonRegistryLegacy(address(_registry)).verifyRadonRequest( __template.retrieveHashes, bytes32(__template.aggregateReduceHash), bytes32(__template.tallyReduceHash), @@ -501,18 +501,18 @@ contract WitnetRequestFactoryDefault ); // Determine request's minimal-proxy counter-factual salt and address: - (address _requestAddr, bytes32 _requestSalt) = _determineWitnetRequestAddressAndSalt(_radHash); + (address _requestAddr, bytes32 _requestSalt) = _determineWitOracleRequestAddressAndSalt(_radHash); // Create and initialize counter-factual request just once: if (_requestAddr.code.length == 0) { - _requestAddr = WitnetRequestFactoryDefault(_cloneDeterministic(_requestSalt)) - .initializeWitnetRequest( + _requestAddr = WitOracleRequestFactoryDefault(_cloneDeterministic(_requestSalt)) + .initializeWitOracleRequest( _radHash ); } // Emit event even when building same request more than once - emit WitnetRequestBuilt(_requestAddr); + emit WitOracleRequestBuilt(_requestAddr); return _requestAddr; } @@ -522,7 +522,7 @@ contract WitnetRequestFactoryDefault returns (uint256[] memory _argsCount) { - WitnetRadonRegistry _registry = _getWitnetRadonRegistry(); + WitOracleRadonRegistry _registry = _getWitOracleRadonRegistry(); _argsCount = new uint256[](__witnetRequestTemplate().retrieveHashes.length); for (uint _ix = 0; _ix < _argsCount.length; _ix ++) { _argsCount[_ix] = _registry.lookupRadonRetrievalArgsCount( @@ -536,7 +536,7 @@ contract WitnetRequestFactoryDefault onlyOnTemplates returns (bytes32) { - return IWitnetRadonRegistryLegacy(address(_getWitnetRadonRegistry())).verifyRadonRequest( + return IWitOracleRadonRegistryLegacy(address(_getWitOracleRadonRegistry())).verifyRadonRequest( __witnetRequestTemplate().retrieveHashes, bytes32(__witnetRequestTemplate().aggregateReduceHash), bytes32(__witnetRequestTemplate().tallyReduceHash), @@ -546,14 +546,14 @@ contract WitnetRequestFactoryDefault } /// =============================================================================================================== - /// --- IWitnetRequest implementation ----------------------------------------------------------------------------- + /// --- IWitOracleRequest implementation ----------------------------------------------------------------------------- function bytecode() override external view onlyOnRequests returns (bytes memory) { - return _getWitnetRadonRegistry().bytecodeOf( + return _getWitOracleRadonRegistry().bytecodeOf( __witnetRequest().radHash ); } @@ -570,7 +570,7 @@ contract WitnetRequestFactoryDefault /// =============================================================================================================== /// --- Internal methods ------------------------------------------------------------------------------------------ - function _checkParameterizedRadonRetrievals(WitnetRadonRegistry _registry, bytes32[] calldata _retrieveHashes) + function _checkParameterizedRadonRetrievals(WitOracleRadonRegistry _registry, bytes32[] calldata _retrieveHashes) internal view returns (bool _parameterized) { Witnet.RadonDataTypes _resultDataType; @@ -590,7 +590,7 @@ contract WitnetRequestFactoryDefault } } - function _determineWitnetRequestAddressAndSalt(bytes32 _radHash) + function _determineWitOracleRequestAddressAndSalt(bytes32 _radHash) virtual internal view returns (address, bytes32) { @@ -612,7 +612,7 @@ contract WitnetRequestFactoryDefault ); } - function _determineWitnetRequestTemplateAddressAndSalt( + function _determineWitOracleRequestTemplateAddressAndSalt( bytes32[] calldata _retrieveHashes, bytes16 _aggregateReduceHash, bytes16 _tallyReduceHash diff --git a/contracts/core/trustless/WitPriceFeedsSolverBase.sol b/contracts/core/trustless/WitPriceFeedsSolverBase.sol index 9d2ce43f..80195cb2 100644 --- a/contracts/core/trustless/WitPriceFeedsSolverBase.sol +++ b/contracts/core/trustless/WitPriceFeedsSolverBase.sol @@ -2,13 +2,13 @@ pragma solidity >=0.8.0 <0.9.0; -import "../../data/WitnetPriceFeedsData.sol"; -import "../../interfaces/IWitnetPriceFeeds.sol"; +import "../../data/WitPriceFeedsData.sol"; +import "../../interfaces/IWitPriceFeeds.sol"; abstract contract WitPriceFeedsSolverBase is - IWitnetPriceFeedsSolver, - WitnetPriceFeedsData + IWitPriceFeedsSolver, + WitPriceFeedsData { address public immutable override delegator; @@ -25,7 +25,7 @@ abstract contract WitPriceFeedsSolverBase } function specs() external pure returns (bytes4) { - return type(IWitnetPriceFeedsSolver).interfaceId; + return type(IWitPriceFeedsSolver).interfaceId; } function validate(bytes4 feedId, string[] calldata deps) virtual override external { diff --git a/contracts/data/WitnetOracleDataLib.sol b/contracts/data/WitOracleDataLib.sol similarity index 94% rename from contracts/data/WitnetOracleDataLib.sol rename to contracts/data/WitOracleDataLib.sol index 82a460a5..a28cdbd2 100644 --- a/contracts/data/WitnetOracleDataLib.sol +++ b/contracts/data/WitOracleDataLib.sol @@ -2,16 +2,16 @@ pragma solidity >=0.7.0 <0.9.0; -import "../WitnetRadonRegistry.sol"; +import "../WitOracleRadonRegistry.sol"; import "../libs/Witnet.sol"; /// @title Witnet Request Board base data model library /// @author The Witnet Foundation. -library WitnetOracleDataLib { +library WitOracleDataLib { using Witnet for Witnet.Request; - bytes32 internal constant _WITNET_ORACLE_DATA_SLOTHASH = + bytes32 internal constant _WIT_ORACLE_DATA_SLOTHASH = /* keccak256("io.witnet.boards.data") */ 0xf595240b351bc8f951c2f53b26f4e78c32cb62122cf76c19b7fdda7d4968e183; @@ -28,7 +28,7 @@ library WitnetOracleDataLib { function data() internal pure returns (Storage storage _ptr) { assembly { - _ptr.slot := _WITNET_ORACLE_DATA_SLOTHASH + _ptr.slot := _WIT_ORACLE_DATA_SLOTHASH } } @@ -92,7 +92,7 @@ library WitnetOracleDataLib { // ================================================================================================================ // --- Public functions ------------------------------------------------------------------------------------------- - function extractWitnetDataRequests(WitnetRadonRegistry registry, uint256[] calldata queryIds) + function extractWitnetDataRequests(WitOracleRadonRegistry registry, uint256[] calldata queryIds) public view returns (bytes[] memory bytecodes) { diff --git a/contracts/data/WitnetRadonRegistryData.sol b/contracts/data/WitOracleRadonRegistryData.sol similarity index 92% rename from contracts/data/WitnetRadonRegistryData.sol rename to contracts/data/WitOracleRadonRegistryData.sol index c4b55a83..62c2f08f 100644 --- a/contracts/data/WitnetRadonRegistryData.sol +++ b/contracts/data/WitOracleRadonRegistryData.sol @@ -6,9 +6,9 @@ import "../libs/Witnet.sol"; /// @title Witnet Request Board base data model. /// @author The Witnet Foundation. -abstract contract WitnetRadonRegistryData { +abstract contract WitOracleRadonRegistryData { - bytes32 private constant _WITNET_BYTECODES_DATA_SLOTHASH = + bytes32 private constant _WIT_BYTECODES_DATA_SLOTHASH = /* keccak256("io.witnet.bytecodes.data") */ 0x673359bdfd0124f9962355e7aed2d07d989b0d4bc4cbe2c94c295e0f81427dec; @@ -62,7 +62,7 @@ abstract contract WitnetRadonRegistryData { returns (Storage storage _ptr) { assembly { - _ptr.slot := _WITNET_BYTECODES_DATA_SLOTHASH + _ptr.slot := _WIT_BYTECODES_DATA_SLOTHASH } } diff --git a/contracts/data/WitnetRequestFactoryData.sol b/contracts/data/WitOracleRequestFactoryData.sol similarity index 61% rename from contracts/data/WitnetRequestFactoryData.sol rename to contracts/data/WitOracleRequestFactoryData.sol index 0282bb80..e26e5157 100644 --- a/contracts/data/WitnetRequestFactoryData.sol +++ b/contracts/data/WitOracleRequestFactoryData.sol @@ -3,36 +3,36 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../WitnetRequest.sol"; -import "../WitnetRequestTemplate.sol"; +import "../WitOracleRequest.sol"; +import "../WitOracleRequestTemplate.sol"; -contract WitnetRequestFactoryData { +contract WitOracleRequestFactoryData { - bytes32 internal constant _WITNET_REQUEST_SLOTHASH = + bytes32 internal constant _WIT_ORACLE_REQUEST_SLOTHASH = /* keccak256("io.witnet.data.request") */ 0xbf9e297db5f64cdb81cd821e7ad085f56008e0c6100f4ebf5e41ef6649322034; - bytes32 internal constant _WITNET_REQUEST_FACTORY_SLOTHASH = + bytes32 internal constant _WIT_ORACLE_REQUEST_FACTORY_SLOTHASH = /* keccak256("io.witnet.data.request.factory") */ 0xfaf45a8ecd300851b566566df52ca7611b7a56d24a3449b86f4e21c71638e642; - bytes32 internal constant _WITNET_REQUEST_TEMPLATE_SLOTHASH = + bytes32 internal constant _WIT_ORACLE_REQUEST_TEMPLATE_SLOTHASH = /* keccak256("io.witnet.data.request.template") */ 0x50402db987be01ecf619cd3fb022cf52f861d188e7b779dd032a62d082276afb; - struct WitnetRequestFactoryStorage { + struct WitOracleRequestFactoryStorage { address owner; address pendingOwner; } - struct WitnetRequestStorage { + struct WitOracleRequestStorage { /// Radon RAD hash. bytes32 radHash; // /// Array of string arguments passed upon initialization. // string[][] args; } - struct WitnetRequestTemplateStorage { + struct WitOracleRequestTemplateStorage { /// @notice Array of retrievals hashes passed upon construction. bytes32[] retrieveHashes; /// @notice Aggregator reduce hash. @@ -43,28 +43,28 @@ contract WitnetRequestFactoryData { function __witnetRequestFactory() internal pure - returns (WitnetRequestFactoryStorage storage ptr) + returns (WitOracleRequestFactoryStorage storage ptr) { assembly { - ptr.slot := _WITNET_REQUEST_FACTORY_SLOTHASH + ptr.slot := _WIT_ORACLE_REQUEST_FACTORY_SLOTHASH } } function __witnetRequest() internal pure - returns (WitnetRequestStorage storage ptr) + returns (WitOracleRequestStorage storage ptr) { assembly { - ptr.slot := _WITNET_REQUEST_SLOTHASH + ptr.slot := _WIT_ORACLE_REQUEST_SLOTHASH } } function __witnetRequestTemplate() internal pure - returns (WitnetRequestTemplateStorage storage ptr) + returns (WitOracleRequestTemplateStorage storage ptr) { assembly { - ptr.slot := _WITNET_REQUEST_TEMPLATE_SLOTHASH + ptr.slot := _WIT_ORACLE_REQUEST_TEMPLATE_SLOTHASH } } } \ No newline at end of file diff --git a/contracts/data/WitnetPriceFeedsData.sol b/contracts/data/WitPriceFeedsData.sol similarity index 92% rename from contracts/data/WitnetPriceFeedsData.sol rename to contracts/data/WitPriceFeedsData.sol index 896a3eae..0d8e2d33 100644 --- a/contracts/data/WitnetPriceFeedsData.sol +++ b/contracts/data/WitPriceFeedsData.sol @@ -2,11 +2,11 @@ pragma solidity >=0.8.0 <0.9.0; -/// @title WitnetFeeds data model. +/// @title WitFeeds data model. /// @author The Witnet Foundation. -abstract contract WitnetPriceFeedsData { +abstract contract WitPriceFeedsData { - bytes32 private constant _WITNET_FEEDS_DATA_SLOTHASH = + bytes32 private constant _WIT_FEEDS_DATA_SLOTHASH = /* keccak256("io.witnet.feeds.data") */ 0xe36ea87c48340f2c23c9e1c9f72f5c5165184e75683a4d2a19148e5964c1d1ff; @@ -37,7 +37,7 @@ abstract contract WitnetPriceFeedsData { returns (Storage storage _ptr) { assembly { - _ptr.slot := _WITNET_FEEDS_DATA_SLOTHASH + _ptr.slot := _WIT_FEEDS_DATA_SLOTHASH } } diff --git a/contracts/interfaces/IFeeds.sol b/contracts/interfaces/IFeeds.sol index c27f3ab5..92b9715d 100644 --- a/contracts/interfaces/IFeeds.sol +++ b/contracts/interfaces/IFeeds.sol @@ -9,4 +9,4 @@ interface IFeeds { function supportedFeeds() external view returns (bytes4[] memory, string[] memory, bytes32[] memory); function supportsCaption(string calldata) external view returns (bool); function totalFeeds() external view returns (uint256); -} \ No newline at end of file +} diff --git a/contracts/interfaces/IWitnetAppliance.sol b/contracts/interfaces/IWitAppliance.sol similarity index 92% rename from contracts/interfaces/IWitnetAppliance.sol rename to contracts/interfaces/IWitAppliance.sol index aed9dda9..813722e8 100644 --- a/contracts/interfaces/IWitnetAppliance.sol +++ b/contracts/interfaces/IWitAppliance.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -interface IWitnetAppliance { +interface IWitAppliance { /// @notice Returns the name of the actual contract implementing the logic of this Witnet appliance. function class() external view returns (string memory); diff --git a/contracts/interfaces/IWitnetFeeds.sol b/contracts/interfaces/IWitFeeds.sol similarity index 92% rename from contracts/interfaces/IWitnetFeeds.sol rename to contracts/interfaces/IWitFeeds.sol index fdef096d..39406a0c 100644 --- a/contracts/interfaces/IWitnetFeeds.sol +++ b/contracts/interfaces/IWitFeeds.sol @@ -2,16 +2,16 @@ pragma solidity >=0.8.0 <0.9.0; -import "../WitnetOracle.sol"; -import "../WitnetRadonRegistry.sol"; +import "../WitOracle.sol"; +import "../WitOracleRadonRegistry.sol"; -interface IWitnetFeeds { +interface IWitFeeds { /// Primitive data type produced by successful data updates of all supported - /// feeds (e.g. Witnet.RadonDataTypes.Integer in WitnetPriceFeeds). + /// feeds (e.g. Witnet.RadonDataTypes.Integer in WitPriceFeeds). function dataType() external view returns (Witnet.RadonDataTypes); - /// ERC-2362 caption prefix shared by all supported feeds (e.g. "Price-" in WitnetPriceFeeds). + /// ERC-2362 caption prefix shared by all supported feeds (e.g. "Price-" in WitPriceFeeds). function prefix() external view returns (string memory); /// Default SLA data security parameters that will be fulfilled on Witnet upon @@ -22,7 +22,7 @@ interface IWitnetFeeds { /// update with the given the _evmGasPrice value. function estimateUpdateRequestFee(uint256 evmGasPrice) external view returns (uint); - /// Returns the query id (in the context of the WitnetOracle addressed by witnet()) + /// Returns the query id (in the context of the WitOracle addressed by witnet()) /// that solved the most recently updated value for the given feed. function lastValidQueryId(bytes4 feedId) external view returns (uint256); diff --git a/contracts/interfaces/IWitnetFeedsAdmin.sol b/contracts/interfaces/IWitFeedsAdmin.sol similarity index 76% rename from contracts/interfaces/IWitnetFeedsAdmin.sol rename to contracts/interfaces/IWitFeedsAdmin.sol index b2fa501b..c0892a30 100644 --- a/contracts/interfaces/IWitnetFeedsAdmin.sol +++ b/contracts/interfaces/IWitFeedsAdmin.sol @@ -4,10 +4,10 @@ pragma solidity >=0.8.0 <0.9.0; import "../libs/Witnet.sol"; -import "../WitnetRequest.sol"; -import "../WitnetRequestTemplate.sol"; +import "../WitOracleRequest.sol"; +import "../WitOracleRequestTemplate.sol"; -interface IWitnetFeedsAdmin { +interface IWitFeedsAdmin { event WitnetFeedDeleted(bytes4 feedId); event WitnetFeedSettled(bytes4 feedId, bytes32 radHash); @@ -23,8 +23,8 @@ interface IWitnetFeedsAdmin { function settleBaseFeeOverheadPercentage(uint16) external; function settleDefaultRadonSLA(Witnet.RadonSLA calldata) external; function settleFeedRequest(string calldata caption, bytes32 radHash) external; - function settleFeedRequest(string calldata caption, WitnetRequest request) external; - function settleFeedRequest(string calldata caption, WitnetRequestTemplate template, string[][] calldata) external; + function settleFeedRequest(string calldata caption, WitOracleRequest request) external; + function settleFeedRequest(string calldata caption, WitOracleRequestTemplate template, string[][] calldata) external; function settleFeedSolver (string calldata caption, address solver, string[] calldata deps) external; function transferOwnership(address) external; } \ No newline at end of file diff --git a/contracts/interfaces/IWitnetFeedsEvents.sol b/contracts/interfaces/IWitFeedsEvents.sol similarity index 93% rename from contracts/interfaces/IWitnetFeedsEvents.sol rename to contracts/interfaces/IWitFeedsEvents.sol index 129a701b..5fe7e672 100644 --- a/contracts/interfaces/IWitnetFeedsEvents.sol +++ b/contracts/interfaces/IWitFeedsEvents.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.0 <0.9.0; -interface IWitnetFeedsEvents { +interface IWitFeedsEvents { /// A fresh update on the data feed identified as `erc2364Id4` has just been /// requested and paid for by some `evmSender`, under command of the diff --git a/contracts/interfaces/IWitnetFeedsLegacy.sol b/contracts/interfaces/IWitFeedsLegacy.sol similarity index 88% rename from contracts/interfaces/IWitnetFeedsLegacy.sol rename to contracts/interfaces/IWitFeedsLegacy.sol index cc688fea..242595ef 100644 --- a/contracts/interfaces/IWitnetFeedsLegacy.sol +++ b/contracts/interfaces/IWitFeedsLegacy.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.0 <0.9.0; -interface IWitnetFeedsLegacy { +interface IWitFeedsLegacy { struct RadonSLA { uint8 witNumWitnesses; uint64 witUnitaryReward; diff --git a/contracts/interfaces/IWitnetOracle.sol b/contracts/interfaces/IWitOracle.sol similarity index 86% rename from contracts/interfaces/IWitnetOracle.sol rename to contracts/interfaces/IWitOracle.sol index eeba02f7..93ce1965 100644 --- a/contracts/interfaces/IWitnetOracle.sol +++ b/contracts/interfaces/IWitOracle.sol @@ -3,12 +3,12 @@ pragma solidity >=0.7.0 <0.9.0; import "../libs/Witnet.sol"; -import "../WitnetRadonRegistry.sol"; -import "../WitnetRequestFactory.sol"; +import "../WitOracleRadonRegistry.sol"; +import "../WitOracleRequestFactory.sol"; -interface IWitnetOracle { +interface IWitOracle { - /// @notice Uniquely identifies the WitnetOracle addrees and the chain on which it's deployed. + /// @notice Uniquely identifies the WitOracle addrees and the chain on which it's deployed. function channel() external view returns (bytes4); /// @notice Estimate the minimum reward required for posting a data request. @@ -29,9 +29,9 @@ interface IWitnetOracle { /// @param querySLA The query SLA data security parameters as required for the Wit/oracle blockchain. function estimateExtraFee(uint256 evmGasPrice, uint256 evmWitPrice, Witnet.RadonSLA calldata querySLA) external view returns (uint256); - /// @notice Returns the address of the WitnetRequestFactory appliance capable of building compliant data request - /// @notice templates verified into the same WitnetRadonRegistry instance returned by registry(). - function factory() external view returns (WitnetRequestFactory); + /// @notice Returns the address of the WitOracleRequestFactory appliance capable of building compliant data request + /// @notice templates verified into the same WitOracleRadonRegistry instance returned by registry(). + function factory() external view returns (WitOracleRequestFactory); /// @notice Retrieves a copy of all Witnet-provable data related to a previously posted request, /// removing the whole query from the WRB storage. @@ -85,7 +85,7 @@ interface IWitnetOracle { /// @notice solved by the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be /// @notice transferred to the reporter who relays back the Witnet-provable result to this request. /// @dev Reasons to fail: - /// @dev - the RAD hash was not previously verified by the WitnetRadonRegistry registry; + /// @dev - the RAD hash was not previously verified by the WitOracleRadonRegistry registry; /// @dev - invalid SLA parameters were provided; /// @dev - insufficient value is paid as reward. /// @param queryRAD The RAD hash of the data request to be solved by Witnet. @@ -102,8 +102,8 @@ interface IWitnetOracle { /// @notice directly to the requesting contract. If the report callback fails for any reason, an `WitnetQueryResponseDeliveryFailed` /// @notice will be triggered, and the Witnet audit trail will be saved in storage, but not so the actual CBOR-encoded result. /// @dev Reasons to fail: - /// @dev - the caller is not a contract implementing the IWitnetConsumer interface; - /// @dev - the RAD hash was not previously verified by the WitnetRadonRegistry registry; + /// @dev - the caller is not a contract implementing the IWitOracleConsumer interface; + /// @dev - the RAD hash was not previously verified by the WitOracleRadonRegistry registry; /// @dev - invalid SLA parameters were provided; /// @dev - insufficient value is paid as reward. /// @param queryRAD The RAD hash of the data request to be solved by Witnet. @@ -116,12 +116,12 @@ interface IWitnetOracle { uint24 queryCallbackGasLimit ) external payable returns (uint256 queryId); - function postRequestWithCallbackFrom( - address consumer, - bytes32 queryRAD, - Witnet.RadonSLA calldata querySLA, - uint24 queryCallbackGasLimit - ) external payable returns (uint256 queryId); + // function postRequestWithCallbackFrom( + // address consumer, + // bytes32 queryRAD, + // Witnet.RadonSLA calldata querySLA, + // uint24 queryCallbackGasLimit + // ) external payable returns (uint256 queryId); /// @notice Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by /// @notice the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the @@ -129,7 +129,7 @@ interface IWitnetOracle { /// @notice directly to the requesting contract. If the report callback fails for any reason, a `WitnetQueryResponseDeliveryFailed` /// @notice event will be triggered, and the Witnet audit trail will be saved in storage, but not so the CBOR-encoded result. /// @dev Reasons to fail: - /// @dev - the caller is not a contract implementing the IWitnetConsumer interface; + /// @dev - the caller is not a contract implementing the IWitOracleConsumer interface; /// @dev - the provided bytecode is empty; /// @dev - invalid SLA parameters were provided; /// @dev - insufficient value is paid as reward. @@ -144,17 +144,17 @@ interface IWitnetOracle { ) external payable returns (uint256 queryId); - function postRequestWithCallback( - address consumer, - bytes calldata queryUnverifiedBytecode, - Witnet.RadonSLA calldata querySLA, - uint24 queryCallbackGasLimit - ) external payable returns (uint256 queryId); + // function postRequestWithCallbackFrom( + // address consumer, + // bytes calldata queryUnverifiedBytecode, + // Witnet.RadonSLA calldata querySLA, + // uint24 queryCallbackGasLimit + // ) external payable returns (uint256 queryId); - /// @notice Returns the singleton WitnetRadonRegistry in which all Witnet-compliant data requests + /// @notice Returns the singleton WitOracleRadonRegistry in which all Witnet-compliant data requests /// @notice and templates must be previously verified so they can be passed as reference when /// @notice calling postRequest(bytes32,..) methods. - function registry() external view returns (WitnetRadonRegistry); + function registry() external view returns (WitOracleRadonRegistry); /// @notice Increments the reward of a previously posted request by adding the transaction value to it. /// @param queryId The unique query identifier. diff --git a/contracts/interfaces/IWitnetRequestBoardAdmin.sol b/contracts/interfaces/IWitOracleAdmin.sol similarity index 92% rename from contracts/interfaces/IWitnetRequestBoardAdmin.sol rename to contracts/interfaces/IWitOracleAdmin.sol index 44e83f32..0be66a38 100644 --- a/contracts/interfaces/IWitnetRequestBoardAdmin.sol +++ b/contracts/interfaces/IWitOracleAdmin.sol @@ -4,7 +4,7 @@ pragma solidity >=0.7.0 <0.9.0; /// @title Witnet Request Board basic administration interface. /// @author The Witnet Foundation. -interface IWitnetRequestBoardAdmin { +interface IWitOracleAdmin { event OwnershipTransferred(address indexed from, address indexed to); diff --git a/contracts/interfaces/IWitnetRequestBoardAdminACLs.sol b/contracts/interfaces/IWitOracleAdminACLs.sol similarity index 95% rename from contracts/interfaces/IWitnetRequestBoardAdminACLs.sol rename to contracts/interfaces/IWitOracleAdminACLs.sol index a7d7081b..7c275b3a 100644 --- a/contracts/interfaces/IWitnetRequestBoardAdminACLs.sol +++ b/contracts/interfaces/IWitOracleAdminACLs.sol @@ -4,7 +4,7 @@ pragma solidity >=0.7.0 <0.9.0; /// @title Witnet Request Board ACLs administration interface. /// @author The Witnet Foundation. -interface IWitnetRequestBoardAdminACLs { +interface IWitOracleAdminACLs { event ReportersSet(address[] reporters); event ReportersUnset(address[] reporters); diff --git a/contracts/interfaces/IWitOracleAppliance.sol b/contracts/interfaces/IWitOracleAppliance.sol new file mode 100644 index 00000000..ffc3637e --- /dev/null +++ b/contracts/interfaces/IWitOracleAppliance.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "../WitOracle.sol"; +import "./IWitAppliance.sol"; + +abstract contract IWitOracleAppliance + is + IWitAppliance +{ + /// @notice Returns the WitOracle address that this appliance is bound to. + function witnet() virtual external view returns (WitOracle); +} diff --git a/contracts/interfaces/IWitnetConsumer.sol b/contracts/interfaces/IWitOracleConsumer.sol similarity index 80% rename from contracts/interfaces/IWitnetConsumer.sol rename to contracts/interfaces/IWitOracleConsumer.sol index 3f84c13c..3c18cd11 100644 --- a/contracts/interfaces/IWitnetConsumer.sol +++ b/contracts/interfaces/IWitOracleConsumer.sol @@ -3,12 +3,12 @@ pragma solidity ^0.8.0; import "../libs/Witnet.sol"; -interface IWitnetConsumer { +interface IWitOracleConsumer { - /// @notice Method to be called from the WitnetOracle contract as soon as the given Witnet `queryId` + /// @notice Method to be called from the WitOracle contract as soon as the given Witnet `queryId` /// @notice gets reported, if reported with no errors. - /// @dev It should revert if called from any other address different to the WitnetOracle being used - /// @dev by the WitnetConsumer contract. + /// @dev It should revert if called from any other address different to the WitOracle being used + /// @dev by the WitConsumer contract. /// @param witnetQueryId The unique identifier of the Witnet query being reported. /// @param witnetResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. /// @param witnetResultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. @@ -22,10 +22,10 @@ interface IWitnetConsumer { WitnetCBOR.CBOR calldata witnetResultCborValue ) external; - /// @notice Method to be called from the WitnetOracle contract as soon as the given Witnet `queryId` + /// @notice Method to be called from the WitOracle contract as soon as the given Witnet `queryId` /// @notice gets reported, if reported WITH errors. - /// @dev It should revert if called from any other address different to the WitnetOracle being used - /// @dev by the WitnetConsumer contract. + /// @dev It should revert if called from any other address different to the WitOracle being used + /// @dev by the WitConsumer contract. /// @param witnetQueryId The unique identifier of the Witnet query being reported. /// @param witnetResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. /// @param witnetResultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. @@ -42,7 +42,7 @@ interface IWitnetConsumer { ) external; /// @notice Determines if Witnet queries can be reported from given address. - /// @dev In practice, must only be true on the WitnetOracle address that's being used by - /// @dev the WitnetConsumer to post queries. + /// @dev In practice, must only be true on the WitOracle address that's being used by + /// @dev the WitConsumer to post queries. function reportableFrom(address) external view returns (bool); } \ No newline at end of file diff --git a/contracts/interfaces/IWitnetOracleEvents.sol b/contracts/interfaces/IWitOracleEvents.sol similarity index 95% rename from contracts/interfaces/IWitnetOracleEvents.sol rename to contracts/interfaces/IWitOracleEvents.sol index 59993f9e..f6ff9489 100644 --- a/contracts/interfaces/IWitnetOracleEvents.sol +++ b/contracts/interfaces/IWitOracleEvents.sol @@ -3,9 +3,9 @@ pragma solidity >=0.7.0 <0.9.0; import "../libs/Witnet.sol"; -interface IWitnetOracleEvents { +interface IWitOracleEvents { - /// Emitted every time a new query containing some verified data request is posted to the WitnetOracle. + /// Emitted every time a new query containing some verified data request is posted to the WitOracle. event WitnetQuery( address evmRequester, uint256 evmGasPrice, diff --git a/contracts/interfaces/IWitnetOracleLegacy.sol b/contracts/interfaces/IWitOracleLegacy.sol similarity index 95% rename from contracts/interfaces/IWitnetOracleLegacy.sol rename to contracts/interfaces/IWitOracleLegacy.sol index 312940f9..b461f8ba 100644 --- a/contracts/interfaces/IWitnetOracleLegacy.sol +++ b/contracts/interfaces/IWitOracleLegacy.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; -interface IWitnetOracleLegacy { +interface IWitOracleLegacy { /// @notice Estimate the minimum reward required for posting a data request. /// @dev Underestimates if the size of returned data is greater than `resultMaxSize`. @@ -10,7 +10,7 @@ interface IWitnetOracleLegacy { function estimateBaseFee(uint256 gasPrice, uint16 resultMaxSize) external view returns (uint256); /// @notice Estimate the minimum reward required for posting a data request. - /// @dev Fails if the RAD hash was not previously verified on the WitnetRadonRegistry registry. + /// @dev Fails if the RAD hash was not previously verified on the WitOracleRadonRegistry registry. /// @param gasPrice Expected gas price to pay upon posting the data request. /// @param radHash The RAD hash of the data request to be solved by Witnet. function estimateBaseFee(uint256 gasPrice, bytes32 radHash) external view returns (uint256); diff --git a/contracts/interfaces/IWitnetRadonRegistry.sol b/contracts/interfaces/IWitOracleRadonRegistry.sol similarity index 99% rename from contracts/interfaces/IWitnetRadonRegistry.sol rename to contracts/interfaces/IWitOracleRadonRegistry.sol index 25ce25ef..513a3c64 100644 --- a/contracts/interfaces/IWitnetRadonRegistry.sol +++ b/contracts/interfaces/IWitOracleRadonRegistry.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.0 <0.9.0; import "../libs/Witnet.sol"; -interface IWitnetRadonRegistry { +interface IWitOracleRadonRegistry { /// Returns the Witnet-compliant RAD bytecode for some Radon Request /// identified by its unique RAD hash. diff --git a/contracts/interfaces/IWitnetRadonRegistryEvents.sol b/contracts/interfaces/IWitOracleRadonRegistryEvents.sol similarity index 71% rename from contracts/interfaces/IWitnetRadonRegistryEvents.sol rename to contracts/interfaces/IWitOracleRadonRegistryEvents.sol index 3c6cdac9..eceba152 100644 --- a/contracts/interfaces/IWitnetRadonRegistryEvents.sol +++ b/contracts/interfaces/IWitOracleRadonRegistryEvents.sol @@ -4,17 +4,17 @@ pragma solidity >=0.7.0 <0.9.0; import "../libs/Witnet.sol"; -interface IWitnetRadonRegistryEvents { +interface IWitOracleRadonRegistryEvents { /// Emitted every time a new Radon Reducer gets successfully verified and - /// stored into the WitnetRadonRegistry. + /// stored into the WitOracleRadonRegistry. event NewRadonReducer(bytes16 hash); /// Emitted every time a new Radon Retrieval gets successfully verified and - /// stored into the WitnetRadonRegistry. + /// stored into the WitOracleRadonRegistry. event NewRadonRetrieval(bytes32 hash); /// Emitted every time a new Radon Request gets successfully verified and - /// stored into the WitnetRadonRegistry. + /// stored into the WitOracleRadonRegistry. event NewRadonRequest(bytes32 radHash); } diff --git a/contracts/interfaces/IWitnetRadonRegistryLegacy.sol b/contracts/interfaces/IWitOracleRadonRegistryLegacy.sol similarity index 93% rename from contracts/interfaces/IWitnetRadonRegistryLegacy.sol rename to contracts/interfaces/IWitOracleRadonRegistryLegacy.sol index 5764521c..ad728faa 100644 --- a/contracts/interfaces/IWitnetRadonRegistryLegacy.sol +++ b/contracts/interfaces/IWitOracleRadonRegistryLegacy.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.0 <0.9.0; import "../libs/Witnet.sol"; -interface IWitnetRadonRegistryLegacy { +interface IWitOracleRadonRegistryLegacy { function lookupRadonRequestResultMaxSize(bytes32 radHash) external view returns (uint16); function lookupRadonRequestSources(bytes32 radHash) external view returns (bytes32[] memory); diff --git a/contracts/interfaces/IWitnetOracleReporter.sol b/contracts/interfaces/IWitOracleReporter.sol similarity index 99% rename from contracts/interfaces/IWitnetOracleReporter.sol rename to contracts/interfaces/IWitOracleReporter.sol index 79b9e297..5405b3fe 100644 --- a/contracts/interfaces/IWitnetOracleReporter.sol +++ b/contracts/interfaces/IWitOracleReporter.sol @@ -6,7 +6,7 @@ import "../libs/Witnet.sol"; /// @title The Witnet Request Board Reporter interface. /// @author The Witnet Foundation. -interface IWitnetOracleReporter { +interface IWitOracleReporter { /// @notice Estimates the actual earnings in WEI, that a reporter would get by reporting result to given query, /// @notice based on the gas price of the calling transaction. Data requesters should consider upgrading the reward on diff --git a/contracts/interfaces/IWitnetRequest.sol b/contracts/interfaces/IWitOracleRequest.sol similarity index 85% rename from contracts/interfaces/IWitnetRequest.sol rename to contracts/interfaces/IWitOracleRequest.sol index 866904e0..ef4af9ee 100644 --- a/contracts/interfaces/IWitnetRequest.sol +++ b/contracts/interfaces/IWitOracleRequest.sol @@ -4,14 +4,14 @@ pragma solidity >=0.7.0 <0.9.0; import "../libs/Witnet.sol"; -interface IWitnetRequest { +interface IWitOracleRequest { /// Returns the Witnet-compliant RAD bytecode for the data request (i.e. Radon Request) - /// contained within this WitnetRequest. + /// contained within this WitOracleRequest. function bytecode() external view returns (bytes memory); /// Returns the Witnet-compliant RAD hash of the data request (i.e. Radon Request) - /// contained within this WitnetRequest. + /// contained within this WitOracleRequest. function radHash() external view returns (bytes32); /// Returns the filters and reducing functions to be applied by witnessing nodes @@ -29,14 +29,14 @@ interface IWitnetRequest { function getRadonRetrievalByIndex(uint256) external view returns (Witnet.RadonRetrieval memory); /// Returns the array of one or more data sources (i.e. Radon Retrievals) - /// that compose this WitnetRequest. + /// that compose this WitOracleRequest. function getRadonRetrievals() external view returns (Witnet.RadonRetrieval[] memory); /// Returns the expected data type produced by successful resolutions of the - /// Witnet-compliant data request contained within this WitnetRequest. + /// Witnet-compliant data request contained within this WitOracleRequest. function getResultDataType() external view returns (Witnet.RadonDataTypes); /// If built out of an upgradable factory, or template, returns the SemVer tag of - /// the actual implementation version at the time when this WitnetRequest got built. + /// the actual implementation version at the time when this WitOracleRequest got built. function version() external view returns (string memory); } diff --git a/contracts/interfaces/IWitnetRequestFactory.sol b/contracts/interfaces/IWitOracleRequestFactory.sol similarity index 88% rename from contracts/interfaces/IWitnetRequestFactory.sol rename to contracts/interfaces/IWitOracleRequestFactory.sol index 3898bfe2..19c30ca8 100644 --- a/contracts/interfaces/IWitnetRequestFactory.sol +++ b/contracts/interfaces/IWitOracleRequestFactory.sol @@ -4,7 +4,7 @@ pragma solidity >=0.7.0 <0.9.0; import "../libs/Witnet.sol"; -interface IWitnetRequestFactory { +interface IWitOracleRequestFactory { /// @notice Builds a Witnet Request instance that will provide the bytecode /// @notice and RAD hash of some Witnet-compliant data request, provably @@ -18,7 +18,7 @@ interface IWitnetRequestFactory { /// @param retrieveHashes Hashes of previously verified data sources. /// @param aggregate The Radon Reducer to apply on values returned from data sources. /// @param tally The Radon Reducer to apply on values revealed by witnessing nodes. - function buildWitnetRequest( + function buildWitOracleRequest( bytes32[] calldata retrieveHashes, Witnet.RadonReducer calldata aggregate, Witnet.RadonReducer calldata tally @@ -35,16 +35,16 @@ interface IWitnetRequestFactory { /// @param retrieveHashes Hashes of previously verified data sources. /// @param aggregate The Radon Reducer to apply on values returned from data sources. /// @param tally The Radon Reducer to apply on values revealed by witnessing nodes. - function buildWitnetRequestTemplate( + function buildWitOracleRequestTemplate( bytes32[] calldata retrieveHashes, Witnet.RadonReducer calldata aggregate, Witnet.RadonReducer calldata tally ) external returns (address template); /// @notice Verifies and registers the specified Witnet Radon Retrieval - /// @notice (i.e. public data sources) into the WitnetRadonRegistry of the - /// @notice WitnetOracle attached to this factory. Returns a hash that uniquely - /// @notice identifies validated data source within the WitnetRadonRegistry. + /// @notice (i.e. public data sources) into the WitOracleRadonRegistry of the + /// @notice WitOracle attached to this factory. Returns a hash that uniquely + /// @notice identifies validated data source within the WitOracleRadonRegistry. /// @dev Note: all input parameters but the `requestMethod` are parameterizable /// @dev by using embedded wildcard `\x\` substrings (being `x='0'..'9'). /// @dev Reverts if: diff --git a/contracts/interfaces/IWitOracleRequestFactoryEvents.sol b/contracts/interfaces/IWitOracleRequestFactoryEvents.sol new file mode 100644 index 00000000..293882aa --- /dev/null +++ b/contracts/interfaces/IWitOracleRequestFactoryEvents.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; + +interface IWitOracleRequestFactoryEvents { + + /// Emitted every time a new counter-factual WitOracleRequest gets verified and built. + event WitOracleRequestBuilt(address request); + + /// Emitted every time a new counter-factual WitOracleRequestTemplate gets verified and built. + event WitOracleRequestTemplateBuilt(address template); +} diff --git a/contracts/interfaces/IWitnetRequestTemplate.sol b/contracts/interfaces/IWitOracleRequestTemplate.sol similarity index 77% rename from contracts/interfaces/IWitnetRequestTemplate.sol rename to contracts/interfaces/IWitOracleRequestTemplate.sol index 23339103..45cd6fe3 100644 --- a/contracts/interfaces/IWitnetRequestTemplate.sol +++ b/contracts/interfaces/IWitOracleRequestTemplate.sol @@ -4,20 +4,20 @@ pragma solidity >=0.7.0 <0.9.0; import "../libs/Witnet.sol"; -interface IWitnetRequestTemplate { +interface IWitOracleRequestTemplate { - /// Build a WitnetRequest instance that will provide the bytecode and RAD + /// Build a WitOracleRequest instance that will provide the bytecode and RAD /// hash of some Witnet-compliant Radon Request, provably made out of the - /// data sources, aggregate and tally Radon Reducers that compose this WitnetRequestTemplate. + /// data sources, aggregate and tally Radon Reducers that compose this WitOracleRequestTemplate. /// Produced addresses are counter-factual to the given values. /// Reverts if: /// - the ranks of passed array don't match either the number of this template's /// data sources, or the number of required parameters by each one of those. - function buildWitnetRequest (string[][] calldata args) external returns (address); + function buildWitOracleRequest (string[][] calldata args) external returns (address); /// Returns an array of integers telling the number of parameters required /// by every single data source (i.e. Radon Retrievals) that compose this - /// WitnetRequestTemplate. The length of the returned array tells the number + /// WitOracleRequestTemplate. The length of the returned array tells the number /// of data sources that compose this instance. function getArgsCount() external view returns (uint256[] memory); @@ -35,28 +35,28 @@ interface IWitnetRequestTemplate { function getRadonRetrievalByIndex(uint256) external view returns (Witnet.RadonRetrieval memory); /// Returns the array of one or more parameterized data sources that compose - /// this WitnetRequestTemplate. + /// this WitOracleRequestTemplate. function getRadonRetrievals() external view returns (Witnet.RadonRetrieval[] memory); /// Returns the expected data type produced by successful resolutions of - /// any WitnetRequest that gets built out of this WitnetRequestTemplate. + /// any WitOracleRequest that gets built out of this WitOracleRequestTemplate. function getResultDataType() external view returns (Witnet.RadonDataTypes); /// If built out of an upgradable factory, returns the SemVer tag of the - /// factory implementation at the time when this WitnetRequestTemplate got built. + /// factory implementation at the time when this WitOracleRequestTemplate got built. function version() external view returns (string memory); - /// Verifies into the bounded WitnetOracle's registry the actual bytecode + /// Verifies into the bounded WitOracle's registry the actual bytecode /// and RAD hash of the Witnet-compliant Radon Request that gets provably /// made out of the data sources, aggregate and tally Radon Reducers that - /// compose this WitnetRequestTemplate. While no WitnetRequest instance is + /// compose this WitOracleRequestTemplate. While no WitOracleRequest instance is /// actually constructed, the returned value will be accepted as a valid /// RAD hash on the witnet() contract from now on. /// Reverts if: /// - the ranks of passed array don't match either the number of this /// template's data sources, or the number of required parameters by /// each one of those. - /// @dev This method requires less gas than buildWitnetRequest(string[][]), and + /// @dev This method requires less gas than buildWitOracleRequest(string[][]), and /// it's usually preferred when parameterized data requests made out of this /// template are intended to be used just once in lifetime. function verifyRadonRequest(string[][] calldata args) external returns (bytes32); diff --git a/contracts/interfaces/IWitnetPriceFeeds.sol b/contracts/interfaces/IWitPriceFeeds.sol similarity index 69% rename from contracts/interfaces/IWitnetPriceFeeds.sol rename to contracts/interfaces/IWitPriceFeeds.sol index af57a9fd..7fd71915 100644 --- a/contracts/interfaces/IWitnetPriceFeeds.sol +++ b/contracts/interfaces/IWitPriceFeeds.sol @@ -2,21 +2,21 @@ pragma solidity >=0.8.0 <0.9.0; -import "./IWitnetPriceFeedsSolver.sol"; +import "./IWitPriceFeedsSolver.sol"; -interface IWitnetPriceFeeds { +interface IWitPriceFeeds { /// ====================================================================================================== /// --- IFeeds extension --------------------------------------------------------------------------------- function lookupDecimals(bytes4 feedId) external view returns (uint8); function lookupPriceSolver(bytes4 feedId) external view returns ( - IWitnetPriceFeedsSolver solverAddress, + IWitPriceFeedsSolver solverAddress, string[] memory solverDeps ); /// ====================================================================================================== - /// --- IWitnetFeeds extension --------------------------------------------------------------------------- + /// --- IWitFeeds extension --------------------------------------------------------------------------- - function latestPrice(bytes4 feedId) external view returns (IWitnetPriceFeedsSolver.Price memory); - function latestPrices(bytes4[] calldata feedIds) external view returns (IWitnetPriceFeedsSolver.Price[] memory); + function latestPrice(bytes4 feedId) external view returns (IWitPriceFeedsSolver.Price memory); + function latestPrices(bytes4[] calldata feedIds) external view returns (IWitPriceFeedsSolver.Price[] memory); } \ No newline at end of file diff --git a/contracts/interfaces/IWitnetPriceFeedsSolver.sol b/contracts/interfaces/IWitPriceFeedsSolver.sol similarity index 93% rename from contracts/interfaces/IWitnetPriceFeedsSolver.sol rename to contracts/interfaces/IWitPriceFeedsSolver.sol index 1828a4a5..25ed6927 100644 --- a/contracts/interfaces/IWitnetPriceFeedsSolver.sol +++ b/contracts/interfaces/IWitPriceFeedsSolver.sol @@ -4,7 +4,7 @@ pragma solidity >=0.8.0 <0.9.0; import "../libs/Witnet.sol"; -interface IWitnetPriceFeedsSolver { +interface IWitPriceFeedsSolver { struct Price { uint value; uint timestamp; diff --git a/contracts/interfaces/IWitnetPriceFeedsSolverDeployer.sol b/contracts/interfaces/IWitPriceFeedsSolverFactory.sol similarity index 90% rename from contracts/interfaces/IWitnetPriceFeedsSolverDeployer.sol rename to contracts/interfaces/IWitPriceFeedsSolverFactory.sol index 8483672e..4ec58962 100644 --- a/contracts/interfaces/IWitnetPriceFeedsSolverDeployer.sol +++ b/contracts/interfaces/IWitPriceFeedsSolverFactory.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.0 <0.9.0; -interface IWitnetPriceFeedsSolverDeployer { +interface IWitPriceFeedsSolverFactory { event NewPriceFeedsSolver(address solver, bytes32 codehash, bytes constructorParams); function deployPriceSolver(bytes calldata initcode, bytes calldata additionalParams) external returns (address); function determinePriceSolverAddress(bytes calldata initcode, bytes calldata additionalParams) external view returns (address); diff --git a/contracts/interfaces/IWitnetRandomness.sol b/contracts/interfaces/IWitRandomness.sol similarity index 99% rename from contracts/interfaces/IWitnetRandomness.sol rename to contracts/interfaces/IWitRandomness.sol index a9e29902..c26f497d 100644 --- a/contracts/interfaces/IWitnetRandomness.sol +++ b/contracts/interfaces/IWitRandomness.sol @@ -3,11 +3,11 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../WitnetOracle.sol"; +import "../WitOracle.sol"; /// @title The Witnet Randomness generator interface. /// @author Witnet Foundation. -interface IWitnetRandomness { +interface IWitRandomness { /// @notice Returns amount of wei required to be paid as a fee when requesting randomization with a /// transaction gas price as the one given. diff --git a/contracts/interfaces/IWitnetRandomnessAdmin.sol b/contracts/interfaces/IWitRandomnessAdmin.sol similarity index 93% rename from contracts/interfaces/IWitnetRandomnessAdmin.sol rename to contracts/interfaces/IWitRandomnessAdmin.sol index 7860b526..d7ad145d 100644 --- a/contracts/interfaces/IWitnetRandomnessAdmin.sol +++ b/contracts/interfaces/IWitRandomnessAdmin.sol @@ -4,7 +4,7 @@ pragma solidity >=0.8.0 <0.9.0; import "../libs/Witnet.sol"; -interface IWitnetRandomnessAdmin { +interface IWitRandomnessAdmin { function acceptOwnership() external; function baseFeeOverheadPercentage() external view returns (uint16); function owner() external view returns (address); diff --git a/contracts/interfaces/IWitnetRandomnessEvents.sol b/contracts/interfaces/IWitRandomnessEvents.sol similarity index 91% rename from contracts/interfaces/IWitnetRandomnessEvents.sol rename to contracts/interfaces/IWitRandomnessEvents.sol index 8de20ab3..0e646531 100644 --- a/contracts/interfaces/IWitnetRandomnessEvents.sol +++ b/contracts/interfaces/IWitRandomnessEvents.sol @@ -7,7 +7,7 @@ import "../libs/Witnet.sol"; /// @title The Witnet Randomness generator interface. /// @author Witnet Foundation. -interface IWitnetRandomnessEvents { +interface IWitRandomnessEvents { /// Emitted every time a new randomize is requested. event Randomizing( diff --git a/contracts/interfaces/IWitnetOracleAppliance.sol b/contracts/interfaces/IWitnetOracleAppliance.sol deleted file mode 100644 index a2a9cc85..00000000 --- a/contracts/interfaces/IWitnetOracleAppliance.sol +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import "../WitnetOracle.sol"; -import "./IWitnetAppliance.sol"; - -abstract contract IWitnetOracleAppliance - is - IWitnetAppliance -{ - /// @notice Returns the WitnetOracle address that this appliance is bound to. - function witnet() virtual external view returns (WitnetOracle); -} diff --git a/contracts/interfaces/IWitnetRequestFactoryEvents.sol b/contracts/interfaces/IWitnetRequestFactoryEvents.sol deleted file mode 100644 index 9ec22267..00000000 --- a/contracts/interfaces/IWitnetRequestFactoryEvents.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.7.0 <0.9.0; - -interface IWitnetRequestFactoryEvents { - - /// Emitted every time a new counter-factual WitnetRequest gets verified and built. - event WitnetRequestBuilt(address request); - - /// Emitted every time a new counter-factual WitnetRequestTemplate gets verified and built. - event WitnetRequestTemplateBuilt(address template); -} diff --git a/contracts/libs/WitnetEncodingLib.sol b/contracts/libs/WitOracleRadonEncodingLib.sol similarity index 94% rename from contracts/libs/WitnetEncodingLib.sol rename to contracts/libs/WitOracleRadonEncodingLib.sol index e2931eba..0be91cda 100644 --- a/contracts/libs/WitnetEncodingLib.sol +++ b/contracts/libs/WitOracleRadonEncodingLib.sol @@ -6,7 +6,7 @@ import "./Witnet.sol"; /// @title A library for encoding Witnet Data Requests. /// @author The Witnet Foundation. -library WitnetEncodingLib { +library WitOracleRadonEncodingLib { using WitnetBuffer for WitnetBuffer.Buffer; using WitnetCBOR for WitnetCBOR.CBOR; @@ -34,7 +34,7 @@ library WitnetEncodingLib { error UnsupportedRadonTallyScript(bytes32 hash); /// =============================================================================================================== - /// --- WitnetEncodingLib internal methods -------------------------------------------------------------------------------- + /// --- WitOracleRadonEncodingLib internal methods -------------------------------------------------------------------------------- function size(Witnet.RadonDataTypes _type) internal pure returns (uint16) { if (_type == Witnet.RadonDataTypes.Integer @@ -51,7 +51,7 @@ library WitnetEncodingLib { /// =============================================================================================================== - /// --- WitnetEncodingLib public methods (if used library will have to linked to calling contracts) ----------------------- + /// --- WitOracleRadonEncodingLib public methods (if used library will have to linked to calling contracts) ----------------------- /// @notice Encode bytes array into given major type (UTF-8 not yet supported) /// @param buf Bytes array @@ -437,24 +437,24 @@ library WitnetEncodingLib { public pure { if (sla.witnessReward == 0) { - revert("WitnetEncodingLib: invalid SLA: no reward"); + revert("WitOracleRadonEncodingLib: invalid SLA: no reward"); } if (sla.numWitnesses == 0) { - revert("WitnetEncodingLib: invalid SLA: no witnesses"); + revert("WitOracleRadonEncodingLib: invalid SLA: no witnesses"); } else if (sla.numWitnesses > 127) { - revert("WitnetEncodingLib: invalid SLA: too many witnesses (>127)"); + revert("WitOracleRadonEncodingLib: invalid SLA: too many witnesses (>127)"); } if ( sla.minConsensusPercentage < 51 || sla.minConsensusPercentage > 99 ) { - revert("WitnetEncodingLib: invalid SLA: consensus percentage out of range"); + revert("WitOracleRadonEncodingLib: invalid SLA: consensus percentage out of range"); } if (sla.witnessCollateral > 0) { - revert("WitnetEncodingLib: invalid SLA: no collateral"); + revert("WitOracleRadonEncodingLib: invalid SLA: no collateral"); } if (sla.witnessCollateral / sla.witnessReward > 127) { - revert("WitnetEncodingLib: invalid SLA: collateral/reward ratio too high (>127)"); + revert("WitOracleRadonEncodingLib: invalid SLA: collateral/reward ratio too high (>127)"); } } @@ -470,7 +470,7 @@ library WitnetEncodingLib { /// =============================================================================================================== - /// --- WitnetEncodingLib private methods --------------------------------------------------------------------------------- + /// --- WitOracleRadonEncodingLib private methods --------------------------------------------------------------------------------- function _replaceCborWildcards( WitnetCBOR.CBOR memory self, diff --git a/contracts/libs/WitnetErrorsLib.sol b/contracts/libs/WitOracleResultErrorsLib.sol similarity index 97% rename from contracts/libs/WitnetErrorsLib.sol rename to contracts/libs/WitOracleResultErrorsLib.sol index f8cf48bd..89d6570a 100644 --- a/contracts/libs/WitnetErrorsLib.sol +++ b/contracts/libs/WitOracleResultErrorsLib.sol @@ -7,7 +7,7 @@ import "./Witnet.sol"; /// @title A library for interpreting Witnet resolution errors /// @author The Witnet Foundation. -library WitnetErrorsLib { +library WitOracleResultErrorsLib { using Witnet for bytes; using Witnet for uint8; @@ -43,17 +43,17 @@ library WitnetErrorsLib { } else if (_status == Witnet.ResponseStatus.Finalizing) { return Witnet.ResultError({ code: Witnet.ResultErrorCodes.Unknown, - reason: "WitnetErrorsLib: not yet finalized" + reason: "WitOracleResultErrorsLib: not yet finalized" }); } if (_status == Witnet.ResponseStatus.Awaiting) { return Witnet.ResultError({ code: Witnet.ResultErrorCodes.Unknown, - reason: "WitnetErrorsLib: not yet reported" + reason: "WitOracleResultErrorsLib: not yet reported" }); } else { return Witnet.ResultError({ code: Witnet.ResultErrorCodes.Unknown, - reason: "WitnetErrorsLib: unknown query" + reason: "WitOracleResultErrorsLib: unknown query" }); } } diff --git a/contracts/libs/WitnetPriceFeedsLib.sol b/contracts/libs/WitPriceFeedsLib.sol similarity index 81% rename from contracts/libs/WitnetPriceFeedsLib.sol rename to contracts/libs/WitPriceFeedsLib.sol index ea6f3c18..79c7f5c9 100644 --- a/contracts/libs/WitnetPriceFeedsLib.sol +++ b/contracts/libs/WitPriceFeedsLib.sol @@ -3,17 +3,17 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../interfaces/IWitnetPriceFeedsSolver.sol"; -import "../interfaces/IWitnetPriceFeedsSolverDeployer.sol"; +import "../interfaces/IWitPriceFeedsSolver.sol"; +import "../interfaces/IWitPriceFeedsSolverFactory.sol"; import "../libs/Slices.sol"; -/// @title Ancillary deployable library for WitnetPriceFeeds. +/// @title Ancillary deployable library for WitPriceFeeds. /// @dev Features: -/// @dev - deployment of counter-factual IWitnetPriceFeedsSolver instances. +/// @dev - deployment of counter-factual IWitPriceFeedsSolver instances. /// @dev - validation of feed caption strings. /// @author The Witnet Foundation. -library WitnetPriceFeedsLib { +library WitPriceFeedsLib { using Slices for string; using Slices for Slices.Slice; @@ -40,8 +40,8 @@ library WitnetPriceFeedsLib { // assert(_solver == _createdContract); // fails on TEN chains _solver = _createdContract; require( - IWitnetPriceFeedsSolver(_solver).specs() == type(IWitnetPriceFeedsSolver).interfaceId, - "WitnetPriceFeedsLib: uncompliant solver implementation" + IWitPriceFeedsSolver(_solver).specs() == type(IWitPriceFeedsSolver).interfaceId, + "WitPriceFeedsLib: uncompliant solver implementation" ); } } @@ -71,7 +71,7 @@ library WitnetPriceFeedsLib { { require( bytes6(bytes(caption)) == bytes6(prefix), - "WitnetPriceFeedsLib: bad caption prefix" + "WitPriceFeedsLib: bad caption prefix" ); Slices.Slice memory _caption = caption.toSlice(); Slices.Slice memory _delim = string("-").toSlice(); @@ -80,7 +80,7 @@ library WitnetPriceFeedsLib { _parts[_ix] = _caption.split(_delim).toString(); } (uint _decimals, bool _success) = Witnet.tryUint(_parts[_parts.length - 1]); - require(_success, "WitnetPriceFeedsLib: bad decimals"); + require(_success, "WitPriceFeedsLib: bad decimals"); return uint8(_decimals); } diff --git a/contracts/mocks/UsingWitnet.sol b/contracts/mocks/UsingWitOracle.sol similarity index 86% rename from contracts/mocks/UsingWitnet.sol rename to contracts/mocks/UsingWitOracle.sol index b9033418..83299225 100644 --- a/contracts/mocks/UsingWitnet.sol +++ b/contracts/mocks/UsingWitOracle.sol @@ -3,17 +3,17 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../WitnetOracle.sol"; +import "../WitOracle.sol"; -/// @title The UsingWitnet contract +/// @title The UsingWitOracle contract /// @dev Witnet-aware contracts can inherit from this contract in order to interact with Witnet. /// @author The Witnet Foundation. -abstract contract UsingWitnet +abstract contract UsingWitOracle is - IWitnetOracleEvents + IWitOracleEvents { /// @dev Immutable reference to the Witnet Request Board contract. - WitnetOracle internal immutable __witnet; + WitOracle internal immutable __witnet; /// @dev Default Security-Level Agreement parameters to be fulfilled by the Witnet blockchain /// @dev when solving a data request. @@ -25,11 +25,11 @@ abstract contract UsingWitnet /// @dev the Witnet blockchain levels, respectivelly. uint16 internal __witnetBaseFeeOverheadPercentage; - /// @param _wrb Address of the WitnetOracle contract. - constructor(WitnetOracle _wrb) { + /// @param _wrb Address of the WitOracle contract. + constructor(WitOracle _wrb) { require( - _wrb.specs() == type(WitnetOracle).interfaceId, - "UsingWitnet: uncompliant WitnetOracle" + _wrb.specs() == type(WitOracle).interfaceId, + "UsingWitOracle: uncompliant WitOracle" ); __witnet = _wrb; __witnetDefaultSLA = Witnet.RadonSLA({ @@ -48,11 +48,11 @@ abstract contract UsingWitnet /// @dev contract until a particular request has been successfully solved and reported by Witnet, /// @dev either with an error or successfully. modifier witnetQuerySolved(uint256 _witnetQueryId) { - require(_witnetCheckQueryResultAvailability(_witnetQueryId), "UsingWitnet: unsolved query"); + require(_witnetCheckQueryResultAvailability(_witnetQueryId), "UsingWitOracle: unsolved query"); _; } - function witnet() virtual public view returns (WitnetOracle) { + function witnet() virtual public view returns (WitOracle) { return __witnet; } diff --git a/contracts/mocks/UsingWitOracleRandomness.sol b/contracts/mocks/UsingWitOracleRandomness.sol new file mode 100644 index 00000000..c7cedc43 --- /dev/null +++ b/contracts/mocks/UsingWitOracleRandomness.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; +pragma experimental ABIEncoderV2; + +import "../WitRandomness.sol"; + +/// @title The UsingWitOracleRandomness contract +/// @dev Contracts willing to interact with WitRandomness appliance should just inherit from this contract. +/// @author The Witnet Foundation. +abstract contract UsingWitOracleRandomness + is + IWitOracleEvents, + IWitRandomnessEvents +{ + WitOracle immutable public witnet; + WitRandomness immutable public __RNG; + + constructor(WitRandomness _witnetRandomness) { + require( + address(_witnetRandomness).code.length > 0 + && _witnetRandomness.specs() == type(WitRandomness).interfaceId, + "UsingWitOracleRandomness: uncompliant WitRandomness appliance" + ); + __RNG = _witnetRandomness; + witnet = __RNG.witnet(); + } + +} + diff --git a/contracts/mocks/UsingWitnetRequest.sol b/contracts/mocks/UsingWitOracleRequest.sol similarity index 66% rename from contracts/mocks/UsingWitnetRequest.sol rename to contracts/mocks/UsingWitOracleRequest.sol index 0cb561f7..f565a06e 100644 --- a/contracts/mocks/UsingWitnetRequest.sol +++ b/contracts/mocks/UsingWitOracleRequest.sol @@ -1,27 +1,27 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "./UsingWitnet.sol"; -import "../WitnetRequest.sol"; +import "./UsingWitOracle.sol"; +import "../WitOracleRequest.sol"; -abstract contract UsingWitnetRequest - is UsingWitnet +abstract contract UsingWitOracleRequest + is UsingWitOracle { - WitnetRequest immutable public dataRequest; + WitOracleRequest immutable public dataRequest; bytes32 immutable internal __witnetRequestRadHash; - /// @param _witnetRequest Address of the WitnetRequest contract containing the actual data request. + /// @param _witnetRequest Address of the WitOracleRequest contract containing the actual data request. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. constructor ( - WitnetRequest _witnetRequest, + WitOracleRequest _witnetRequest, uint16 _baseFeeOverheadPercentage ) - UsingWitnet(_witnetRequest.witnet()) + UsingWitOracle(_witnetRequest.witnet()) { require( - _witnetRequest.specs() == type(WitnetRequest).interfaceId, - "UsingWitnetRequest: uncompliant WitnetRequest" + _witnetRequest.specs() == type(WitOracleRequest).interfaceId, + "UsingWitOracleRequest: uncompliant WitOracleRequest" ); dataRequest = _witnetRequest; __witnetRequestRadHash = _witnetRequest.radHash(); diff --git a/contracts/mocks/UsingWitnetRequestTemplate.sol b/contracts/mocks/UsingWitOracleRequestTemplate.sol similarity index 63% rename from contracts/mocks/UsingWitnetRequestTemplate.sol rename to contracts/mocks/UsingWitOracleRequestTemplate.sol index 46cb8f0b..17797323 100644 --- a/contracts/mocks/UsingWitnetRequestTemplate.sol +++ b/contracts/mocks/UsingWitOracleRequestTemplate.sol @@ -1,27 +1,27 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "./UsingWitnet.sol"; +import "./UsingWitOracle.sol"; -import "../WitnetRequest.sol"; -import "../WitnetRequestTemplate.sol"; +import "../WitOracleRequest.sol"; +import "../WitOracleRequestTemplate.sol"; -abstract contract UsingWitnetRequestTemplate - is UsingWitnet +abstract contract UsingWitOracleRequestTemplate + is UsingWitOracle { - WitnetRequestTemplate immutable public dataRequestTemplate; + WitOracleRequestTemplate immutable public dataRequestTemplate; - /// @param _witnetRequestTemplate Address of the WitnetRequestTemplate from which actual data requests will get built. + /// @param _witnetRequestTemplate Address of the WitOracleRequestTemplate from which actual data requests will get built. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. constructor ( - WitnetRequestTemplate _witnetRequestTemplate, + WitOracleRequestTemplate _witnetRequestTemplate, uint16 _baseFeeOverheadPercentage ) - UsingWitnet(_witnetRequestTemplate.witnet()) + UsingWitOracle(_witnetRequestTemplate.witnet()) { require( - _witnetRequestTemplate.specs() == type(WitnetRequestTemplate).interfaceId, - "UsingWitnetRequestTemplate: uncompliant WitnetRequestTemplate" + _witnetRequestTemplate.specs() == type(WitOracleRequestTemplate).interfaceId, + "UsingWitOracleRequestTemplate: uncompliant WitOracleRequestTemplate" ); dataRequestTemplate = _witnetRequestTemplate; __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; @@ -34,9 +34,9 @@ abstract contract UsingWitnetRequestTemplate } function _witnetBuildRequest(string[][] memory _witnetRequestArgs) - internal returns (WitnetRequest) + internal returns (WitOracleRequest) { - return WitnetRequest(dataRequestTemplate.buildWitnetRequest(_witnetRequestArgs)); + return WitOracleRequest(dataRequestTemplate.buildWitOracleRequest(_witnetRequestArgs)); } function __witnetRequestData( diff --git a/contracts/mocks/UsingWitnetRandomness.sol b/contracts/mocks/UsingWitnetRandomness.sol deleted file mode 100644 index b26bbd11..00000000 --- a/contracts/mocks/UsingWitnetRandomness.sol +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.7.0 <0.9.0; -pragma experimental ABIEncoderV2; - -import "../WitnetRandomness.sol"; - -/// @title The UsingWitnetRandomness contract -/// @dev Contracts willing to interact with WitnetRandomness appliance should just inherit from this contract. -/// @author The Witnet Foundation. -abstract contract UsingWitnetRandomness - is - IWitnetOracleEvents, - IWitnetRandomnessEvents -{ - WitnetOracle immutable public witnet; - WitnetRandomness immutable public __RNG; - - constructor(WitnetRandomness _witnetRandomness) { - require( - address(_witnetRandomness).code.length > 0 - && _witnetRandomness.specs() == type(WitnetRandomness).interfaceId, - "UsingWitnetRandomness: uncompliant WitnetRandomness appliance" - ); - __RNG = _witnetRandomness; - witnet = __RNG.witnet(); - } - -} - diff --git a/contracts/mocks/WitnetConsumer.sol b/contracts/mocks/WitConsumer.sol similarity index 74% rename from contracts/mocks/WitnetConsumer.sol rename to contracts/mocks/WitConsumer.sol index c6d54573..fbde08b3 100644 --- a/contracts/mocks/WitnetConsumer.sol +++ b/contracts/mocks/WitConsumer.sol @@ -1,30 +1,30 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "./UsingWitnet.sol"; -import "../interfaces/IWitnetConsumer.sol"; +import "./UsingWitOracle.sol"; +import "../interfaces/IWitOracleConsumer.sol"; -abstract contract WitnetConsumer +abstract contract WitConsumer is - IWitnetConsumer, - UsingWitnet + IWitOracleConsumer, + UsingWitOracle { - /// @dev Maximum gas to be spent by the IWitnetConsumer's callback methods. + /// @dev Maximum gas to be spent by the IWitOracleConsumer's callback methods. uint24 internal immutable __witnetCallbackGasLimit; modifier onlyFromWitnet { - require(msg.sender == address(__witnet), "WitnetConsumer: unauthorized"); + require(msg.sender == address(__witnet), "WitConsumer: unauthorized"); _; } - /// @param _callbackGasLimit Maximum gas to be spent by the IWitnetConsumer's callback methods. + /// @param _callbackGasLimit Maximum gas to be spent by the IWitOracleConsumer's callback methods. constructor (uint24 _callbackGasLimit) { __witnetCallbackGasLimit = _callbackGasLimit; } /// =============================================================================================================== - /// --- Base implementation of IWitnetConsumer -------------------------------------------------------------------- + /// --- Base implementation of IWitOracleConsumer -------------------------------------------------------------------- function reportableFrom(address _from) virtual override external view returns (bool) { return _from == address(__witnet); @@ -32,7 +32,7 @@ abstract contract WitnetConsumer /// =============================================================================================================== - /// --- WitnetConsumer virtual methods ---------------------------------------------------------------------------- + /// --- WitConsumer virtual methods ---------------------------------------------------------------------------- function _witnetEstimateBaseFee() virtual override internal view returns (uint256) { return ( diff --git a/contracts/mocks/WitnetRequestConsumer.sol b/contracts/mocks/WitOracleRequestConsumer.sol similarity index 62% rename from contracts/mocks/WitnetRequestConsumer.sol rename to contracts/mocks/WitOracleRequestConsumer.sol index 0977317f..6b12f942 100644 --- a/contracts/mocks/WitnetRequestConsumer.sol +++ b/contracts/mocks/WitOracleRequestConsumer.sol @@ -1,35 +1,35 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "./UsingWitnetRequest.sol"; -import "./WitnetConsumer.sol"; +import "./UsingWitOracleRequest.sol"; +import "./WitConsumer.sol"; -abstract contract WitnetRequestConsumer +abstract contract WitOracleRequestConsumer is - UsingWitnetRequest, - WitnetConsumer + UsingWitOracleRequest, + WitConsumer { using WitnetCBOR for WitnetCBOR.CBOR; using WitnetCBOR for WitnetCBOR.CBOR[]; - /// @param _witnetRequest Address of the WitnetRequest contract containing the actual data request. + /// @param _witnetRequest Address of the WitOracleRequest contract containing the actual data request. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. - /// @param _callbackGasLimit Maximum gas to be spent by the IWitnetConsumer's callback methods. + /// @param _callbackGasLimit Maximum gas to be spent by the IWitOracleConsumer's callback methods. constructor( - WitnetRequest _witnetRequest, + WitOracleRequest _witnetRequest, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit ) - UsingWitnetRequest(_witnetRequest, _baseFeeOverheadPercentage) - WitnetConsumer(_callbackGasLimit) + UsingWitOracleRequest(_witnetRequest, _baseFeeOverheadPercentage) + WitConsumer(_callbackGasLimit) {} function _witnetEstimateBaseFee() - virtual override(UsingWitnet, WitnetConsumer) + virtual override(UsingWitOracle, WitConsumer) internal view returns (uint256) { - return WitnetConsumer._witnetEstimateBaseFee(); + return WitConsumer._witnetEstimateBaseFee(); } function __witnetRequestData( diff --git a/contracts/mocks/WitnetRequestTemplateConsumer.sol b/contracts/mocks/WitOracleRequestTemplateConsumer.sol similarity index 61% rename from contracts/mocks/WitnetRequestTemplateConsumer.sol rename to contracts/mocks/WitOracleRequestTemplateConsumer.sol index 2e85386a..a92f82cc 100644 --- a/contracts/mocks/WitnetRequestTemplateConsumer.sol +++ b/contracts/mocks/WitOracleRequestTemplateConsumer.sol @@ -1,35 +1,35 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "./UsingWitnetRequestTemplate.sol"; -import "./WitnetConsumer.sol"; +import "./UsingWitOracleRequestTemplate.sol"; +import "./WitConsumer.sol"; -abstract contract WitnetRequestTemplateConsumer +abstract contract WitOracleRequestTemplateConsumer is - UsingWitnetRequestTemplate, - WitnetConsumer + UsingWitOracleRequestTemplate, + WitConsumer { using WitnetCBOR for WitnetCBOR.CBOR; using WitnetCBOR for WitnetCBOR.CBOR[]; - /// @param _witnetRequestTemplate Address of the WitnetRequestTemplate from which actual data requests will get built. + /// @param _witnetRequestTemplate Address of the WitOracleRequestTemplate from which actual data requests will get built. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. - /// @param _callbackGasLimit Maximum gas to be spent by the IWitnetConsumer's callback methods. + /// @param _callbackGasLimit Maximum gas to be spent by the IWitOracleConsumer's callback methods. constructor( - WitnetRequestTemplate _witnetRequestTemplate, + WitOracleRequestTemplate _witnetRequestTemplate, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit ) - UsingWitnetRequestTemplate(_witnetRequestTemplate, _baseFeeOverheadPercentage) - WitnetConsumer(_callbackGasLimit) + UsingWitOracleRequestTemplate(_witnetRequestTemplate, _baseFeeOverheadPercentage) + WitConsumer(_callbackGasLimit) {} function _witnetEstimateBaseFee() - virtual override(UsingWitnet, WitnetConsumer) + virtual override(UsingWitOracle, WitConsumer) internal view returns (uint256) { - return WitnetConsumer._witnetEstimateBaseFee(); + return WitConsumer._witnetEstimateBaseFee(); } function __witnetRequestData( diff --git a/contracts/mocks/WitnetRandomnessRequestConsumer.sol b/contracts/mocks/WitRandomnessRequestConsumer.sol similarity index 87% rename from contracts/mocks/WitnetRandomnessRequestConsumer.sol rename to contracts/mocks/WitRandomnessRequestConsumer.sol index 4165db05..cad0a858 100644 --- a/contracts/mocks/WitnetRandomnessRequestConsumer.sol +++ b/contracts/mocks/WitRandomnessRequestConsumer.sol @@ -3,12 +3,12 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitnetConsumer.sol"; -import "../WitnetRequest.sol"; +import "./WitConsumer.sol"; +import "../WitOracleRequest.sol"; -abstract contract WitnetRandomnessRequestConsumer +abstract contract WitRandomnessRequestConsumer is - WitnetConsumer + WitConsumer { using Witnet for bytes; using Witnet for bytes32; @@ -17,20 +17,20 @@ abstract contract WitnetRandomnessRequestConsumer bytes32 internal immutable __witnetRandomnessRadHash; - /// @param _wrb Address of the WitnetOracle contract. + /// @param _wrb Address of the WitOracle contract. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. - /// @param _callbackGasLimit Maximum gas to be spent by the IWitnetConsumer's callback methods. + /// @param _callbackGasLimit Maximum gas to be spent by the IWitOracleConsumer's callback methods. constructor( - WitnetOracle _wrb, + WitOracle _wrb, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit ) - UsingWitnet(_wrb) - WitnetConsumer(_callbackGasLimit) + UsingWitOracle(_wrb) + WitConsumer(_callbackGasLimit) { // On-chain building of the Witnet Randomness Request: { - WitnetRadonRegistry _registry = witnet().registry(); + WitOracleRadonRegistry _registry = witnet().registry(); // Build own Witnet Randomness Request: bytes32[] memory _retrievals = new bytes32[](1); _retrievals[0] = _registry.verifyRadonRetrieval( diff --git a/migrations/addresses.json b/migrations/addresses.json index 8476c3e6..b89fa99c 100644 --- a/migrations/addresses.json +++ b/migrations/addresses.json @@ -1,563 +1,563 @@ { "default": { "WitnetDeployer": "0x03232aBE800D1638B30432FeEF300581De323a4E", - "WitnetOracle": "0x77703aE126B971c9946d562F41Dd47071dA00777", + "WitOracle": "0x77703aE126B971c9946d562F41Dd47071dA00777", "WitnetProxy": "0xaC3E870BF8D13Dc39f76936b6AF8279eF5a9211F", - "WitnetPriceFeeds": "0x1111AbA2164AcdC6D291b08DfB374280035E1111", + "WitPriceFeeds": "0x1111AbA2164AcdC6D291b08DfB374280035E1111", "WitnetRandomnessV2": "0xC0FFEE98AD1434aCbDB894BbB752e138c1006fAB", - "WitnetRadonRegistry": "0x000B61Fe075F545fd37767f40391658275900000", - "WitnetRequestFactory": "0x000DB36997AF1F02209A6F995883B9B699900000" + "WitOracleRadonRegistry": "0x000B61Fe075F545fd37767f40391658275900000", + "WitOracleRequestFactory": "0x000DB36997AF1F02209A6F995883B9B699900000" }, "arbitrum:one": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "arbitrum:sepolia": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x85cd7aaF5248fC0568B003EF24FB2a5329C95c28", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x85cd7aaF5248fC0568B003EF24FB2a5329C95c28", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x682A7dF2852F3Df2d3B4b84803da69A38ba33180", - "WitnetRadonRegistryDefault": "0x03604d41a0289cb9325814A6aCA8BaBEf7492B44", - "WitnetRequestFactoryDefault": "0x90a7Fc875dac0D453b43BF9E5AeE7dC68091CC24" + "WitOracleRadonRegistryDefault": "0x03604d41a0289cb9325814A6aCA8BaBEf7492B44", + "WitOracleRequestFactoryDefault": "0x90a7Fc875dac0D453b43BF9E5AeE7dC68091CC24" }, "avalanche:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "avalanche:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x5B354083da3c7D034b8b95bE96aC5d114CcdA71f", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x5B354083da3c7D034b8b95bE96aC5d114CcdA71f", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "base:sepolia": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableOvm2": "0x9F02CD498b47B928c5a12FdC7cEa36246d27a638", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableOvm2": "0x9F02CD498b47B928c5a12FdC7cEa36246d27a638", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0xcB61b81a775E56e9Ec8884d2E13352d668294141", - "WitnetRadonRegistryDefault": "0x730a88594d8287Ec898b2B7fE592aB155bE71590", - "WitnetRequestFactoryDefault": "0xe1CDE456D3eC92640711625E01170A6800773b91" + "WitOracleRadonRegistryDefault": "0x730a88594d8287Ec898b2B7fE592aB155bE71590", + "WitOracleRequestFactoryDefault": "0xe1CDE456D3eC92640711625E01170A6800773b91" }, "base:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "boba:bnb:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableOvm2": "0x0D929cFfa089cA99a644E10A7c7fe1C8C62F657f", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableOvm2": "0x0D929cFfa089cA99a644E10A7c7fe1C8C62F657f", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "boba:bnb:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x4e6159Aa6c94584Af01Ccc828200c79D350D07E9", - "WitnetRequestFactoryDefault": "0xFbb35731Fd5c35a84176aBccD214538843eAf5db", - "WitnetRequestBoardTrustableOvm": "0xA126d29b0803CD0536c5487C831Daf9cB634318D", - "WitnetOracleTrustableOvm2": "0xA126d29b0803CD0536c5487C831Daf9cB634318D", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x4e6159Aa6c94584Af01Ccc828200c79D350D07E9", + "WitOracleRequestFactoryDefault": "0xFbb35731Fd5c35a84176aBccD214538843eAf5db", + "WitOracleRequestBoardTrustableOvm": "0xA126d29b0803CD0536c5487C831Daf9cB634318D", + "WitOracleTrustableOvm2": "0xA126d29b0803CD0536c5487C831Daf9cB634318D", "WitPriceFeedsV21": "0x9E23a4CD5f903b4D0ED1358413250a1e2c459F63" }, "boba:eth:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "celo:alfajores": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "celo:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04" + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04" }, "conflux:core:mainnet": { "WitnetDeployer": "0x8785dBa05D3B90c55c009D0C47f12A2d976C5e47", "WitnetProxy": "0x8529DA52FF40990685B61432BA49246b94850d86", - "WitnetErrorsLib": "0x899325905515049B49e726AF5d5f24f723a5eab2", - "WitnetEncodingLib": "0x80Ea106BE90aB7b4FCac2b3D4aCe4Ea262918188", - "WitnetPriceFeedsLib": "0x8Ac628741A0983869d237AF759f39a553aE91e47", - "WitnetOracleDataLib": "0x81cfB91911F6C8fa582033149582a63EBa39D0D3", - "WitnetRadonRegistryDefault": "0x8C6cC510195f2B53abC65340346843Df91F6B940", - "WitnetRequestFactoryCfxCore": "0x839d58dE8F143bC01549A7FD62fd508BCA922C8d", - "WitnetOracleTrustableDefault": "0x8E6Ddf8bA76350A5fde230a05fc58559A90B878D", + "WitOracleResultErrorsLib": "0x899325905515049B49e726AF5d5f24f723a5eab2", + "WitOracleRadonEncodingLib": "0x80Ea106BE90aB7b4FCac2b3D4aCe4Ea262918188", + "WitPriceFeedsLib": "0x8Ac628741A0983869d237AF759f39a553aE91e47", + "WitOracleDataLib": "0x81cfB91911F6C8fa582033149582a63EBa39D0D3", + "WitOracleRadonRegistryDefault": "0x8C6cC510195f2B53abC65340346843Df91F6B940", + "WitOracleRequestFactoryCfxCore": "0x839d58dE8F143bC01549A7FD62fd508BCA922C8d", + "WitOracleTrustableDefault": "0x8E6Ddf8bA76350A5fde230a05fc58559A90B878D", "WitPriceFeedsV21": "0x8af4262e9ECb7320a9ffdEe366172EAeA1D60e91", - "WitnetRadonRegistry": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", - "WitnetRequestFactory": "0x8daDc231C8C810CBbe2d555338bDa94DA648f964", - "WitnetOracle": "0x8346D6ba3b7a04923492007cC3A2eE7135Db7463", - "WitnetPriceFeeds": "0x8ba3C59e1029cd90010e8C731461ddFC5f49091b", + "WitOracleRadonRegistry": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", + "WitOracleRequestFactory": "0x8daDc231C8C810CBbe2d555338bDa94DA648f964", + "WitOracle": "0x8346D6ba3b7a04923492007cC3A2eE7135Db7463", + "WitPriceFeeds": "0x8ba3C59e1029cd90010e8C731461ddFC5f49091b", "WitnetRandomnessV2": "0x897832C89ec306A74f9eC29abfFcaDBfCb11A13B" }, "conflux:core:testnet": { "WitnetDeployer": "0x8785dBa05D3B90c55c009D0C47f12A2d976C5e47", "WitnetProxy": "0x8529DA52FF40990685B61432BA49246b94850d86", - "WitnetErrorsLib": "0x899325905515049B49e726AF5d5f24f723a5eab2", - "WitnetEncodingLib": "0x80Ea106BE90aB7b4FCac2b3D4aCe4Ea262918188", - "WitnetOracle": "0x8346D6ba3b7a04923492007cC3A2eE7135Db7463", - "WitnetOracleDataLib": "0x81cfB91911F6C8fa582033149582a63EBa39D0D3", - "WitnetOracleTrustableDefault": "0x857A67Cc046dB5D6414493ED9E65291FF2824116", - "WitnetPriceFeeds": "0x8ba3C59e1029cd90010e8C731461ddFC5f49091b", - "WitnetPriceFeedsLib": "0x8Ac628741A0983869d237AF759f39a553aE91e47", + "WitOracleResultErrorsLib": "0x899325905515049B49e726AF5d5f24f723a5eab2", + "WitOracleRadonEncodingLib": "0x80Ea106BE90aB7b4FCac2b3D4aCe4Ea262918188", + "WitOracle": "0x8346D6ba3b7a04923492007cC3A2eE7135Db7463", + "WitOracleDataLib": "0x81cfB91911F6C8fa582033149582a63EBa39D0D3", + "WitOracleTrustableDefault": "0x857A67Cc046dB5D6414493ED9E65291FF2824116", + "WitPriceFeeds": "0x8ba3C59e1029cd90010e8C731461ddFC5f49091b", + "WitPriceFeedsLib": "0x8Ac628741A0983869d237AF759f39a553aE91e47", "WitPriceFeedsV21": "0x80050098a4fdd72409D6C8Ec72FD50ca460349E9", "WitnetRandomnessV2": "0x897832C89ec306A74f9eC29abfFcaDBfCb11A13B", - "WitnetRadonRegistry": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", - "WitnetRadonRegistryDefault": "0x8176457C9620E8bb508aA22062E1967726179Cc9", - "WitnetRequestFactory": "0x8daDc231C8C810CBbe2d555338bDa94DA648f964", - "WitnetRequestFactoryCfxCore": "0x8E10530323e534d953D7EC83e075eCAbB38079d8" + "WitOracleRadonRegistry": "0x85d3E5577f947BcA1A12C00940087129A5F8B2eb", + "WitOracleRadonRegistryDefault": "0x8176457C9620E8bb508aA22062E1967726179Cc9", + "WitOracleRequestFactory": "0x8daDc231C8C810CBbe2d555338bDa94DA648f964", + "WitOracleRequestFactoryCfxCore": "0x8E10530323e534d953D7EC83e075eCAbB38079d8" }, "conflux:espace:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "conflux:espace:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x1B9D8186e901b6ED7848374e81B79C9eBf74801E", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x1B9D8186e901b6ED7848374e81B79C9eBf74801E", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "cronos:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "cronos:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x44C4C71c31aD14dB5B18520D3801B88aA26427B0", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x44C4C71c31aD14dB5B18520D3801B88aA26427B0", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "dogechain:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "elastos:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "elastos:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "ethereum:mainnet": { - "WitnetErrorsLib": "0x3b7AD1402C243Ba59D45a0364B17A31e260A4301", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x751F77190Ce6212899D5848334838D56CF7eEe91", - "WitnetOracleDataLib": "0xE89dc301AEe78917018039FEBE72f9FE5aB730D9", - "WitnetRadonRegistryDefault": "0x4a2f2b2E137DD7D4a61389E07c935B14a562078d", - "WitnetRequestFactoryDefault": "0x1a5cc6DeE6c7d873639e3eF49678b581f459bBa1", - "WitnetOracleTrustableDefault": "0x7084a8C12100cDBB1995aa1B0393A83A0B868837", + "WitOracleResultErrorsLib": "0x3b7AD1402C243Ba59D45a0364B17A31e260A4301", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x751F77190Ce6212899D5848334838D56CF7eEe91", + "WitOracleDataLib": "0xE89dc301AEe78917018039FEBE72f9FE5aB730D9", + "WitOracleRadonRegistryDefault": "0x4a2f2b2E137DD7D4a61389E07c935B14a562078d", + "WitOracleRequestFactoryDefault": "0x1a5cc6DeE6c7d873639e3eF49678b581f459bBa1", + "WitOracleTrustableDefault": "0x7084a8C12100cDBB1995aa1B0393A83A0B868837", "WitPriceFeedsV21": "0xC815f56cC791E41a11DB3f0D2880AdB10316fca6" }, "ethereum:sepolia": { "WitnetProxy": "0x21ac85A6c320E6fC89774A98732eAE733032651C", - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0xE790FdaEa7f1f4C4Bbd74B3493Cf94E79b24396a", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0xE790FdaEa7f1f4C4Bbd74B3493Cf94E79b24396a", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x327470b70d0cCF47cB89a1f3475DE23Ac2437c9e", - "WitnetRadonRegistryDefault": "0x34e6465f23aE086e5701A6ca8547aF7c29e0283C", - "WitnetRequestFactoryDefault": "0x1869A7137dF26397999AA6DB90c7D6D029d13908" + "WitOracleRadonRegistryDefault": "0x34e6465f23aE086e5701A6ca8547aF7c29e0283C", + "WitOracleRequestFactoryDefault": "0x1869A7137dF26397999AA6DB90c7D6D029d13908" }, "gnosis:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "kava:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "kava:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "kcc:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "kcc:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "klaytn:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "klaytn:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "mantle:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "mantle:sepolia": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableOvm2": "0x8423ddeb7d86Ce43a9C643bE3A420Ff69825Dd53", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableOvm2": "0x8423ddeb7d86Ce43a9C643bE3A420Ff69825Dd53", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x853DDf69DbEaDA2fc4A521a1dBA5Beb210a5c4d2", - "WitnetRadonRegistryDefault": "0xD1960cdC1593Bb9CA75263266dAB75EE33163187", - "WitnetRequestFactoryDefault": "0x9ef37BF321828AD49F3D31Fd9Cd36921ee317190" + "WitOracleRadonRegistryDefault": "0xD1960cdC1593Bb9CA75263266dAB75EE33163187", + "WitOracleRequestFactoryDefault": "0x9ef37BF321828AD49F3D31Fd9Cd36921ee317190" }, "metis:sepolia": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "meter:mainnet": { "WitnetDeployer": "0x496aB880a611825c7c2322AD6d7ead0f84276327", "WitnetProxy": "0xc0a47100832Bf857Bf1F0517F4bf84D79da60B23", - "WitnetErrorsLib": "0x5a59Ce1206B1771AcdE7ff85910F9e03Aef20EB8", - "WitnetEncodingLib": "0xfa52abc94415A334F6C846CA018290CE2755B13D", - "WitnetPriceFeedsLib": "0xBD9Ec958409eC6FbaF4d833F7Ea4e3892A406c98", - "WitnetOracleDataLib": "0x70d501E01d0EE71F8DD3e533849F5fc454359d6F", - "WitnetRadonRegistryDefault": "0x14D3AAD34a7aB614Feaf72cc0eAab120E64d032F", - "WitnetRequestFactoryCfxCore": "0x6Ee46D8db750607ffa5Ec3Eb0DAE969E1916F417", - "WitnetOracleTrustableDefault": "0xB11b58238BAf7CBBb608C81e7792cEA29e4E19D0", + "WitOracleResultErrorsLib": "0x5a59Ce1206B1771AcdE7ff85910F9e03Aef20EB8", + "WitOracleRadonEncodingLib": "0xfa52abc94415A334F6C846CA018290CE2755B13D", + "WitPriceFeedsLib": "0xBD9Ec958409eC6FbaF4d833F7Ea4e3892A406c98", + "WitOracleDataLib": "0x70d501E01d0EE71F8DD3e533849F5fc454359d6F", + "WitOracleRadonRegistryDefault": "0x14D3AAD34a7aB614Feaf72cc0eAab120E64d032F", + "WitOracleRequestFactoryCfxCore": "0x6Ee46D8db750607ffa5Ec3Eb0DAE969E1916F417", + "WitOracleTrustableDefault": "0xB11b58238BAf7CBBb608C81e7792cEA29e4E19D0", "WitPriceFeedsV21": "0x7e701068365CFF4f217A32be8059550d8aEdc00D", - "WitnetRadonRegistry": "0xBa84D2ffA26c8fC7EF2c5Bd4839B4b2E4d56D330", - "WitnetRequestFactory": "0xc5074dde3FEA0347d3B2E8C38e58e6A34FeEf8EF", - "WitnetOracle": "0x1f28E4d955eccE989c00b3871446AB22B3Fa9Cc8", - "WitnetPriceFeeds": "0x27EF7A3e155F96e68A9988EAdBF8bd3eFdba1438", + "WitOracleRadonRegistry": "0xBa84D2ffA26c8fC7EF2c5Bd4839B4b2E4d56D330", + "WitOracleRequestFactory": "0xc5074dde3FEA0347d3B2E8C38e58e6A34FeEf8EF", + "WitOracle": "0x1f28E4d955eccE989c00b3871446AB22B3Fa9Cc8", + "WitPriceFeeds": "0x27EF7A3e155F96e68A9988EAdBF8bd3eFdba1438", "WitnetRandomnessV2": "0x4d239f070e475E454148093781211c9eE34f476C" }, "meter:testnet": { "WitnetDeployer": "0xE9D654A97eC431C4f1faba550d0a26399f6fEc80", "WitnetProxy": "0x49c94B9d32a9AFc3C9Ce0159324b81635ac3f0Ea", - "WitnetErrorsLib": "0x02762C84752C1C1ef582E6FE8dBAF60383a87e66", - "WitnetEncodingLib": "0xA4c9D0f1DE84D190a0478FD9226Ec201Daf509E2", - "WitnetPriceFeedsLib": "0x75cC6DA115846D1E577F5C5D5566BD2C15D5d198", - "WitnetOracleDataLib": "0xCc0444d867188796254141220744BdfE9Ef6d742", - "WitnetRadonRegistryDefault": "0x8e1EDea211ed85316Bc7F115972C995b5fA897aF", - "WitnetRequestFactoryDefault": "0xC69640F34267C5B9F58f716d1385A481D7dff10D", - "WitnetOracleTrustableDefault": "0xb7dd2cD53790a5D87f5cfD265D3bD889ed5FC28d", + "WitOracleResultErrorsLib": "0x02762C84752C1C1ef582E6FE8dBAF60383a87e66", + "WitOracleRadonEncodingLib": "0xA4c9D0f1DE84D190a0478FD9226Ec201Daf509E2", + "WitPriceFeedsLib": "0x75cC6DA115846D1E577F5C5D5566BD2C15D5d198", + "WitOracleDataLib": "0xCc0444d867188796254141220744BdfE9Ef6d742", + "WitOracleRadonRegistryDefault": "0x8e1EDea211ed85316Bc7F115972C995b5fA897aF", + "WitOracleRequestFactoryDefault": "0xC69640F34267C5B9F58f716d1385A481D7dff10D", + "WitOracleTrustableDefault": "0xb7dd2cD53790a5D87f5cfD265D3bD889ed5FC28d", "WitPriceFeedsV21": "0x89eE40cfb4F7D9f56Ee2E2E9B1580176361D84eC", - "WitnetRadonRegistry": "0x87E25Ad751306b21F9345494F163122e057B7b53", - "WitnetRequestFactory": "0xd0b4512F4c9291de4104a1ad7be0c51956044bbC", - "WitnetOracle": "0x51e12A16d52DE519f7b13bFeDa42Fb61214d32a0", - "WitnetPriceFeeds": "0xD9f5Af15288294678B0863A20F4B83eeeEAa775C", + "WitOracleRadonRegistry": "0x87E25Ad751306b21F9345494F163122e057B7b53", + "WitOracleRequestFactory": "0xd0b4512F4c9291de4104a1ad7be0c51956044bbC", + "WitOracle": "0x51e12A16d52DE519f7b13bFeDa42Fb61214d32a0", + "WitPriceFeeds": "0xD9f5Af15288294678B0863A20F4B83eeeEAa775C", "WitnetRandomnessV2": "0x2dE368AFC80b13E4a42990004ebC74ce125486F9", - "WitnetRequestFactoryCfxCore": "0x602e74De19acA64f6ea1E20Da94a8B4D81dF3013" + "WitOracleRequestFactoryCfxCore": "0x602e74De19acA64f6ea1E20Da94a8B4D81dF3013" }, "moonbeam:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "moonbeam:moonbase": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x64c74993A83C55Dc81eB1ec9502867d3b4d1d924", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "moonbeam:moonriver": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "okx:oktchain:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "okx:x1:sepolia": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "optimism:mainnet": { "WitnetProxy": "0xADA577AC8eE9Cb726F6FC45f0B0716FD1aB3637D", - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableOvm2": "0xDc5Ec161b72C5710E2D648b3f360C9b76952397b", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04" + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04" }, "optimism:sepolia": { "WitnetProxy": "0x58Bd0091748d0438f379bbf7D8BfF3a624CEbc3F", - "WitnetErrorsLib": "0x4f2F381Ed2020095F1a1B5a0BDe5AB30da916BC9", - "WitnetEncodingLib": "0xf321bcD29CFc6134c9Bf42F759f428F3A6010919", - "WitnetOracleDataLib": "0x25d57Cf8a047B14172Ba2a929C1441E1A77c3f9D", - "WitnetOracleTrustableOvm2": "0xc1C158e77A91da158a1A2D0c2A154c68a8C7c0d2", - "WitnetPriceFeedsLib": "0x85aa4A0fDa112c47d4216448EE4D49Afd072675e", + "WitOracleResultErrorsLib": "0x4f2F381Ed2020095F1a1B5a0BDe5AB30da916BC9", + "WitOracleRadonEncodingLib": "0xf321bcD29CFc6134c9Bf42F759f428F3A6010919", + "WitOracleDataLib": "0x25d57Cf8a047B14172Ba2a929C1441E1A77c3f9D", + "WitOracleTrustableOvm2": "0xc1C158e77A91da158a1A2D0c2A154c68a8C7c0d2", + "WitPriceFeedsLib": "0x85aa4A0fDa112c47d4216448EE4D49Afd072675e", "WitPriceFeedsV21": "0xA936f7F4909494Ea1F7D898C2759b2324912153d", - "WitnetRadonRegistryDefault": "0x2D8BCBC4F8c97CC227e770d95d19914324baBF2A", - "WitnetRequestFactoryDefault": "0x3D551165020a4014A8d5b9E4b73D2b3Dbe401546" + "WitOracleRadonRegistryDefault": "0x2D8BCBC4F8c97CC227e770d95d19914324baBF2A", + "WitOracleRequestFactoryDefault": "0x3D551165020a4014A8d5b9E4b73D2b3Dbe401546" }, "polygon:amoy": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "polygon:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "polygon:zkevm:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x2c2C1Cf21c113F1c2D2df35a1E88aa96fc0AE749", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "reef:mainnet": { "WitnetDeployer": "0x94d6e5321039343f5e656aa7591dfbdbe81ff78f", "WitnetProxy": "0x57a52fbcb26a08425fbe813bb1f21380bff23d47", - "WitnetErrorsLib": "0xE2996CE29D5351E22a01E9dD73ADd8A0264E7318", - "WitnetEncodingLib": "0x416c6e7ff66868375cFF36bA87B8eCBB2CF2Fb08", - "WitnetPriceFeedsLib": "0xcaa6dE265EF1545788E9576660Bc6d5ae1Edb0F5", - "WitnetOracleDataLib": "0x6F65a0110a2D2Af299a73a4C169CC3d2C41Be505", - "WitnetRadonRegistryDefault": "0x1A80B677A9dd6a6762273593FE2797927c4010A4", - "WitnetRequestFactoryDefault": "0x71E2e26E5EfF3C05935A497282Fe018963b78F55", - "WitnetOracleTrustableReef": "0x7950250D3d2ae1636a7Ca2a8A6ba53e46D1cB573", + "WitOracleResultErrorsLib": "0xE2996CE29D5351E22a01E9dD73ADd8A0264E7318", + "WitOracleRadonEncodingLib": "0x416c6e7ff66868375cFF36bA87B8eCBB2CF2Fb08", + "WitPriceFeedsLib": "0xcaa6dE265EF1545788E9576660Bc6d5ae1Edb0F5", + "WitOracleDataLib": "0x6F65a0110a2D2Af299a73a4C169CC3d2C41Be505", + "WitOracleRadonRegistryDefault": "0x1A80B677A9dd6a6762273593FE2797927c4010A4", + "WitOracleRequestFactoryDefault": "0x71E2e26E5EfF3C05935A497282Fe018963b78F55", + "WitOracleTrustableReef": "0x7950250D3d2ae1636a7Ca2a8A6ba53e46D1cB573", "WitPriceFeedsV21": "0x8af56567C7F0Deaf8979244d83194816a6ED144F", - "WitnetRadonRegistry": "0xC4b7a5aD8BAF8fea9DbeB18aB6F77cdf54CF297a", - "WitnetRequestFactory": "0xEBa788A5de67E4B11869558a2414247e8Aa62179", - "WitnetOracle": "0x604b98893335CEf7Dc40061731F40aC5C6239907", - "WitnetPriceFeeds": "0xA9991dCd62a863f0F0aabF95a6a252d132b5c8D4", + "WitOracleRadonRegistry": "0xC4b7a5aD8BAF8fea9DbeB18aB6F77cdf54CF297a", + "WitOracleRequestFactory": "0xEBa788A5de67E4B11869558a2414247e8Aa62179", + "WitOracle": "0x604b98893335CEf7Dc40061731F40aC5C6239907", + "WitPriceFeeds": "0xA9991dCd62a863f0F0aabF95a6a252d132b5c8D4", "WitnetRandomnessV2": "0x84CD0bde18f78101064A2c8b8BaE5e1fCe1BCc0d" }, "reef:testnet": {}, "scroll:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryNoSha256": "0x0C39d07778Fc2FF94efe889b107Deaa074041719", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x412647Ff1519706C01706c5816E5cC355dd0A06D", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "scroll:sepolia": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryNoSha256": "0xd3a3C178F76D788B4054C3945281F94e7122a8fD", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "syscoin:rollux:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773", - "WitnetOracleTrustableOvm2": "0x9Bd67787019a6474ddE27f9c9A37260c87Da92B5", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773", + "WitOracleTrustableOvm2": "0x9Bd67787019a6474ddE27f9c9A37260c87Da92B5", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" }, "ten:testnet": { "WitnetProxy": "0xaC3E870BF8D13Dc39f76936b6AF8279eF5a9211F", - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetOracleTrustableObscuro": "0x2330f492635c2E7476bB2A3162e69129F6FEaB56", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleTrustableObscuro": "0x2330f492635c2E7476bB2A3162e69129F6FEaB56", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773" }, "ultron:mainnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", - "WitnetRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", - "WitnetOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x967C4A627e68770db28803d033eEBCeE615C37EB", + "WitOracleRequestFactoryDefault": "0xE2CA421F5c28a04eb0B22f12512627acA9cF9E04", + "WitOracleTrustableDefault": "0x105EeFc7ad7A057C3BF2D516a0bFbB84E80d66eF", "WitPriceFeedsV21": "0xd26f5c402D274C1b7c443E2215221D70C0b8DeB0" }, "ultron:testnet": { - "WitnetErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", - "WitnetEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", - "WitnetPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", - "WitnetOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", - "WitnetRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", - "WitnetRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773", - "WitnetOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", + "WitOracleResultErrorsLib": "0xa57B9dd8420631248c3DFB535f4FC9f7E2f02B4B", + "WitOracleRadonEncodingLib": "0x268631E002eE8c23F4C124AfBb6fE5DBbaa6d58c", + "WitPriceFeedsLib": "0x579b4aD5E67E5B491a33A033A02A70769D7AF837", + "WitOracleDataLib": "0x561A6c8F9C9D6e7EbAEcd4963A8f27Ae13568676", + "WitOracleRadonRegistryDefault": "0x51376b77d9944bb9c5685b9d9289dd08D399B5e1", + "WitOracleRequestFactoryDefault": "0xB06a2fEc3Dc38b6f8Ce6337317Fcd4aAB00FE773", + "WitOracleTrustableDefault": "0x90A31c3f10391bd0f69a436473C96AAEe4DF0A5e", "WitPriceFeedsV21": "0x8280929b7F6adcE1CfA15b63cbEC1A7FD8cAEf11" } } \ No newline at end of file diff --git a/migrations/constructorArgs.json b/migrations/constructorArgs.json index a6090948..c7feca4b 100644 --- a/migrations/constructorArgs.json +++ b/migrations/constructorArgs.json @@ -1,202 +1,202 @@ { "default": { - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", - "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31322d61653734633030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31322d61653734633030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRandomnessV2": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000f121b71715e71dded592f1125a06d4ed06f0694d", - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", - "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitOracleRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" }, "arbitrum:one": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "avalanche:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "base:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "boba:bnb:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "boba:bnb:testnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000", - "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000", + "WitOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d34643165343634000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "boba:eth:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "celo:alfajores": { - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64383461343832000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64383461343832000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "celo:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "conflux:core:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryCfxCore": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db746300000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "0000000000000000000000008dadc231c8c810cbbe2d555338bda94da648f96400000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryCfxCore": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db746300000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "0000000000000000000000008dadc231c8c810cbbe2d555338bda94da648f96400000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRandomnessV2": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000001169bf81ecf738d02fd8d3824dfe02153b334ef7" }, "conflux:core:testnet": { - "WitnetRequestFactoryCfxCore": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db746300000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "0000000000000000000000008dadc231c8c810cbbe2d555338bda94da648f96400000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRequestFactoryCfxCore": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db746300000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitOracleTrustableDefault": "0000000000000000000000008dadc231c8c810cbbe2d555338bda94da648f96400000000000000000000000085d3e5577f947bca1a12c00940087129a5f8b2eb0000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRandomnessV2": "0000000000000000000000008346d6ba3b7a04923492007cc3a2ee7135db74630000000000000000000000001169bf81ecf738d02fd8d3824dfe02153b334ef7" }, "conflux:espace:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "conflux:espace:testnet": { - "WitnetRequestFactoryCfxCore": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" + "WitOracleRequestFactoryCfxCore": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" }, "cronos:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "dogechain:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "elastos:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "ethereum:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31352d32623837306334000000000000000000000000000000000000" }, "kava:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "kava:testnet": { - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "kcc:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "kcc:testnet": { - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "klaytn:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "klaytn:testnet": { - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "mantle:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "meter:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryCfxCore": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc8000000000000000000000000ba84d2ffa26c8fc7ef2c5bd4839b4b2e4d56d3300000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000c5074dde3fea0347d3b2e8c38e58e6a34feef8ef000000000000000000000000ba84d2ffa26c8fc7ef2c5bd4839b4b2e4d56d3300000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryCfxCore": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc8000000000000000000000000ba84d2ffa26c8fc7ef2c5bd4839b4b2e4d56d3300000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000c5074dde3fea0347d3b2e8c38e58e6a34feef8ef000000000000000000000000ba84d2ffa26c8fc7ef2c5bd4839b4b2e4d56d3300000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc80000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", "WitnetRandomnessV2": "0000000000000000000000001f28e4d955ecce989c00b3871446ab22b3fa9cc8000000000000000000000000e169bf81ecf738d02fd8d3824dfe02153b334ef7" }, "meter:testnet": { - "WitnetRequestFactoryDefault": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a000000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000d0b4512f4c9291de4104a1ad7be0c51956044bbc00000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRequestFactoryDefault": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a000000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000d0b4512f4c9291de4104a1ad7be0c51956044bbc00000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a00000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000", "WitnetRandomnessV2": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a0000000000000000000000000e169bf81ecf738d02fd8d3824dfe02153b334ef7", - "WitnetRequestFactoryCfxCore": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a000000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" + "WitOracleRequestFactoryCfxCore": "00000000000000000000000051e12a16d52de519f7b13bfeda42fb61214d32a000000000000000000000000087e25ad751306b21f9345494f163122e057b7b530000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000" }, "moonbeam:moonbase": { - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31352d64626234666331000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "moonbeam:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "moonbeam:moonriver": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "optimism:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "polygon:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "polygon:zkevm:mainnet": { - "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "reef:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d34333966396166000000000000000000000000000000000000" + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31352d34333966396166000000000000000000000000000000000000" }, "scroll:mainnet": { - "WitnetRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryNoSha256": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" }, "syscoin:rollux:testnet": { - "WitnetOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" + "WitOracleTrustableOvm2": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "ten:testnet": { - "WitnetOracleTrustableObscuro": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" + "WitOracleTrustableObscuro": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d34386336646436000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20" }, "ultron:mainnet": { - "WitnetRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", - "WitnetOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", + "WitOracleRadonRegistryDefault": "0000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleRequestFactoryDefault": "00000000000000000000000077703ae126b971c9946d562f41dd47071da00777000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000", + "WitOracleTrustableDefault": "000000000000000000000000000db36997af1f02209a6f995883b9b699900000000000000000000000000000000b61fe075f545fd37767f403916582759000000000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e3aa000000000000000000000000000000000000000000000000000000000000fef90000000000000000000000000000000000000000000000000000000000010faa0000000000000000000000000000000000000000000000000000000000004e20", "WitPriceFeedsV21": "00000000000000000000000077703ae126b971c9946d562f41dd47071da007770000000000000000000000000000000000000000000000000000000000000001322e302e31342d64313036336562000000000000000000000000000000000000" } } \ No newline at end of file diff --git a/migrations/scripts/2_libs.js b/migrations/scripts/2_libs.js index 5c0cc0db..f83b9eae 100644 --- a/migrations/scripts/2_libs.js +++ b/migrations/scripts/2_libs.js @@ -9,10 +9,10 @@ module.exports = async function (_, network, [, from]) { const targets = settings.getArtifacts(network) const libs = [ - targets.WitnetErrorsLib, - targets.WitnetEncodingLib, - targets.WitnetPriceFeedsLib, - targets.WitnetOracleDataLib, + targets.WitPriceFeedsLib, + targets.WitOracleDataLib, + targets.WitOracleRadonEncodingLib, + targets.WitOracleResultErrorsLib, ] const selection = utils.getWitnetArtifactsFromArgs() diff --git a/migrations/scripts/3_core.js b/migrations/scripts/3_core.js index 2f17391d..61853a25 100644 --- a/migrations/scripts/3_core.js +++ b/migrations/scripts/3_core.js @@ -14,15 +14,15 @@ module.exports = async function (_, network, [, from]) { const targets = settings.getArtifacts(network) // ========================================================================== - // --- WitnetRadonRegistry core implementation --------------------------- + // --- WitOracleRadonRegistry core implementation --------------------------- await deploy({ network, targets, - from: utils.isDryRun(network) ? from : specs.WitnetRadonRegistry.from || from, - key: targets.WitnetRadonRegistry, - libs: specs.WitnetRadonRegistry.libs, - immutables: specs.WitnetRadonRegistry.immutables, + from: utils.isDryRun(network) ? from : specs.WitOracleRadonRegistry.from || from, + key: targets.WitOracleRadonRegistry, + libs: specs.WitOracleRadonRegistry.libs, + immutables: specs.WitOracleRadonRegistry.immutables, intrinsics: { types: ["bool", "bytes32"], values: [ @@ -33,19 +33,19 @@ module.exports = async function (_, network, [, from]) { }) // ========================================================================== - // --- WitnetRequestFactory core implementation ----------------------------- + // --- WitOracleRequestFactory core implementation ----------------------------- await deploy({ network, targets, - from: utils.isDryRun(network) ? from : specs.WitnetRequestFactory.from || from, - key: targets.WitnetRequestFactory, - libs: specs.WitnetRequestFactory.libs, - immutables: specs.WitnetRequestFactory.immutables, + from: utils.isDryRun(network) ? from : specs.WitOracleRequestFactory.from || from, + key: targets.WitOracleRequestFactory, + libs: specs.WitOracleRequestFactory.libs, + immutables: specs.WitOracleRequestFactory.immutables, intrinsics: { types: ["address", "address", "bool", "bytes32"], values: [ - /* _witnet */ await determineProxyAddr(from, specs.WitnetOracle?.vanity || 3), + /* _witnet */ await determineProxyAddr(from, specs.WitOracle?.vanity || 3), /* _upgradable */ true, /* _versionTag */ utils.fromAscii(version), ], @@ -53,20 +53,20 @@ module.exports = async function (_, network, [, from]) { }) // ========================================================================== - // --- WitnetOracle core implementation --------------------------------- + // --- WitOracle core implementation --------------------------------- await deploy({ network, targets, - from: utils.isDryRun(network) ? from : specs.WitnetOracle.from || from, - key: targets.WitnetOracle, - libs: specs.WitnetOracle.libs, - immutables: specs.WitnetOracle.immutables, + from: utils.isDryRun(network) ? from : specs.WitOracle.from || from, + key: targets.WitOracle, + libs: specs.WitOracle.libs, + immutables: specs.WitOracle.immutables, intrinsics: { types: ["address", "address", "bool", "bytes32"], values: [ - /* _registry */ await determineProxyAddr(from, specs.WitnetRadonRegistry?.vanity || 1), - /* _factory */ await determineProxyAddr(from, specs.WitnetRequestFactory?.vanity || 2), + /* _registry */ await determineProxyAddr(from, specs.WitOracleRadonRegistry?.vanity || 1), + /* _factory */ await determineProxyAddr(from, specs.WitOracleRequestFactory?.vanity || 2), /* _upgradable */ true, /* _versionTag */ utils.fromAscii(version), ], @@ -74,19 +74,19 @@ module.exports = async function (_, network, [, from]) { }) // ========================================================================== - // --- WitnetPriceFeeds core implementation --------------------------------- + // --- WitPriceFeeds core implementation --------------------------------- await deploy({ network, targets, - from: utils.isDryRun(network) ? from : specs.WitnetPriceFeeds.from || from, - key: targets.WitnetPriceFeeds, - libs: specs.WitnetPriceFeeds.libs, - immutables: specs.WitnetPriceFeeds.immutables, + from: utils.isDryRun(network) ? from : specs.WitPriceFeeds.from || from, + key: targets.WitPriceFeeds, + libs: specs.WitPriceFeeds.libs, + immutables: specs.WitPriceFeeds.immutables, intrinsics: { types: ["address", "bool", "bytes32"], values: [ - /* _witnet */ await determineProxyAddr(from, specs.WitnetOracle?.vanity || 3), + /* _witnet */ await determineProxyAddr(from, specs.WitOracle?.vanity || 3), /* _upgradable */ true, /* _versionTag */ utils.fromAscii(version), ], diff --git a/migrations/scripts/4_proxies.js b/migrations/scripts/4_proxies.js index 2c461dc8..d3266029 100644 --- a/migrations/scripts/4_proxies.js +++ b/migrations/scripts/4_proxies.js @@ -17,17 +17,17 @@ module.exports = async function (_, network, [, from, reporter]) { const specs = settings.getSpecs(network) const singletons = [ - "WitnetRadonRegistry", - "WitnetRequestFactory", - "WitnetOracle", - "WitnetPriceFeeds", + "WitOracleRadonRegistry", + "WitOracleRequestFactory", + "WitOracle", + "WitPriceFeeds", ] // inject `reporter` within array of addresses as first initialization args - specs.WitnetOracle.mutables = merge({ + specs.WitOracle.mutables = merge({ types: ["address[]"], values: [[reporter]], - }, specs.WitnetOracle.mutables + }, specs.WitOracle.mutables ) // Deploy/upgrade singleton proxies, if required diff --git a/migrations/scripts/5_apps.js b/migrations/scripts/5_apps.js index 4d955307..48bbd50b 100644 --- a/migrations/scripts/5_apps.js +++ b/migrations/scripts/5_apps.js @@ -19,14 +19,14 @@ module.exports = async function (_, network, [, from]) { await deploy({ network, targets, - from: utils.isDryRun(network) ? from : specs.WitnetRandomness.from || from, - key: "WitnetRandomness", - specs: specs.WitnetRandomness, + from: utils.isDryRun(network) ? from : specs.WitRandomness.from || from, + key: "WitRandomness", + specs: specs.WitRandomness, intrinsics: { types: ["address", "address"], values: [ - /* _witnetOracle */ await determineProxyAddr(from, specs.WitnetOracle?.vanity || 3), - /* _witnetOperator */ utils.isDryRun(network) ? from : specs?.WitnetRandomness?.from || from, + /* _witOracle */ await determineProxyAddr(from, specs.WitOracle?.vanity || 3), + /* _witnetOperator */ utils.isDryRun(network) ? from : specs?.WitRandomness?.from || from, ], }, }) diff --git a/package.json b/package.json index 9876f85d..a49c3d8d 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "flatten:all": "pnpm run clean && pnpm run flatten:core && pnpm run flatten:apps && pnpm run flatten:libs && pnpm run flatten:proxy", "flatten:apps": "pnpm run flatten contracts/apps/", "flatten:core": "pnpm run flatten contracts/core/", - "flatten:libs": "pnpm run flatten contracts/libs/WitnetErrorsLib.sol && pnpm run flatten contracts/libs/WitnetEncodingLib.sol && pnpm run flatten contracts/libs/WitnetPriceFeedsLib.sol", + "flatten:libs": "pnpm run flatten contracts/libs/WitOracleResultErrorsLib.sol && pnpm run flatten contracts/libs/WitOracleRadonEncodingLib.sol && pnpm run flatten contracts/libs/WitPriceFeedsLib.sol", "flatten:proxy": "pnpm run flatten contracts/core/WitnetProxy.sol", "fmt:js": "eslint \"**/*.js\"", "fmt:sol": "solhint --max-warnings 0 \"contracts/**/*.sol\" && solhint \"test/**/*.sol\" && solhint \"flattened/**/*.sol\"", diff --git a/scripts/verify-apps.js b/scripts/verify-apps.js index 8914ca45..5b8d07a9 100644 --- a/scripts/verify-apps.js +++ b/scripts/verify-apps.js @@ -18,7 +18,7 @@ console.info() const artifacts = settings.getArtifacts(network) const apps = [ - artifacts.WitnetRandomness, + artifacts.WitRandomness, ] const constructorArgs = require("../migrations/constructorArgs.json") if (!constructorArgs[network]) constructorArgs[network] = {} diff --git a/scripts/verify-core.js b/scripts/verify-core.js index b89fe4cf..88f32d19 100644 --- a/scripts/verify-core.js +++ b/scripts/verify-core.js @@ -21,10 +21,10 @@ utils.traceVerify(network, "WitnetProxy") const addresses = require("../migrations/addresses.json") const singletons = [ - "WitnetOracle", - "WitnetPriceFeeds", - "WitnetRadonRegistry", - "WitnetRequestFactory", + "WitOracle", + "WitPriceFeeds", + "WitOracleRadonRegistry", + "WitOracleRequestFactory", ] for (const index in singletons) { utils.traceVerify(network, `WitnetProxy@${ diff --git a/scripts/verify-impls.js b/scripts/verify-impls.js index 33fd4160..bd7bc4c1 100644 --- a/scripts/verify-impls.js +++ b/scripts/verify-impls.js @@ -18,10 +18,10 @@ console.info() const artifacts = settings.getArtifacts(network) const impls = [ - artifacts.WitnetOracle, - artifacts.WitnetPriceFeeds, - artifacts.WitnetRadonRegistry, - artifacts.WitnetRequestFactory, + artifacts.WitOracle, + artifacts.WitPriceFeeds, + artifacts.WitOracleRadonRegistry, + artifacts.WitOracleRequestFactory, ] const constructorArgs = require("../migrations/constructorArgs.json") if (!constructorArgs[network]) constructorArgs[network] = {} diff --git a/scripts/verify-libs.js b/scripts/verify-libs.js index 4bd45089..06829182 100644 --- a/scripts/verify-libs.js +++ b/scripts/verify-libs.js @@ -19,10 +19,10 @@ console.info() const addresses = require("../migrations/addresses.json") const artifacts = settings.getArtifacts(network) const libs = [ - artifacts.WitnetEncodingLib, - artifacts.WitnetErrorsLib, - artifacts.WitnetOracleDataLib, - artifacts.WitnetPriceFeedsLib, + artifacts.WitOracleRadonEncodingLib, + artifacts.WitOracleResultErrorsLib, + artifacts.WitOracleDataLib, + artifacts.WitPriceFeedsLib, ] for (const index in libs) { utils.traceVerify(network, `${libs[index]}@${addresses[network][libs[index]]}`) diff --git a/settings/artifacts.js b/settings/artifacts.js index 587a0b95..a8f84e28 100644 --- a/settings/artifacts.js +++ b/settings/artifacts.js @@ -1,65 +1,65 @@ module.exports = { default: { WitnetDeployer: "WitnetDeployer", - WitnetOracle: "WitnetOracleTrustableDefault", - WitnetPriceFeeds: "WitPriceFeedsV21", - WitnetRandomness: "WitRandomnessV21", - WitnetRadonRegistry: "WitnetRadonRegistryDefault", - WitnetRequestFactory: "WitnetRequestFactoryDefault", - WitnetEncodingLib: "WitnetEncodingLib", - WitnetErrorsLib: "WitnetErrorsLib", - WitnetPriceFeedsLib: "WitnetPriceFeedsLib", - WitnetOracleDataLib: "WitnetOracleDataLib", + WitOracle: "WitOracleTrustableDefault", + WitPriceFeeds: "WitPriceFeedsV21", + WitRandomness: "WitRandomnessV21", + WitOracleRadonRegistry: "WitOracleRadonRegistryDefault", + WitOracleRequestFactory: "WitOracleRequestFactoryDefault", + WitOracleRadonEncodingLib: "WitOracleRadonEncodingLib", + WitOracleResultErrorsLib: "WitOracleResultErrorsLib", + WitPriceFeedsLib: "WitPriceFeedsLib", + WitOracleDataLib: "WitOracleDataLib", }, base: { - WitnetOracle: "WitnetOracleTrustableOvm2", + WitOracle: "WitOracleTrustableOvm2", }, boba: { - WitnetOracle: "WitnetOracleTrustableOvm2", + WitOracle: "WitOracleTrustableOvm2", }, "conflux:core:testnet": { WitnetDeployer: "WitnetDeployerCfxCore", - WitnetRequestFactory: "WitnetRequestFactoryCfxCore", + WitOracleRequestFactory: "WitOracleRequestFactoryCfxCore", }, "conflux:core:mainnet": { WitnetDeployer: "WitnetDeployerCfxCore", - WitnetRequestFactory: "WitnetRequestFactoryCfxCore", + WitOracleRequestFactory: "WitOracleRequestFactoryCfxCore", }, mantle: { - WitnetOracle: "WitnetOracleTrustableOvm2", + WitOracle: "WitOracleTrustableOvm2", }, meter: { WitnetDeployer: "WitnetDeployerMeter", - WitnetRequestFactory: "WitnetRequestFactoryCfxCore", + WitOracleRequestFactory: "WitOracleRequestFactoryCfxCore", }, optimism: { - WitnetOracle: "WitnetOracleTrustableOvm2", + WitOracle: "WitOracleTrustableOvm2", }, "okx:x1:mainnet": { - WitnetRadonRegistry: "WitnetRadonRegistryNoSha256", + WitOracleRadonRegistry: "WitOracleRadonRegistryNoSha256", }, "okx:x1:sepolia": { - WitnetRadonRegistry: "WitnetRadonRegistryNoSha256", + WitOracleRadonRegistry: "WitOracleRadonRegistryNoSha256", }, "polygon:zkevm:goerli": { - WitnetRadonRegistry: "WitnetRadonRegistryNoSha256", + WitOracleRadonRegistry: "WitOracleRadonRegistryNoSha256", }, "polygon:zkevm:mainnet": { - WitnetRadonRegistry: "WitnetRadonRegistryNoSha256", + WitOracleRadonRegistry: "WitOracleRadonRegistryNoSha256", }, reef: { - WitnetOracle: "WitnetOracleTrustableReef", + WitOracle: "WitOracleTrustableReef", }, scroll: { - WitnetRadonRegistry: "WitnetRadonRegistryNoSha256", + WitOracleRadonRegistry: "WitOracleRadonRegistryNoSha256", }, "syscoin:rollux:testnet": { - WitnetOracle: "WitnetOracleTrustableOvm2", + WitOracle: "WitOracleTrustableOvm2", }, "syscoin:rollux:mainnet": { - WitnetOracle: "WitnetOracleTrustableOvm2", + WitOracle: "WitOracleTrustableOvm2", }, ten: { - WitnetOracle: "WitnetOracleTrustableObscuro", + WitOracle: "WitOracleTrustableObscuro", }, } diff --git a/settings/specs.js b/settings/specs.js index 2c2b344d..2f7d865e 100644 --- a/settings/specs.js +++ b/settings/specs.js @@ -1,6 +1,6 @@ module.exports = { default: { - WitnetOracle: { + WitOracle: { immutables: { types: ["uint256", "uint256", "uint256", "uint256"], values: [ @@ -10,23 +10,23 @@ module.exports = { /* _sstoreFromZeroGas */ 20000, ], }, - libs: ["WitnetErrorsLib", "WitnetOracleDataLib"], + libs: ["WitOracleResultErrorsLib", "WitOracleDataLib"], vanity: 13710368043, // 0x77703aE126B971c9946d562F41Dd47071dA00777 }, - WitnetPriceFeeds: { + WitPriceFeeds: { from: "0xF121b71715E71DDeD592F1125a06D4ED06F0694D", - libs: ["WitnetPriceFeedsLib"], + libs: ["WitPriceFeedsLib"], vanity: 1865150170, // 0x1111AbA2164AcdC6D291b08DfB374280035E1111 }, - WitnetRandomness: { + WitRandomness: { from: "0xF121b71715E71DDeD592F1125a06D4ED06F0694D", vanity: 1060132513, // 0xC0FFEE98AD1434aCbDB894BbB752e138c1006fAB }, - WitnetRadonRegistry: { - libs: ["WitnetEncodingLib"], + WitOracleRadonRegistry: { + libs: ["WitOracleRadonEncodingLib"], vanity: 6765579443, // 0x000B61Fe075F545fd37767f40391658275900000 }, - WitnetRequestFactory: { + WitOracleRequestFactory: { vanity: 1240014136, // 0x000DB36997AF1F02209A6F995883B9B699900000 }, }, @@ -34,21 +34,21 @@ module.exports = { WitnetDeployer: { from: "0x1169bf81ecf738d02fd8d3824dfe02153b334ef7", }, - WitnetOracle: { + WitOracle: { vanity: 3, }, - WitnetPriceFeeds: { + WitPriceFeeds: { from: "0x1169bf81ecf738d02fd8d3824dfe02153b334ef7", vanity: 4, }, - WitnetRandomness: { + WitRandomness: { from: "0x1169bf81ecf738d02fd8d3824dfe02153b334ef7", vanity: 5, }, - WitnetRadonRegistry: { + WitOracleRadonRegistry: { vanity: 1, }, - WitnetRequestFactory: { + WitOracleRequestFactory: { vanity: 2, }, }, @@ -56,21 +56,21 @@ module.exports = { WitnetDeployer: { from: "0x1169Bf81ecf738d02fd8d3824dfe02153B334eF7", }, - WitnetOracle: { + WitOracle: { vanity: 3, }, - WitnetPriceFeeds: { + WitPriceFeeds: { from: "0x1169Bf81ecf738d02fd8d3824dfe02153B334eF7", vanity: 4, }, - WitnetRandomness: { + WitRandomness: { from: "0x1169Bf81ecf738d02fd8d3824dfe02153B334eF7", vanity: 5, }, - WitnetRadonRegistry: { + WitOracleRadonRegistry: { vanity: 1, }, - WitnetRequestFactory: { + WitOracleRequestFactory: { vanity: 2, }, }, @@ -78,10 +78,10 @@ module.exports = { WitnetDeployer: { from: "0xE169Bf81Ecf738d02fD8d3824DFe02153b334eF7", }, - WitnetPriceFeeds: { + WitPriceFeeds: { from: "0xE169Bf81Ecf738d02fD8d3824DFe02153b334eF7", }, - WitnetRandomness: { + WitRandomness: { from: "0xE169Bf81Ecf738d02fD8d3824DFe02153b334eF7", }, }, @@ -89,17 +89,17 @@ module.exports = { WitnetDeployer: { from: "0xB309D64D6535E95eDBA9A899A8a8D11f1BEC9357", }, - WitnetPriceFeeds: { + WitPriceFeeds: { from: "0xB309D64D6535E95eDBA9A899A8a8D11f1BEC9357", }, - WitnetOracle: { + WitOracle: { immutables: { values: [ /* _reportResultGasBase */ "0x3100A1CAC7EF19DC", ], }, }, - WitnetRandomness: { + WitRandomness: { from: "0xB309D64D6535E95eDBA9A899A8a8D11f1BEC9357", }, }, diff --git a/src/index.js b/src/index.js index 1dc4c6f8..a72cf93e 100644 --- a/src/index.js +++ b/src/index.js @@ -11,8 +11,8 @@ module.exports = { addresses[net], ) return { - WitnetOracle: merged?.WitnetOracle, - WitnetPriceFeeds: merged?.WitnetPriceFeeds, + WitOracle: merged?.WitOracle, + WitPriceFeeds: merged?.WitPriceFeeds, WitRandomnessV21: merged?.WitRandomnessV21, } } else { @@ -31,14 +31,14 @@ module.exports = { }, supportedNetworks, artifacts: { - WitnetOracle: require("../artifacts/contracts/WitnetOracle.sol/WitnetOracle.json"), - WitnetPriceFeeds: require("../artifacts/contracts/WitnetPriceFeeds.sol/WitnetPriceFeeds.json"), - WitnetPriceRouteSolver: require("../artifacts/contracts/interfaces/IWitnetPriceFeedsSolver.sol/IWitnetPriceFeedsSolver.json"), - WitnetRandomness: require("../artifacts/contracts/WitnetRandomness.sol/WitnetRandomness.json"), - WitnetRequest: require("../artifacts/contracts/WitnetRequest.sol/WitnetRequest.json"), - WitnetRadonRegistry: require("../artifacts/contracts/WitnetRadonRegistry.sol/WitnetRadonRegistry.json"), - WitnetRequestFactory: require("../artifacts/contracts/WitnetRequestFactory.sol/WitnetRequestFactory.json"), - WitnetRequestTemplate: require("../artifacts/contracts/WitnetRequestTemplate.sol/WitnetRequestTemplate.json"), + WitOracle: require("../artifacts/contracts/WitOracle.sol/WitOracle.json"), + WitPriceFeeds: require("../artifacts/contracts/WitPriceFeeds.sol/WitPriceFeeds.json"), + WitnetPriceRouteSolver: require("../artifacts/contracts/interfaces/IWitPriceFeedsSolver.sol/IWitPriceFeedsSolver.json"), + WitRandomness: require("../artifacts/contracts/WitRandomness.sol/WitRandomness.json"), + WitOracleRequest: require("../artifacts/contracts/WitOracleRequest.sol/WitOracleRequest.json"), + WitOracleRadonRegistry: require("../artifacts/contracts/WitOracleRadonRegistry.sol/WitOracleRadonRegistry.json"), + WitOracleRequestFactory: require("../artifacts/contracts/WitOracleRequestFactory.sol/WitOracleRequestFactory.json"), + WitOracleRequestTemplate: require("../artifacts/contracts/WitOracleRequestTemplate.sol/WitOracleRequestTemplate.json"), WitnetUpgradableBase: require("../artifacts/contracts/core/WitnetUpgradableBase.sol/WitnetUpgradableBase.json"), }, settings: require("../settings"), diff --git a/test/TestWitnetEncodingLib.sol b/test/TestWitOracleRadonEncodingLib.sol similarity index 77% rename from test/TestWitnetEncodingLib.sol rename to test/TestWitOracleRadonEncodingLib.sol index 9eeef9c4..b7e8cecf 100644 --- a/test/TestWitnetEncodingLib.sol +++ b/test/TestWitOracleRadonEncodingLib.sol @@ -4,17 +4,17 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "truffle/Assert.sol"; -import "../contracts/libs/WitnetEncodingLib.sol"; +import "../contracts/libs/WitOracleRadonEncodingLib.sol"; -contract TestWitnetEncodingLib { +contract TestWitOracleRadonEncodingLib { - using WitnetEncodingLib for string; + using WitOracleRadonEncodingLib for string; // event Log(bytes data); // event Log(bytes data, uint256 length); function testEncodeTaggedVarint() external { - bytes memory bytecode = WitnetEncodingLib.encode(10 ** 6, bytes1(0x10)); + bytes memory bytecode = WitOracleRadonEncodingLib.encode(10 ** 6, bytes1(0x10)); Assert.equal( keccak256(bytecode), keccak256(hex"10c0843d"), @@ -23,7 +23,7 @@ contract TestWitnetEncodingLib { } function testEncodeString() external { - bytes memory bytecode = WitnetEncodingLib.encode(string("witnet")); + bytes memory bytecode = WitOracleRadonEncodingLib.encode(string("witnet")); Assert.equal( keccak256(bytecode), keccak256(hex"667769746E6574"), @@ -32,7 +32,7 @@ contract TestWitnetEncodingLib { } function testEncodeBytes() external { - bytes memory bytecode = WitnetEncodingLib.encode(bytes("witnet")); + bytes memory bytecode = WitOracleRadonEncodingLib.encode(bytes("witnet")); Assert.equal( keccak256(bytecode), keccak256(hex"467769746E6574"), @@ -41,7 +41,7 @@ contract TestWitnetEncodingLib { } function testEncodeRadonReducerOpcodes() external { - bytes memory bytecode = WitnetEncodingLib.encode( + bytes memory bytecode = WitOracleRadonEncodingLib.encode( Witnet.RadonReduceOpcodes.StandardDeviation ); Assert.equal( @@ -52,7 +52,7 @@ contract TestWitnetEncodingLib { } function testEncodeRadonSLA() external { - bytes memory bytecode = WitnetEncodingLib.encode( + bytes memory bytecode = WitOracleRadonEncodingLib.encode( Witnet.RadonSLAv1({ numWitnesses: 10, minConsensusPercentage: 51, @@ -75,7 +75,7 @@ contract TestWitnetEncodingLib { reducer.filters = new Witnet.RadonFilter[](1); reducer.filters[0].opcode = Witnet.RadonFilterOpcodes.StandardDeviation; reducer.filters[0].cborArgs = hex"fa40200000"; - bytes memory bytecode = WitnetEncodingLib.encode(reducer); + bytes memory bytecode = WitOracleRadonEncodingLib.encode(reducer); // emit Log(bytecode); Assert.equal( keccak256(bytecode), @@ -89,7 +89,7 @@ contract TestWitnetEncodingLib { source.method = Witnet.RadonRetrievalMethods.HttpGet; source.url = "https://data.messar.io/api/v1/assets/\\0\\/metrics/market-data?fields=market_data/price_\\1\\"; source.script = hex"861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b"; - bytes memory bytecode = WitnetEncodingLib.encode(source); + bytes memory bytecode = WitOracleRadonEncodingLib.encode(source); // emit Log(bytecode); Assert.equal( keccak256(bytecode), @@ -107,7 +107,7 @@ contract TestWitnetEncodingLib { source.headers[0] = [ "user-agent", "witnet-rust" ]; source.headers[1] = [ "content-type", "text/html; charset=utf-8" ]; source.script = hex"861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b"; - bytes memory bytecode = WitnetEncodingLib.encode(source); + bytes memory bytecode = WitOracleRadonEncodingLib.encode(source); // emit Log(bytecode); Assert.equal( keccak256(bytecode), @@ -122,7 +122,7 @@ contract TestWitnetEncodingLib { // emit Log(radon, radon.length); string[] memory args = new string[](1); args[0] = "token1Price"; - bytes memory newradon = WitnetEncodingLib.replaceCborStringsFromBytes(radon, args); + bytes memory newradon = WitOracleRadonEncodingLib.replaceCborStringsFromBytes(radon, args); // emit Log(newradon, newradon.length); Assert.equal( keccak256(newradon), @@ -133,7 +133,7 @@ contract TestWitnetEncodingLib { function testVerifyRadonScriptOk1() external { Assert.equal( - uint(WitnetEncodingLib.verifyRadonScriptResultDataType(hex"861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b")), + uint(WitOracleRadonEncodingLib.verifyRadonScriptResultDataType(hex"861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b")), uint(Witnet.RadonDataTypes.Integer), "unexpected result data type" ); @@ -141,7 +141,7 @@ contract TestWitnetEncodingLib { function testVerifyRadonScriptOk2() external { Assert.equal( - uint(WitnetEncodingLib.verifyRadonScriptResultDataType(hex"80")), + uint(WitOracleRadonEncodingLib.verifyRadonScriptResultDataType(hex"80")), uint(Witnet.RadonDataTypes.Any), "unexpected result data type" ); @@ -149,7 +149,7 @@ contract TestWitnetEncodingLib { function testVerifyRadonScriptOk3() external { Assert.equal( - uint(WitnetEncodingLib.verifyRadonScriptResultDataType(hex"8218778218676445746167")), + uint(WitOracleRadonEncodingLib.verifyRadonScriptResultDataType(hex"8218778218676445746167")), uint(Witnet.RadonDataTypes.String), "unexpected result data type" ); @@ -157,7 +157,7 @@ contract TestWitnetEncodingLib { function testVerifyRadonScriptOk4() external { Assert.equal( - uint(WitnetEncodingLib.verifyRadonScriptResultDataType(hex"880B821866646461746182186165706169727382118282186762696483187582635C305CF5F4821818F48218646D746F6B656E5C315C50726963658218571A000F4240185B")), + uint(WitOracleRadonEncodingLib.verifyRadonScriptResultDataType(hex"880B821866646461746182186165706169727382118282186762696483187582635C305CF5F4821818F48218646D746F6B656E5C315C50726963658218571A000F4240185B")), uint(Witnet.RadonDataTypes.Integer), "unexpected result data type" ); @@ -165,7 +165,7 @@ contract TestWitnetEncodingLib { function testVerifyRadonScriptOk5() external { Assert.equal( - uint(WitnetEncodingLib.verifyRadonScriptResultDataType(hex"851876821182821867657469746c65831875a1635c315cf5f4821183821867696d65726765645f617418748218430082181800821867657374617465")), + uint(WitOracleRadonEncodingLib.verifyRadonScriptResultDataType(hex"851876821182821867657469746c65831875a1635c315cf5f4821183821867696d65726765645f617418748218430082181800821867657374617465")), uint(Witnet.RadonDataTypes.String), "unexpected result data type" ); diff --git a/test/TestWitnetV2.sol b/test/TestWitnetV2.sol index 71d6b2e0..8b399c4b 100644 --- a/test/TestWitnetV2.sol +++ b/test/TestWitnetV2.sol @@ -21,7 +21,7 @@ contract TestWitnetV2 { __finalityBlock = block.number; } - function testWitnetRequestPackingWithBytecode() external { + function testWitOracleRequestPackingWithBytecode() external { __request = Witnet.Request({ requester: msg.sender, gasCallback: 500000, @@ -36,11 +36,11 @@ contract TestWitnetV2 { }); } - function testWitnetRequestUnpackingWithBytecode() external returns (Witnet.Request memory) { + function testWitOracleRequestUnpackingWithBytecode() external returns (Witnet.Request memory) { return __request; } - function testWitnetRequestPackingWithRadHash() external { + function testWitOracleRequestPackingWithRadHash() external { __request = Witnet.Request({ requester: msg.sender, gasCallback: 500000, @@ -55,7 +55,7 @@ contract TestWitnetV2 { }); } - function testWitnetRequestUnpackingWithRadHash() external returns (Witnet.Request memory) { + function testWitOracleRequestUnpackingWithRadHash() external returns (Witnet.Request memory) { return __request; } diff --git a/test/mocks/MyDapp.sol b/test/mocks/MyDapp.sol index 8c4dca6b..37e19b05 100644 --- a/test/mocks/MyDapp.sol +++ b/test/mocks/MyDapp.sol @@ -3,11 +3,11 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../../contracts/apps/WitnetRandomnessRequestConsumer.sol"; +import "../../contracts/mocks/WitRandomnessRequestConsumer.sol"; contract MyDapp is - WitnetRandomnessRequestConsumer + WitRandomnessRequestConsumer { using WitnetCBOR for WitnetCBOR.CBOR; @@ -28,8 +28,8 @@ contract MyDapp uint256 private immutable __randomizeValue; - constructor(WitnetOracle _wrb, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit) - WitnetRandomnessRequestConsumer( + constructor(WitOracle _wrb, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit) + WitRandomnessRequestConsumer( _wrb, _baseFeeOverheadPercentage, _callbackGasLimit @@ -55,10 +55,10 @@ contract MyDapp } } - /// @notice Method to be called from the WitnetOracle contract as soon as the given Witnet `queryId` + /// @notice Method to be called from the WitOracle contract as soon as the given Witnet `queryId` /// @notice gets reported, if reported with no errors. - /// @dev It should revert if called from any other address different to the WitnetOracle being used - /// @dev by the WitnetConsumer contract. Within the implementation of this method, the WitnetConsumer + /// @dev It should revert if called from any other address different to the WitOracle being used + /// @dev by the WitConsumer contract. Within the implementation of this method, the WitConsumer /// @dev can call to the WRB as to retrieve the Witnet tracking information (i.e. the `witnetDrTxHash` /// @dev and `witnetDrCommitTxTimestamp`), or the finality status, of the result being reported. function reportWitnetQueryResult( diff --git a/test/mocks/WitMockedOracle.sol b/test/mocks/WitMockedOracle.sol index 94cfd191..fa2c56a8 100644 --- a/test/mocks/WitMockedOracle.sol +++ b/test/mocks/WitMockedOracle.sol @@ -5,24 +5,24 @@ pragma experimental ABIEncoderV2; import "./WitMockedRadonRegistry.sol"; import "./WitMockedRequestFactory.sol"; -import "../../contracts/core/trustable/WitnetOracleTrustableDefault.sol"; +import "../../contracts/core/trustable/WitOracleTrustableDefault.sol"; import "./WitMockedPriceFeeds.sol"; import "./WitMockedRandomness.sol"; -/// @title Mocked implementation of `WitnetOracle`. +/// @title Mocked implementation of `WitOracle`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE -/// @dev THE `WitnetOracle` CONTRACT ADDRESS PROVIDED +/// @dev THE `WitOracle` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. contract WitMockedOracle is - WitnetOracleTrustableDefault + WitOracleTrustableDefault { constructor(WitMockedRadonRegistry _registry) - WitnetOracleTrustableDefault( - WitnetRadonRegistry(_registry), - WitnetRequestFactory(address(0)), + WitOracleTrustableDefault( + WitOracleRadonRegistry(_registry), + WitOracleRequestFactory(address(0)), false, bytes32("mocked"), 60000, 65000, 70000, 20000 diff --git a/test/mocks/WitMockedPriceFeeds.sol b/test/mocks/WitMockedPriceFeeds.sol index 8b86b8b6..002e6869 100644 --- a/test/mocks/WitMockedPriceFeeds.sol +++ b/test/mocks/WitMockedPriceFeeds.sol @@ -6,10 +6,10 @@ pragma experimental ABIEncoderV2; import "./WitMockedOracle.sol"; import "../../contracts/apps/WitPriceFeedsV21.sol"; -/// @title Mocked implementation of `WitnetPriceFeeds`. +/// @title Mocked implementation of `WitPriceFeeds`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE -/// @dev THE `WitnetPriceFeeds` CONTRACT ADDRESS PROVIDED +/// @dev THE `WitPriceFeeds` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. contract WitMockedPriceFeeds is WitPriceFeedsV21 { constructor(WitMockedOracle _wrb) diff --git a/test/mocks/WitMockedRadonRegistry.sol b/test/mocks/WitMockedRadonRegistry.sol index b604f7d9..d1876651 100644 --- a/test/mocks/WitMockedRadonRegistry.sol +++ b/test/mocks/WitMockedRadonRegistry.sol @@ -3,16 +3,16 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../../contracts/core/trustless/WitnetRadonRegistryDefault.sol"; +import "../../contracts/core/trustless/WitOracleRadonRegistryDefault.sol"; -/// @title Mocked implementation of `WitnetRadonRegistry`. +/// @title Mocked implementation of `WitOracleRadonRegistry`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE -/// @dev THE `WitnetRadonRegistry` CONTRACT ADDRESS PROVIDED +/// @dev THE `WitOracleRadonRegistry` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. -contract WitMockedRadonRegistry is WitnetRadonRegistryDefault { +contract WitMockedRadonRegistry is WitOracleRadonRegistryDefault { constructor() - WitnetRadonRegistryDefault( + WitOracleRadonRegistryDefault( false, bytes32("mocked") ) diff --git a/test/mocks/WitMockedRandomness.sol b/test/mocks/WitMockedRandomness.sol index 97f48e5e..90c3371a 100644 --- a/test/mocks/WitMockedRandomness.sol +++ b/test/mocks/WitMockedRandomness.sol @@ -6,10 +6,10 @@ pragma experimental ABIEncoderV2; import "./WitMockedOracle.sol"; import "../../contracts/apps/WitRandomnessV21.sol"; -/// @title Mocked implementation of `WitnetRandomness`. +/// @title Mocked implementation of `WitRandomness`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE -/// @dev THE `WitnetRandomness` CONTRACT ADDRESS PROVIDED +/// @dev THE `WitRandomness` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. contract WitMockedRandomness is WitRandomnessV21 { constructor(WitMockedOracle _wrb) diff --git a/test/mocks/WitMockedRequestFactory.sol b/test/mocks/WitMockedRequestFactory.sol index 48eeb16f..8e070688 100644 --- a/test/mocks/WitMockedRequestFactory.sol +++ b/test/mocks/WitMockedRequestFactory.sol @@ -4,20 +4,20 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; import "./WitMockedOracle.sol"; -import "../../contracts/core/trustless/WitnetRequestFactoryDefault.sol"; +import "../../contracts/core/trustless/WitOracleRequestFactoryDefault.sol"; -/// @title Mocked implementation of `WitnetRequestFactory`. +/// @title Mocked implementation of `WitOracleRequestFactory`. /// @dev TO BE USED ONLY ON DEVELOPMENT ENVIRONMENTS. /// @dev ON SUPPORTED TESTNETS AND MAINNETS, PLEASE USE -/// @dev THE `WitnetRequestFactory` CONTRACT ADDRESS PROVIDED +/// @dev THE `WitOracleRequestFactory` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. contract WitMockedRequestFactory is - WitnetRequestFactoryDefault + WitOracleRequestFactoryDefault { constructor (WitMockedOracle _wrb) - WitnetRequestFactoryDefault( - WitnetOracle(address(_wrb)), + WitOracleRequestFactoryDefault( + WitOracle(address(_wrb)), false, bytes32("mocked") ) diff --git a/test/witnet_bytecodes.test.js b/test/witnet_bytecodes.test.js index 0aae5227..ffc22c51 100644 --- a/test/witnet_bytecodes.test.js +++ b/test/witnet_bytecodes.test.js @@ -3,11 +3,11 @@ const { expectEvent, expectRevert } = require("@openzeppelin/test-helpers") const { assert } = require("chai") const { expectRevertCustomError } = require("custom-error-test-helper") -const WitnetRadonRegistry = artifacts.require("WitnetRadonRegistryDefault") -const WitnetEncodingLib = artifacts.require("WitnetEncodingLib") +const WitOracleRadonRegistry = artifacts.require("WitOracleRadonRegistryDefault") +const WitOracleRadonEncodingLib = artifacts.require("WitOracleRadonEncodingLib") const Witnet = artifacts.require("Witnet") -contract("WitnetRadonRegistry", (accounts) => { +contract("WitOracleRadonRegistry", (accounts) => { const creatorAddress = accounts[0] const firstOwnerAddress = accounts[1] const unprivilegedAddress = accounts[4] @@ -15,8 +15,8 @@ contract("WitnetRadonRegistry", (accounts) => { let bytecodes before(async () => { - await WitnetRadonRegistry.link(WitnetEncodingLib, WitnetEncodingLib.address) - bytecodes = await WitnetRadonRegistry.new( + await WitOracleRadonRegistry.link(WitOracleRadonEncodingLib, WitOracleRadonEncodingLib.address) + bytecodes = await WitOracleRadonRegistry.new( true, utils.fromAscii("testing") ) @@ -76,19 +76,19 @@ contract("WitnetRadonRegistry", (accounts) => { }) it("cannot be initialized more than once", async () => { await expectRevertCustomError( - WitnetRadonRegistry, + WitOracleRadonRegistry, bytecodes.initialize("0x", { from: firstOwnerAddress }), "AlreadyUpgraded" ) await expectRevertCustomError( - WitnetRadonRegistry, + WitOracleRadonRegistry, bytecodes.initialize("0x", { from: unprivilegedAddress }), "OnlyOwner" ) }) }) - context("IWitnetRadonRegistry", async () => { + context("IWitOracleRadonRegistry", async () => { let slaHash let concathashReducerHash @@ -658,7 +658,7 @@ contract("WitnetRadonRegistry", (accounts) => { context("radon requests", async () => { it("reverts if trying to get bytecode from unknown radon request", async () => { await expectRevertCustomError( - WitnetRadonRegistry, + WitOracleRadonRegistry, bytecodes.bytecodeOf("0x0"), "UnknownRadonRequest" ) @@ -673,7 +673,7 @@ contract("WitnetRadonRegistry", (accounts) => { context("radon slas", async () => { it("reverts if trying to get bytecode from unknown radon sla", async () => { await expectRevertCustomError( - WitnetRadonRegistry, + WitOracleRadonRegistry, bytecodes.bytecodeOf(btcUsdPriceFeedHash, "0x0"), "UnknownRadonSLA" ) @@ -699,14 +699,14 @@ contract("WitnetRadonRegistry", (accounts) => { context("hashWeightRewardOf(..)", async () => { it("hashing unknown radon request reverts", async () => { await expectRevertCustomError( - WitnetRadonRegistry, + WitOracleRadonRegistry, bytecodes.hashWeightWitsOf("0x0", slaHash), "UnknownRadonRequest" ) }) it("hashing unknown radon sla reverts", async () => { await expectRevertCustomError( - WitnetRadonRegistry, + WitOracleRadonRegistry, bytecodes.hashWeightWitsOf(btcUsdPriceFeedHash, "0x0"), "UnknownRadonSLA" ) From 3adc3b8585ae0353e8626d516fbde836e7f55419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Sun, 4 Aug 2024 16:24:47 +0200 Subject: [PATCH 22/39] refactor: rename contracts/mocks -> contracts/mockups --- .../{core/trustless => apps}/WitPriceFeedsSolverBase.sol | 4 ++-- contracts/apps/WitRandomnessV21.sol | 2 +- contracts/{mocks => mockups}/UsingWitOracle.sol | 0 contracts/{mocks => mockups}/UsingWitOracleRandomness.sol | 0 contracts/{mocks => mockups}/UsingWitOracleRequest.sol | 0 .../{mocks => mockups}/UsingWitOracleRequestTemplate.sol | 0 contracts/{mocks => mockups}/WitConsumer.sol | 0 contracts/{mocks => mockups}/WitOracleRequestConsumer.sol | 0 .../{mocks => mockups}/WitOracleRequestTemplateConsumer.sol | 0 contracts/{mocks => mockups}/WitRandomnessRequestConsumer.sol | 0 test/mocks/MyDapp.sol | 2 +- 11 files changed, 4 insertions(+), 4 deletions(-) rename contracts/{core/trustless => apps}/WitPriceFeedsSolverBase.sol (95%) rename contracts/{mocks => mockups}/UsingWitOracle.sol (100%) rename contracts/{mocks => mockups}/UsingWitOracleRandomness.sol (100%) rename contracts/{mocks => mockups}/UsingWitOracleRequest.sol (100%) rename contracts/{mocks => mockups}/UsingWitOracleRequestTemplate.sol (100%) rename contracts/{mocks => mockups}/WitConsumer.sol (100%) rename contracts/{mocks => mockups}/WitOracleRequestConsumer.sol (100%) rename contracts/{mocks => mockups}/WitOracleRequestTemplateConsumer.sol (100%) rename contracts/{mocks => mockups}/WitRandomnessRequestConsumer.sol (100%) diff --git a/contracts/core/trustless/WitPriceFeedsSolverBase.sol b/contracts/apps/WitPriceFeedsSolverBase.sol similarity index 95% rename from contracts/core/trustless/WitPriceFeedsSolverBase.sol rename to contracts/apps/WitPriceFeedsSolverBase.sol index 80195cb2..0ce11048 100644 --- a/contracts/core/trustless/WitPriceFeedsSolverBase.sol +++ b/contracts/apps/WitPriceFeedsSolverBase.sol @@ -2,8 +2,8 @@ pragma solidity >=0.8.0 <0.9.0; -import "../../data/WitPriceFeedsData.sol"; -import "../../interfaces/IWitPriceFeeds.sol"; +import "../data/WitPriceFeedsData.sol"; +import "../interfaces/IWitPriceFeeds.sol"; abstract contract WitPriceFeedsSolverBase is diff --git a/contracts/apps/WitRandomnessV21.sol b/contracts/apps/WitRandomnessV21.sol index 0d29defb..5ab912ba 100644 --- a/contracts/apps/WitRandomnessV21.sol +++ b/contracts/apps/WitRandomnessV21.sol @@ -4,7 +4,7 @@ pragma solidity >=0.8.0 <0.9.0; import "../WitRandomness.sol"; import "../interfaces/IWitRandomnessAdmin.sol"; -import "../mocks/UsingWitOracle.sol"; +import "../mockups/UsingWitOracle.sol"; import "../patterns/Ownable2Step.sol"; /// @title WitRandomnessV21: Unmalleable and provably-fair randomness generation based on the Witnet Oracle v2.*. diff --git a/contracts/mocks/UsingWitOracle.sol b/contracts/mockups/UsingWitOracle.sol similarity index 100% rename from contracts/mocks/UsingWitOracle.sol rename to contracts/mockups/UsingWitOracle.sol diff --git a/contracts/mocks/UsingWitOracleRandomness.sol b/contracts/mockups/UsingWitOracleRandomness.sol similarity index 100% rename from contracts/mocks/UsingWitOracleRandomness.sol rename to contracts/mockups/UsingWitOracleRandomness.sol diff --git a/contracts/mocks/UsingWitOracleRequest.sol b/contracts/mockups/UsingWitOracleRequest.sol similarity index 100% rename from contracts/mocks/UsingWitOracleRequest.sol rename to contracts/mockups/UsingWitOracleRequest.sol diff --git a/contracts/mocks/UsingWitOracleRequestTemplate.sol b/contracts/mockups/UsingWitOracleRequestTemplate.sol similarity index 100% rename from contracts/mocks/UsingWitOracleRequestTemplate.sol rename to contracts/mockups/UsingWitOracleRequestTemplate.sol diff --git a/contracts/mocks/WitConsumer.sol b/contracts/mockups/WitConsumer.sol similarity index 100% rename from contracts/mocks/WitConsumer.sol rename to contracts/mockups/WitConsumer.sol diff --git a/contracts/mocks/WitOracleRequestConsumer.sol b/contracts/mockups/WitOracleRequestConsumer.sol similarity index 100% rename from contracts/mocks/WitOracleRequestConsumer.sol rename to contracts/mockups/WitOracleRequestConsumer.sol diff --git a/contracts/mocks/WitOracleRequestTemplateConsumer.sol b/contracts/mockups/WitOracleRequestTemplateConsumer.sol similarity index 100% rename from contracts/mocks/WitOracleRequestTemplateConsumer.sol rename to contracts/mockups/WitOracleRequestTemplateConsumer.sol diff --git a/contracts/mocks/WitRandomnessRequestConsumer.sol b/contracts/mockups/WitRandomnessRequestConsumer.sol similarity index 100% rename from contracts/mocks/WitRandomnessRequestConsumer.sol rename to contracts/mockups/WitRandomnessRequestConsumer.sol diff --git a/test/mocks/MyDapp.sol b/test/mocks/MyDapp.sol index 37e19b05..eddd94d0 100644 --- a/test/mocks/MyDapp.sol +++ b/test/mocks/MyDapp.sol @@ -3,7 +3,7 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../../contracts/mocks/WitRandomnessRequestConsumer.sol"; +import "../../contracts/mockups/WitRandomnessRequestConsumer.sol"; contract MyDapp is From c00f00b7ef533988a4fc6d81dfd212fabc584fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Mon, 5 Aug 2024 10:23:44 +0200 Subject: [PATCH 23/39] refactor: Witnet.Request|Response -> Witnet.Query* --- contracts/apps/WitPriceFeedsV21.sol | 52 ++-- contracts/apps/WitRandomnessV21.sol | 52 ++-- .../core/trustable/WitOracleTrustableBase.sol | 268 +++++++++--------- .../trustable/WitOracleTrustableObscuro.sol | 4 +- .../core/trustable/WitOracleTrustableOvm2.sol | 2 +- contracts/data/WitOracleDataLib.sol | 24 +- contracts/interfaces/IWitFeeds.sol | 8 +- contracts/interfaces/IWitOracle.sol | 10 +- contracts/interfaces/IWitOracleConsumer.sol | 6 +- contracts/interfaces/IWitOracleEvents.sol | 2 +- contracts/interfaces/IWitPriceFeedsSolver.sol | 2 +- contracts/interfaces/IWitRandomness.sol | 2 +- contracts/libs/WitOracleResultErrorsLib.sol | 12 +- contracts/libs/Witnet.sol | 32 +-- contracts/mockups/UsingWitOracle.sol | 4 +- ...{WitConsumer.sol => WitOracleConsumer.sol} | 6 +- .../mockups/WitOracleRequestConsumer.sol | 10 +- .../WitOracleRequestTemplateConsumer.sol | 10 +- .../WitPriceFeedsSolverBase.sol | 0 .../mockups/WitRandomnessRequestConsumer.sol | 6 +- test/TestWitnetV2.sol | 18 +- test/mocks/MyDapp.sol | 6 +- 22 files changed, 268 insertions(+), 268 deletions(-) rename contracts/mockups/{WitConsumer.sol => WitOracleConsumer.sol} (89%) rename contracts/{apps => mockups}/WitPriceFeedsSolverBase.sol (100%) diff --git a/contracts/apps/WitPriceFeedsV21.sol b/contracts/apps/WitPriceFeedsV21.sol index a6025725..57618a00 100644 --- a/contracts/apps/WitPriceFeedsV21.sol +++ b/contracts/apps/WitPriceFeedsV21.sol @@ -27,9 +27,9 @@ contract WitPriceFeedsV21 IWitPriceFeedsSolverFactory { using Witnet for bytes; - using Witnet for Witnet.Result; - using Witnet for Witnet.Response; + using Witnet for Witnet.QueryResponse; using Witnet for Witnet.RadonSLA; + using Witnet for Witnet.Result; function class() virtual override(IWitAppliance, WitnetUpgradableBase) public view returns (string memory) { return type(WitPriceFeedsV21).name; @@ -245,9 +245,9 @@ contract WitPriceFeedsV21 return _lastValidQueryId(feedId); } - function lastValidResponse(bytes4 feedId) + function lastValidQueryResponse(bytes4 feedId) override public view - returns (Witnet.Response memory) + returns (Witnet.QueryResponse memory) { return witnet.getQueryResponse(_lastValidQueryId(feedId)); } @@ -259,16 +259,16 @@ contract WitPriceFeedsV21 return __records_(feedId).latestUpdateQueryId; } - function latestUpdateRequest(bytes4 feedId) + function latestUpdateQueryRequest(bytes4 feedId) override external view - returns (Witnet.Request memory) + returns (Witnet.QueryRequest memory) { return witnet.getQueryRequest(latestUpdateQueryId(feedId)); } - function latestUpdateResponse(bytes4 feedId) + function latestUpdateQueryResponse(bytes4 feedId) override external view - returns (Witnet.Response memory) + returns (Witnet.QueryResponse memory) { return witnet.getQueryResponse(latestUpdateQueryId(feedId)); } @@ -280,9 +280,9 @@ contract WitPriceFeedsV21 return witnet.getQueryResultError(latestUpdateQueryId(feedId)); } - function latestUpdateResponseStatus(bytes4 feedId) + function latestUpdateQueryResponseStatus(bytes4 feedId) override public view - returns (Witnet.ResponseStatus) + returns (Witnet.QueryResponseStatus) { return _checkQueryResponseStatus(latestUpdateQueryId(feedId)); } @@ -582,13 +582,13 @@ contract WitPriceFeedsV21 { uint _queryId = _lastValidQueryId(feedId); if (_queryId > 0) { - Witnet.Response memory _lastValidResponse = lastValidResponse(feedId); - Witnet.Result memory _latestResult = _lastValidResponse.resultCborBytes.toWitnetResult(); + Witnet.QueryResponse memory _lastValidQueryResponse = lastValidQueryResponse(feedId); + Witnet.Result memory _latestResult = _lastValidQueryResponse.resultCborBytes.toWitnetResult(); return IWitPriceFeedsSolver.Price({ value: _latestResult.asUint(), - timestamp: _lastValidResponse.resultTimestamp, - tallyHash: _lastValidResponse.resultTallyHash, - status: latestUpdateResponseStatus(feedId) + timestamp: _lastValidQueryResponse.resultTimestamp, + tallyHash: _lastValidQueryResponse.resultTallyHash, + status: latestUpdateQueryResponseStatus(feedId) }); } else { address _solver = __records_(feedId).solver; @@ -614,7 +614,7 @@ contract WitPriceFeedsV21 value: 0, timestamp: 0, tallyHash: 0, - status: latestUpdateResponseStatus(feedId) + status: latestUpdateQueryResponseStatus(feedId) }); } } @@ -670,11 +670,11 @@ contract WitPriceFeedsV21 return ( int(_latestPrice.value), _latestPrice.timestamp, - _latestPrice.status == Witnet.ResponseStatus.Ready + _latestPrice.status == Witnet.QueryResponseStatus.Ready ? 200 : ( - _latestPrice.status == Witnet.ResponseStatus.Awaiting - || _latestPrice.status == Witnet.ResponseStatus.Finalizing + _latestPrice.status == Witnet.QueryResponseStatus.Awaiting + || _latestPrice.status == Witnet.QueryResponseStatus.Finalizing ) ? 404 : 400 ); } @@ -685,12 +685,12 @@ contract WitPriceFeedsV21 function _checkQueryResponseStatus(uint _queryId) internal view - returns (Witnet.ResponseStatus) + returns (Witnet.QueryResponseStatus) { if (_queryId > 0) { return witnet.getQueryResponseStatus(_queryId); } else { - return Witnet.ResponseStatus.Ready; + return Witnet.QueryResponseStatus.Ready; } } @@ -709,7 +709,7 @@ contract WitPriceFeedsV21 uint _latestUpdateQueryId = latestUpdateQueryId(feedId); if ( _latestUpdateQueryId > 0 - && witnet.getQueryResponseStatus(_latestUpdateQueryId) == Witnet.ResponseStatus.Ready + && witnet.getQueryResponseStatus(_latestUpdateQueryId) == Witnet.QueryResponseStatus.Ready ) { return _latestUpdateQueryId; } else { @@ -747,11 +747,11 @@ contract WitPriceFeedsV21 _usedFunds = estimateUpdateRequestFee(tx.gasprice); _require(msg.value >= _usedFunds, "insufficient reward"); uint _latestId = __feed.latestUpdateQueryId; - Witnet.ResponseStatus _latestStatus = _checkQueryResponseStatus(_latestId); - if (_latestStatus == Witnet.ResponseStatus.Awaiting) { + Witnet.QueryResponseStatus _latestStatus = _checkQueryResponseStatus(_latestId); + if (_latestStatus == Witnet.QueryResponseStatus.Awaiting) { // latest update is still pending, so just increase the reward // accordingly to current tx gasprice: - Witnet.Request memory _request = witnet.getQueryRequest(_latestId); + Witnet.QueryRequest memory _request = witnet.getQueryRequest(_latestId); int _deltaReward = int(int72(_request.evmReward)) - int(_usedFunds); if (_deltaReward > 0) { _usedFunds = uint(_deltaReward); @@ -761,7 +761,7 @@ contract WitPriceFeedsV21 } } else { // Check if latest update ended successfully: - if (_latestStatus == Witnet.ResponseStatus.Ready) { + if (_latestStatus == Witnet.QueryResponseStatus.Ready) { // If so, remove previous last valid query from the WRB: if (__feed.lastValidQueryId > 0) { witnet.fetchQueryResponse(__feed.lastValidQueryId); diff --git a/contracts/apps/WitRandomnessV21.sol b/contracts/apps/WitRandomnessV21.sol index 5ab912ba..1f4a9108 100644 --- a/contracts/apps/WitRandomnessV21.sol +++ b/contracts/apps/WitRandomnessV21.sol @@ -154,14 +154,14 @@ contract WitRandomnessV21 "not randomized" ); - Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); - if (_status == Witnet.ResponseStatus.Ready) { + Witnet.QueryResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); + if (_status == Witnet.QueryResponseStatus.Ready) { return ( __witnet.getQueryResultCborBytes(_queryId) .toWitnetResult() .asBytes32() ); - } else if (_status == Witnet.ResponseStatus.Error) { + } else if (_status == Witnet.QueryResponseStatus.Error) { uint256 _nextRandomizeBlock = __randomize.nextBlock; _require( _nextRandomizeBlock != 0, @@ -182,18 +182,18 @@ contract WitRandomnessV21 /// @dev ii. the first non-errored `randomize()` request found on or after the given block is not solved yet. /// @dev iii. all `randomize()` requests that took place on or after the given block were solved with errors. /// @param _blockNumber Block number from which the search will start. - /// @return _witnetResultRandomness Random value provided by the Witnet blockchain and used for solving randomness after given block. - /// @return _witnetResultTimestamp Timestamp at which the randomness value was generated by the Witnet blockchain. - /// @return _witnetResultTallyHash Hash of the witnessing commit/reveal act that took place on the Witnet blockchain. - /// @return _witnetResultFinalityBlock EVM block number from which the provided randomness can be considered to be final. + /// @return _resultRandomness Random value provided by the Witnet blockchain and used for solving randomness after given block. + /// @return _resultTimestamp Timestamp at which the randomness value was generated by the Witnet blockchain. + /// @return _resultTallyHash Hash of the witnessing commit/reveal act that took place on the Witnet blockchain. + /// @return _resultFinalityBlock EVM block number from which the provided randomness can be considered to be final. function fetchRandomnessAfterProof(uint256 _blockNumber) virtual override public view returns ( - bytes32 _witnetResultRandomness, - uint64 _witnetResultTimestamp, - bytes32 _witnetResultTallyHash, - uint256 _witnetResultFinalityBlock + bytes32 _resultRandomness, + uint64 _resultTimestamp, + bytes32 _resultTallyHash, + uint256 _resultFinalityBlock ) { if (__storage().randomize_[_blockNumber].queryId == 0) { @@ -207,15 +207,15 @@ contract WitRandomnessV21 "not randomized" ); - Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); - if (_status == Witnet.ResponseStatus.Ready) { - Witnet.Response memory _witnetQueryResponse = __witnet.getQueryResponse(_queryId); - _witnetResultTimestamp = _witnetQueryResponse.resultTimestamp; - _witnetResultTallyHash = _witnetQueryResponse.resultTallyHash; - _witnetResultFinalityBlock = _witnetQueryResponse.finality; - _witnetResultRandomness = _witnetQueryResponse.resultCborBytes.toWitnetResult().asBytes32(); - - } else if (_status == Witnet.ResponseStatus.Error) { + Witnet.QueryResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); + if (_status == Witnet.QueryResponseStatus.Ready) { + Witnet.QueryResponse memory _queryResponse = __witnet.getQueryResponse(_queryId); + _resultTimestamp = _queryResponse.resultTimestamp; + _resultTallyHash = _queryResponse.resultTallyHash; + _resultFinalityBlock = _queryResponse.finality; + _resultRandomness = _queryResponse.resultCborBytes.toWitnetResult().asBytes32(); + + } else if (_status == Witnet.QueryResponseStatus.Error) { uint256 _nextRandomizeBlock = __randomize.nextBlock; _require( _nextRandomizeBlock != 0, @@ -300,23 +300,23 @@ contract WitRandomnessV21 function getRandomizeStatus(uint256 _blockNumber) virtual override public view - returns (Witnet.ResponseStatus) + returns (Witnet.QueryResponseStatus) { if (__storage().randomize_[_blockNumber].queryId == 0) { _blockNumber = getRandomizeNextBlock(_blockNumber); } uint256 _queryId = __storage().randomize_[_blockNumber].queryId; if (_queryId == 0) { - return Witnet.ResponseStatus.Void; + return Witnet.QueryResponseStatus.Void; } else { - Witnet.ResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); - if (_status == Witnet.ResponseStatus.Error) { + Witnet.QueryResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); + if (_status == Witnet.QueryResponseStatus.Error) { uint256 _nextRandomizeBlock = __storage().randomize_[_blockNumber].nextBlock; if (_nextRandomizeBlock != 0) { return getRandomizeStatus(_nextRandomizeBlock); } else { - return Witnet.ResponseStatus.Error; + return Witnet.QueryResponseStatus.Error; } } else { return _status; @@ -332,7 +332,7 @@ contract WitRandomnessV21 returns (bool) { return ( - getRandomizeStatus(_blockNumber) == Witnet.ResponseStatus.Ready + getRandomizeStatus(_blockNumber) == Witnet.QueryResponseStatus.Ready ); } diff --git a/contracts/core/trustable/WitOracleTrustableBase.sol b/contracts/core/trustable/WitOracleTrustableBase.sol index 4ab5ca90..bb850374 100644 --- a/contracts/core/trustable/WitOracleTrustableBase.sol +++ b/contracts/core/trustable/WitOracleTrustableBase.sol @@ -28,9 +28,9 @@ abstract contract WitOracleTrustableBase IWitOracleAdminACLs { using Witnet for bytes; + using Witnet for Witnet.QueryRequest; + using Witnet for Witnet.QueryResponse; using Witnet for Witnet.RadonSLA; - using Witnet for Witnet.Request; - using Witnet for Witnet.Response; using Witnet for Witnet.Result; using WitnetCBOR for WitnetCBOR.CBOR; @@ -227,57 +227,57 @@ abstract contract WitOracleTrustableBase // --- Partial implementation of IWitOracle -------------------------------------------------------------- /// Retrieves copy of all response data related to a previously posted request, removing the whole query from storage. - /// @dev Fails if the `_witnetQueryId` is not in 'Reported' status, or called from an address different to + /// @dev Fails if the `_queryId` is not in 'Reported' status, or called from an address different to /// @dev the one that actually posted the given request. - /// @param _witnetQueryId The unique query identifier. - function fetchQueryResponse(uint256 _witnetQueryId) + /// @param _queryId The unique query identifier. + function fetchQueryResponse(uint256 _queryId) virtual override external - inStatus(_witnetQueryId, Witnet.QueryStatus.Finalized) - onlyRequester(_witnetQueryId) - returns (Witnet.Response memory _response) + inStatus(_queryId, Witnet.QueryStatus.Finalized) + onlyRequester(_queryId) + returns (Witnet.QueryResponse memory _response) { - _response = WitOracleDataLib.seekQuery(_witnetQueryId).response; - delete __storage().queries[_witnetQueryId]; + _response = WitOracleDataLib.seekQuery(_queryId).response; + delete __storage().queries[_queryId]; } /// Gets the whole Query data contents, if any, no matter its current status. - function getQuery(uint256 _witnetQueryId) + function getQuery(uint256 _queryId) public view virtual override returns (Witnet.Query memory) { - return __storage().queries[_witnetQueryId]; + return __storage().queries[_queryId]; } /// @notice Gets the current EVM reward the report can claim, if not done yet. - function getQueryEvmReward(uint256 _witnetQueryId) + function getQueryEvmReward(uint256 _queryId) external view virtual override returns (uint256) { - return __storage().queries[_witnetQueryId].request.evmReward; + return __storage().queries[_queryId].request.evmReward; } /// @notice Retrieves the RAD hash and SLA parameters of the given query. - /// @param _witnetQueryId The unique query identifier. - function getQueryRequest(uint256 _witnetQueryId) + /// @param _queryId The unique query identifier. + function getQueryRequest(uint256 _queryId) external view override - returns (Witnet.Request memory) + returns (Witnet.QueryRequest memory) { - return WitOracleDataLib.seekQueryRequest(_witnetQueryId); + return WitOracleDataLib.seekQueryRequest(_queryId); } /// Retrieves the Witnet-provable result, and metadata, to a previously posted request. - /// @dev Fails if the `_witnetQueryId` is not in 'Reported' status. - /// @param _witnetQueryId The unique query identifier - function getQueryResponse(uint256 _witnetQueryId) + /// @dev Fails if the `_queryId` is not in 'Reported' status. + /// @param _queryId The unique query identifier + function getQueryResponse(uint256 _queryId) public view virtual override - returns (Witnet.Response memory) + returns (Witnet.QueryResponse memory) { - return WitOracleDataLib.seekQueryResponse(_witnetQueryId); + return WitOracleDataLib.seekQueryResponse(_queryId); } /// @notice Returns query's result current status from a requester's point of view: @@ -285,33 +285,33 @@ abstract contract WitOracleTrustableBase /// @notice - 1 => Awaiting: the query has not yet been reported; /// @notice - 2 => Ready: the query has been succesfully solved; /// @notice - 3 => Error: the query couldn't get solved due to some issue. - /// @param _witnetQueryId The unique query identifier. - function getQueryResponseStatus(uint256 _witnetQueryId) + /// @param _queryId The unique query identifier. + function getQueryResponseStatus(uint256 _queryId) virtual override public view - returns (Witnet.ResponseStatus) + returns (Witnet.QueryResponseStatus) { - return WitOracleDataLib.seekQueryResponseStatus(_witnetQueryId); + return WitOracleDataLib.seekQueryResponseStatus(_queryId); } /// @notice Retrieves the CBOR-encoded buffer containing the Witnet-provided result to the given query. - /// @param _witnetQueryId The unique query identifier. - function getQueryResultCborBytes(uint256 _witnetQueryId) + /// @param _queryId The unique query identifier. + function getQueryResultCborBytes(uint256 _queryId) external view virtual override returns (bytes memory) { - return WitOracleDataLib.seekQueryResponse(_witnetQueryId).resultCborBytes; + return WitOracleDataLib.seekQueryResponse(_queryId).resultCborBytes; } /// @notice Gets error code identifying some possible failure on the resolution of the given query. - /// @param _witnetQueryId The unique query identifier. - function getQueryResultError(uint256 _witnetQueryId) + /// @param _queryId The unique query identifier. + function getQueryResultError(uint256 _queryId) virtual override public view returns (Witnet.ResultError memory) { - Witnet.ResponseStatus _status = WitOracleDataLib.seekQueryResponseStatus(_witnetQueryId); - try WitOracleResultErrorsLib.asResultError(_status, WitOracleDataLib.seekQueryResponse(_witnetQueryId).resultCborBytes) + Witnet.QueryResponseStatus _status = WitOracleDataLib.seekQueryResponseStatus(_queryId); + try WitOracleResultErrorsLib.asResultError(_status, WitOracleDataLib.seekQueryResponse(_queryId).resultCborBytes) returns (Witnet.ResultError memory _resultError) { return _resultError; @@ -331,12 +331,12 @@ abstract contract WitOracleTrustableBase } /// Gets current status of given query. - function getQueryStatus(uint256 _witnetQueryId) + function getQueryStatus(uint256 _queryId) external view override returns (Witnet.QueryStatus) { - return WitOracleDataLib.seekQueryStatus(_witnetQueryId); + return WitOracleDataLib.seekQueryStatus(_queryId); } function getQueryStatusBatch(uint256[] calldata _witnetQueryIds) @@ -477,17 +477,17 @@ abstract contract WitOracleTrustableBase } /// Increments the reward of a previously posted request by adding the transaction value to it. - /// @dev Fails if the `_witnetQueryId` is not in 'Posted' status. - /// @param _witnetQueryId The unique query identifier. - function upgradeQueryEvmReward(uint256 _witnetQueryId) + /// @dev Fails if the `_queryId` is not in 'Posted' status. + /// @param _queryId The unique query identifier. + function upgradeQueryEvmReward(uint256 _queryId) external payable virtual override - inStatus(_witnetQueryId, Witnet.QueryStatus.Posted) + inStatus(_queryId, Witnet.QueryStatus.Posted) { - Witnet.Request storage __request = WitOracleDataLib.seekQueryRequest(_witnetQueryId); + Witnet.QueryRequest storage __request = WitOracleDataLib.seekQueryRequest(_queryId); __request.evmReward += uint72(_getMsgValue()); emit WitnetQueryUpgrade( - _witnetQueryId, + _queryId, _msgSender(), _getGasPrice(), __request.evmReward @@ -600,7 +600,7 @@ abstract contract WitOracleTrustableBase if ( WitOracleDataLib.seekQueryStatus(_queryIds[_ix]) == Witnet.QueryStatus.Posted ) { - Witnet.Request storage __request = WitOracleDataLib.seekQueryRequest(_queryIds[_ix]); + Witnet.QueryRequest storage __request = WitOracleDataLib.seekQueryRequest(_queryIds[_ix]); if (__request.gasCallback > 0) { _expenses += ( estimateBaseFeeWithCallback(_evmGasPrice, __request.gasCallback) @@ -644,76 +644,76 @@ abstract contract WitOracleTrustableBase /// Reports the Witnet-provable result to a previously posted request. /// @dev Will assume `block.timestamp` as the timestamp at which the request was solved. /// @dev Fails if: - /// @dev - the `_witnetQueryId` is not in 'Posted' status. - /// @dev - provided `_witnetQueryResultTallyHash` is zero; + /// @dev - the `_queryId` is not in 'Posted' status. + /// @dev - provided `_queryResultTallyHash` is zero; /// @dev - length of provided `_result` is zero. - /// @param _witnetQueryId The unique identifier of the data request. - /// @param _witnetQueryResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. - /// @param _witnetQueryResultCborBytes The result itself as bytes. + /// @param _queryId The unique identifier of the data request. + /// @param _queryResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. + /// @param _queryResultCborBytes The result itself as bytes. function reportResult( - uint256 _witnetQueryId, - bytes32 _witnetQueryResultTallyHash, - bytes calldata _witnetQueryResultCborBytes + uint256 _queryId, + bytes32 _queryResultTallyHash, + bytes calldata _queryResultCborBytes ) external override onlyReporters - inStatus(_witnetQueryId, Witnet.QueryStatus.Posted) + inStatus(_queryId, Witnet.QueryStatus.Posted) returns (uint256) { // results cannot be empty: _require( - _witnetQueryResultCborBytes.length != 0, + _queryResultCborBytes.length != 0, "result cannot be empty" ); // do actual report and return reward transfered to the reproter: // solhint-disable not-rely-on-time return __reportResultAndReward( - _witnetQueryId, + _queryId, uint32(block.timestamp), - _witnetQueryResultTallyHash, - _witnetQueryResultCborBytes + _queryResultTallyHash, + _queryResultCborBytes ); } /// Reports the Witnet-provable result to a previously posted request. /// @dev Fails if: /// @dev - called from unauthorized address; - /// @dev - the `_witnetQueryId` is not in 'Posted' status. - /// @dev - provided `_witnetQueryResultTallyHash` is zero; - /// @dev - length of provided `_witnetQueryResultCborBytes` is zero. - /// @param _witnetQueryId The unique query identifier - /// @param _witnetQueryResultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. - /// @param _witnetQueryResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. - /// @param _witnetQueryResultCborBytes The result itself as bytes. + /// @dev - the `_queryId` is not in 'Posted' status. + /// @dev - provided `_queryResultTallyHash` is zero; + /// @dev - length of provided `_queryResultCborBytes` is zero. + /// @param _queryId The unique query identifier + /// @param _queryResultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. + /// @param _queryResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. + /// @param _queryResultCborBytes The result itself as bytes. function reportResult( - uint256 _witnetQueryId, - uint32 _witnetQueryResultTimestamp, - bytes32 _witnetQueryResultTallyHash, - bytes calldata _witnetQueryResultCborBytes + uint256 _queryId, + uint32 _queryResultTimestamp, + bytes32 _queryResultTallyHash, + bytes calldata _queryResultCborBytes ) external override onlyReporters - inStatus(_witnetQueryId, Witnet.QueryStatus.Posted) + inStatus(_queryId, Witnet.QueryStatus.Posted) returns (uint256) { // validate timestamp _require( - _witnetQueryResultTimestamp > 0 - && _witnetQueryResultTimestamp <= block.timestamp, + _queryResultTimestamp > 0 + && _queryResultTimestamp <= block.timestamp, "bad timestamp" ); // results cannot be empty _require( - _witnetQueryResultCborBytes.length != 0, + _queryResultCborBytes.length != 0, "result cannot be empty" ); // do actual report and return reward transfered to the reproter: return __reportResultAndReward( - _witnetQueryId, - _witnetQueryResultTimestamp, - _witnetQueryResultTallyHash, - _witnetQueryResultCborBytes + _queryId, + _queryResultTimestamp, + _queryResultTallyHash, + _queryResultCborBytes ); } @@ -830,10 +830,10 @@ abstract contract WitOracleTrustableBase uint24 _callbackGasLimit ) virtual internal - returns (uint256 _witnetQueryId) + returns (uint256 _queryId) { - _witnetQueryId = ++ __storage().nonce; //__newQueryId(_radHash, _packedSLA); - Witnet.Request storage __request = WitOracleDataLib.seekQueryRequest(_witnetQueryId); + _queryId = ++ __storage().nonce; //__newQueryId(_radHash, _packedSLA); + Witnet.QueryRequest storage __request = WitOracleDataLib.seekQueryRequest(_queryId); _require(__request.requester == address(0), "already posted"); { __request.requester = msg.sender; @@ -845,16 +845,16 @@ abstract contract WitOracleTrustableBase } function __reportResult( - uint256 _witnetQueryId, - uint32 _witnetQueryResultTimestamp, - bytes32 _witnetQueryResultTallyHash, - bytes calldata _witnetQueryResultCborBytes + uint256 _queryId, + uint32 _queryResultTimestamp, + bytes32 _queryResultTallyHash, + bytes calldata _queryResultCborBytes ) virtual internal returns (uint256 _evmReward) { // read requester address and whether a callback was requested: - Witnet.Request storage __request = WitOracleDataLib.seekQueryRequest(_witnetQueryId); + Witnet.QueryRequest storage __request = WitOracleDataLib.seekQueryRequest(_queryId); // read query EVM reward: _evmReward = __request.evmReward; @@ -869,70 +869,70 @@ abstract contract WitOracleTrustableBase bool _evmCallbackSuccess, string memory _evmCallbackRevertMessage ) = __reportResultCallback( - _witnetQueryId, - _witnetQueryResultTimestamp, - _witnetQueryResultTallyHash, - _witnetQueryResultCborBytes, + _queryId, + _queryResultTimestamp, + _queryResultTallyHash, + _queryResultCborBytes, __request.requester, __request.gasCallback ); if (_evmCallbackSuccess) { // => the callback run successfully - emit WitnetQueryResponseDelivered( - _witnetQueryId, + emit WitnetQueryReponseDelivered( + _queryId, _getGasPrice(), _evmCallbackActualGas ); } else { // => the callback reverted emit WitnetQueryResponseDeliveryFailed( - _witnetQueryId, + _queryId, _getGasPrice(), _evmCallbackActualGas, bytes(_evmCallbackRevertMessage).length > 0 ? _evmCallbackRevertMessage : "WitOracle: callback exceeded gas limit", - _witnetQueryResultCborBytes + _queryResultCborBytes ); } // upon delivery, successfull or not, the audit trail is saved into storage, // but not the actual result which was intended to be passed over to the requester: - __writeQueryResponse( - _witnetQueryId, - _witnetQueryResultTimestamp, - _witnetQueryResultTallyHash, + __writeQueryQueryResponse( + _queryId, + _queryResultTimestamp, + _queryResultTallyHash, hex"" ); } else { // => no callback is involved emit WitnetQueryResponse( - _witnetQueryId, + _queryId, _getGasPrice() ); // write query result and audit trail data into storage - __writeQueryResponse( - _witnetQueryId, - _witnetQueryResultTimestamp, - _witnetQueryResultTallyHash, - _witnetQueryResultCborBytes + __writeQueryQueryResponse( + _queryId, + _queryResultTimestamp, + _queryResultTallyHash, + _queryResultCborBytes ); } } function __reportResultAndReward( - uint256 _witnetQueryId, - uint32 _witnetQueryResultTimestamp, - bytes32 _witnetQueryResultTallyHash, - bytes calldata _witnetQueryResultCborBytes + uint256 _queryId, + uint32 _queryResultTimestamp, + bytes32 _queryResultTallyHash, + bytes calldata _queryResultCborBytes ) virtual internal returns (uint256 _evmReward) { _evmReward = __reportResult( - _witnetQueryId, - _witnetQueryResultTimestamp, - _witnetQueryResultTallyHash, - _witnetQueryResultCborBytes + _queryId, + _queryResultTimestamp, + _queryResultTallyHash, + _queryResultCborBytes ); // transfer reward to reporter __safeTransferTo( @@ -942,10 +942,10 @@ abstract contract WitOracleTrustableBase } function __reportResultCallback( - uint256 _witnetQueryId, - uint64 _witnetQueryResultTimestamp, - bytes32 _witnetQueryResultTallyHash, - bytes calldata _witnetQueryResultCborBytes, + uint256 _queryId, + uint64 _queryResultTimestamp, + bytes32 _queryResultTallyHash, + bytes calldata _queryResultCborBytes, address _evmRequester, uint256 _evmCallbackGasLimit ) @@ -957,14 +957,14 @@ abstract contract WitOracleTrustableBase ) { _evmCallbackActualGas = gasleft(); - if (_witnetQueryResultCborBytes[0] == bytes1(0xd8)) { - WitnetCBOR.CBOR[] memory _errors = WitnetCBOR.fromBytes(_witnetQueryResultCborBytes).readArray(); + if (_queryResultCborBytes[0] == bytes1(0xd8)) { + WitnetCBOR.CBOR[] memory _errors = WitnetCBOR.fromBytes(_queryResultCborBytes).readArray(); if (_errors.length < 2) { // try to report result with unknown error: try IWitOracleConsumer(_evmRequester).reportWitnetQueryError{gas: _evmCallbackGasLimit}( - _witnetQueryId, - _witnetQueryResultTimestamp, - _witnetQueryResultTallyHash, + _queryId, + _queryResultTimestamp, + _queryResultTallyHash, block.number, Witnet.ResultErrorCodes.Unknown, WitnetCBOR.CBOR({ @@ -983,9 +983,9 @@ abstract contract WitOracleTrustableBase } else { // try to report result with parsable error: try IWitOracleConsumer(_evmRequester).reportWitnetQueryError{gas: _evmCallbackGasLimit}( - _witnetQueryId, - _witnetQueryResultTimestamp, - _witnetQueryResultTallyHash, + _queryId, + _queryResultTimestamp, + _queryResultTallyHash, block.number, Witnet.ResultErrorCodes(_errors[0].readUint()), _errors[0] @@ -998,11 +998,11 @@ abstract contract WitOracleTrustableBase } else { // try to report result result with no error : try IWitOracleConsumer(_evmRequester).reportWitnetQueryResult{gas: _evmCallbackGasLimit}( - _witnetQueryId, - _witnetQueryResultTimestamp, - _witnetQueryResultTallyHash, + _queryId, + _queryResultTimestamp, + _queryResultTallyHash, block.number, - WitnetCBOR.fromBytes(_witnetQueryResultCborBytes) + WitnetCBOR.fromBytes(_queryResultCborBytes) ) { _evmCallbackSuccess = true; } catch Error(string memory err) { @@ -1027,20 +1027,20 @@ abstract contract WitOracleTrustableBase return WitOracleDataLib.data(); } - function __writeQueryResponse( - uint256 _witnetQueryId, - uint32 _witnetQueryResultTimestamp, - bytes32 _witnetQueryResultTallyHash, - bytes memory _witnetQueryResultCborBytes + function __writeQueryQueryResponse( + uint256 _queryId, + uint32 _queryResultTimestamp, + bytes32 _queryResultTallyHash, + bytes memory _queryResultCborBytes ) virtual internal { - WitOracleDataLib.seekQuery(_witnetQueryId).response = Witnet.Response({ + WitOracleDataLib.seekQuery(_queryId).response = Witnet.QueryResponse({ reporter: msg.sender, finality: uint64(block.number), - resultTimestamp: _witnetQueryResultTimestamp, - resultTallyHash: _witnetQueryResultTallyHash, - resultCborBytes: _witnetQueryResultCborBytes + resultTimestamp: _queryResultTimestamp, + resultTallyHash: _queryResultTallyHash, + resultCborBytes: _queryResultCborBytes }); } diff --git a/contracts/core/trustable/WitOracleTrustableObscuro.sol b/contracts/core/trustable/WitOracleTrustableObscuro.sol index 72437a7b..316d8fdd 100644 --- a/contracts/core/trustable/WitOracleTrustableObscuro.sol +++ b/contracts/core/trustable/WitOracleTrustableObscuro.sol @@ -57,14 +57,14 @@ contract WitOracleTrustableObscuro return WitOracleTrustableBase.getQuery(_queryId); } - /// @notice Retrieves the whole `Witnet.Response` record referred to a previously posted Witnet Data Request. + /// @notice Retrieves the whole `Witnet.QueryResponse` record referred to a previously posted Witnet Data Request. /// @dev Fails if the `_queryId` is not in 'Reported' status, or if `msg.sender` is not the actual requester. /// @param _queryId The unique query identifier function getQueryResponse(uint256 _queryId) public view virtual override onlyRequester(_queryId) - returns (Witnet.Response memory _response) + returns (Witnet.QueryResponse memory _response) { return WitOracleTrustableBase.getQueryResponse(_queryId); } diff --git a/contracts/core/trustable/WitOracleTrustableOvm2.sol b/contracts/core/trustable/WitOracleTrustableOvm2.sol index 37489441..4f04322d 100644 --- a/contracts/core/trustable/WitOracleTrustableOvm2.sol +++ b/contracts/core/trustable/WitOracleTrustableOvm2.sol @@ -147,7 +147,7 @@ contract WitOracleTrustableOvm2 if ( WitOracleDataLib.seekQueryStatus(_queryIds[_ix]) == Witnet.QueryStatus.Posted ) { - Witnet.Request storage __request = WitOracleDataLib.seekQueryRequest(_queryIds[_ix]); + Witnet.QueryRequest storage __request = WitOracleDataLib.seekQueryRequest(_queryIds[_ix]); if (__request.gasCallback > 0) { _expenses += ( WitOracleTrustableDefault.estimateBaseFeeWithCallback(_evmGasPrice, __request.gasCallback) diff --git a/contracts/data/WitOracleDataLib.sol b/contracts/data/WitOracleDataLib.sol index a28cdbd2..fe7a2776 100644 --- a/contracts/data/WitOracleDataLib.sol +++ b/contracts/data/WitOracleDataLib.sol @@ -9,7 +9,7 @@ import "../libs/Witnet.sol"; /// @author The Witnet Foundation. library WitOracleDataLib { - using Witnet for Witnet.Request; + using Witnet for Witnet.QueryRequest; bytes32 internal constant _WIT_ORACLE_DATA_SLOTHASH = /* keccak256("io.witnet.boards.data") */ @@ -41,13 +41,13 @@ library WitOracleDataLib { return data().queries[_queryId]; } - /// Gets the Witnet.Request part of a given query. - function seekQueryRequest(uint256 _queryId) internal view returns (Witnet.Request storage) { + /// Gets the Witnet.QueryRequest part of a given query. + function seekQueryRequest(uint256 _queryId) internal view returns (Witnet.QueryRequest storage) { return data().queries[_queryId].request; } /// Gets the Witnet.Result part of a given query. - function seekQueryResponse(uint256 _queryId) internal view returns (Witnet.Response storage) { + function seekQueryResponse(uint256 _queryId) internal view returns (Witnet.QueryResponse storage) { return data().queries[_queryId].response; } @@ -66,26 +66,26 @@ library WitOracleDataLib { } } - function seekQueryResponseStatus(uint256 queryId) internal view returns (Witnet.ResponseStatus) { + function seekQueryResponseStatus(uint256 queryId) internal view returns (Witnet.QueryResponseStatus) { Witnet.QueryStatus _queryStatus = seekQueryStatus(queryId); if (_queryStatus == Witnet.QueryStatus.Finalized) { bytes storage __cborValues = data().queries[queryId].response.resultCborBytes; if (__cborValues.length > 0) { // determine whether stored result is an error by peeking the first byte return (__cborValues[0] == bytes1(0xd8) - ? Witnet.ResponseStatus.Error - : Witnet.ResponseStatus.Ready + ? Witnet.QueryResponseStatus.Error + : Witnet.QueryResponseStatus.Ready ); } else { // the result is final but delivered to the requesting address - return Witnet.ResponseStatus.Delivered; + return Witnet.QueryResponseStatus.Delivered; } } else if (_queryStatus == Witnet.QueryStatus.Posted) { - return Witnet.ResponseStatus.Awaiting; + return Witnet.QueryResponseStatus.Awaiting; } else if (_queryStatus == Witnet.QueryStatus.Reported) { - return Witnet.ResponseStatus.Finalizing; + return Witnet.QueryResponseStatus.Finalizing; } else { - return Witnet.ResponseStatus.Void; + return Witnet.QueryResponseStatus.Void; } } @@ -99,7 +99,7 @@ library WitOracleDataLib { bytecodes = new bytes[](queryIds.length); for (uint _ix = 0; _ix < queryIds.length; _ix ++) { if (seekQueryStatus(queryIds[_ix]) != Witnet.QueryStatus.Unknown) { - Witnet.Request storage __request = data().queries[queryIds[_ix]].request; + Witnet.QueryRequest storage __request = data().queries[queryIds[_ix]].request; if (__request.witnetRAD != bytes32(0)) { bytecodes[_ix] = registry.bytecodeOf( __request.witnetRAD, diff --git a/contracts/interfaces/IWitFeeds.sol b/contracts/interfaces/IWitFeeds.sol index 39406a0c..c3922d89 100644 --- a/contracts/interfaces/IWitFeeds.sol +++ b/contracts/interfaces/IWitFeeds.sol @@ -28,21 +28,21 @@ interface IWitFeeds { /// Returns the actual response from the Witnet oracle blockchain to the last /// successful update for the given data feed. - function lastValidResponse(bytes4 feedId) external view returns (Witnet.Response memory); + function lastValidQueryResponse(bytes4 feedId) external view returns (Witnet.QueryResponse memory); /// Returns the Witnet query id of the latest update attempt for the given data feed. function latestUpdateQueryId(bytes4 feedId) external view returns (uint256); /// Returns the actual request queried to the the Witnet oracle blockchain on the latest /// update attempt for the given data feed. - function latestUpdateRequest(bytes4 feedId) external view returns (Witnet.Request memory); + function latestUpdateQueryRequest(bytes4 feedId) external view returns (Witnet.QueryRequest memory); /// Returns the response from the Witnet oracle blockchain to the latest update attempt /// for the given data feed. - function latestUpdateResponse(bytes4 feedId) external view returns (Witnet.Response memory); + function latestUpdateQueryResponse(bytes4 feedId) external view returns (Witnet.QueryResponse memory); /// Tells the current response status of the latest update attempt for the given data feed. - function latestUpdateResponseStatus(bytes4 feedId) external view returns (Witnet.ResponseStatus); + function latestUpdateQueryResponseStatus(bytes4 feedId) external view returns (Witnet.QueryResponseStatus); /// Describes the error returned from the Witnet oracle blockchain in response to the latest /// update attempt for the given data feed, if any. diff --git a/contracts/interfaces/IWitOracle.sol b/contracts/interfaces/IWitOracle.sol index 93ce1965..b9670c9b 100644 --- a/contracts/interfaces/IWitOracle.sol +++ b/contracts/interfaces/IWitOracle.sol @@ -38,7 +38,7 @@ interface IWitOracle { /// @dev Fails if the query was not in 'Reported' status, or called from an address different to /// @dev the one that actually posted the given request. /// @param queryId The unique query identifier. - function fetchQueryResponse(uint256 queryId) external returns (Witnet.Response memory); + function fetchQueryResponse(uint256 queryId) external returns (Witnet.QueryResponse memory); /// @notice Gets the whole Query data contents, if any, no matter its current status. function getQuery(uint256 queryId) external view returns (Witnet.Query memory); @@ -48,11 +48,11 @@ interface IWitOracle { /// @notice Retrieves the RAD hash and SLA parameters of the given query. /// @param queryId The unique query identifier. - function getQueryRequest(uint256 queryId) external view returns (Witnet.Request memory); + function getQueryRequest(uint256 queryId) external view returns (Witnet.QueryRequest memory); - /// @notice Retrieves the whole `Witnet.Response` record referred to a previously posted Witnet Data Request. + /// @notice Retrieves the whole `Witnet.QueryResponse` record referred to a previously posted Witnet Data Request. /// @param queryId The unique query identifier. - function getQueryResponse(uint256 queryId) external view returns (Witnet.Response memory); + function getQueryResponse(uint256 queryId) external view returns (Witnet.QueryResponse memory); /// @notice Returns query's result current status from a requester's point of view: /// @notice - 0 => Void: the query is either non-existent or deleted; @@ -62,7 +62,7 @@ interface IWitOracle { /// @notice - 4 => Finalizing: some result to the query has been reported, but cannot yet be considered finalized. /// @notice - 5 => Delivered: at least one response, either successful or with errors, was delivered to the requesting contract. /// @param queryId The unique query identifier. - function getQueryResponseStatus(uint256 queryId) external view returns (Witnet.ResponseStatus); + function getQueryResponseStatus(uint256 queryId) external view returns (Witnet.QueryResponseStatus); /// @notice Retrieves the CBOR-encoded buffer containing the Witnet-provided result to the given query. /// @param queryId The unique query identifier. diff --git a/contracts/interfaces/IWitOracleConsumer.sol b/contracts/interfaces/IWitOracleConsumer.sol index 3c18cd11..13642e41 100644 --- a/contracts/interfaces/IWitOracleConsumer.sol +++ b/contracts/interfaces/IWitOracleConsumer.sol @@ -8,7 +8,7 @@ interface IWitOracleConsumer { /// @notice Method to be called from the WitOracle contract as soon as the given Witnet `queryId` /// @notice gets reported, if reported with no errors. /// @dev It should revert if called from any other address different to the WitOracle being used - /// @dev by the WitConsumer contract. + /// @dev by the WitOracleConsumer contract. /// @param witnetQueryId The unique identifier of the Witnet query being reported. /// @param witnetResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. /// @param witnetResultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. @@ -25,7 +25,7 @@ interface IWitOracleConsumer { /// @notice Method to be called from the WitOracle contract as soon as the given Witnet `queryId` /// @notice gets reported, if reported WITH errors. /// @dev It should revert if called from any other address different to the WitOracle being used - /// @dev by the WitConsumer contract. + /// @dev by the WitOracleConsumer contract. /// @param witnetQueryId The unique identifier of the Witnet query being reported. /// @param witnetResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. /// @param witnetResultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. @@ -43,6 +43,6 @@ interface IWitOracleConsumer { /// @notice Determines if Witnet queries can be reported from given address. /// @dev In practice, must only be true on the WitOracle address that's being used by - /// @dev the WitConsumer to post queries. + /// @dev the WitOracleConsumer to post queries. function reportableFrom(address) external view returns (bool); } \ No newline at end of file diff --git a/contracts/interfaces/IWitOracleEvents.sol b/contracts/interfaces/IWitOracleEvents.sol index f6ff9489..5682818d 100644 --- a/contracts/interfaces/IWitOracleEvents.sol +++ b/contracts/interfaces/IWitOracleEvents.sol @@ -40,7 +40,7 @@ interface IWitOracleEvents { ); /// Emitted when a query with a callback gets successfully reported into the WRB. - event WitnetQueryResponseDelivered( + event WitnetQueryReponseDelivered( uint256 queryId, uint256 evmGasPrice, uint256 evmCallbackGas diff --git a/contracts/interfaces/IWitPriceFeedsSolver.sol b/contracts/interfaces/IWitPriceFeedsSolver.sol index 25ed6927..8e7fc3ae 100644 --- a/contracts/interfaces/IWitPriceFeedsSolver.sol +++ b/contracts/interfaces/IWitPriceFeedsSolver.sol @@ -9,7 +9,7 @@ interface IWitPriceFeedsSolver { uint value; uint timestamp; bytes32 tallyHash; - Witnet.ResponseStatus status; + Witnet.QueryResponseStatus status; } function class() external pure returns (string memory); function delegator() external view returns (address); diff --git a/contracts/interfaces/IWitRandomness.sol b/contracts/interfaces/IWitRandomness.sol index c26f497d..a45a7458 100644 --- a/contracts/interfaces/IWitRandomness.sol +++ b/contracts/interfaces/IWitRandomness.sol @@ -74,7 +74,7 @@ interface IWitRandomness { /// @dev - 2 -> Ready: a successfull randomize value was reported and ready to be read. /// @dev - 3 -> Error: all randomize resolutions after the given block were solved with errors. /// @dev - 4 -> Finalizing: a randomize resolution has been reported from the Witnet blockchain, but it's not yet final. - function getRandomizeStatus(uint256 blockNumber) external view returns (Witnet.ResponseStatus); + function getRandomizeStatus(uint256 blockNumber) external view returns (Witnet.QueryResponseStatus); /// @notice Returns `true` only if a successfull resolution from the Witnet blockchain is found for the first /// @notice non-failing randomize request posted on or after the given block number. diff --git a/contracts/libs/WitOracleResultErrorsLib.sol b/contracts/libs/WitOracleResultErrorsLib.sol index 89d6570a..c6d28137 100644 --- a/contracts/libs/WitOracleResultErrorsLib.sol +++ b/contracts/libs/WitOracleResultErrorsLib.sol @@ -31,21 +31,21 @@ library WitOracleResultErrorsLib { ); } - function asResultError(Witnet.ResponseStatus _status, bytes memory _cborBytes) + function asResultError(Witnet.QueryResponseStatus _status, bytes memory _cborBytes) public pure returns (Witnet.ResultError memory) { if ( - _status == Witnet.ResponseStatus.Error - || _status == Witnet.ResponseStatus.Ready + _status == Witnet.QueryResponseStatus.Error + || _status == Witnet.QueryResponseStatus.Ready ) { return resultErrorFromCborBytes(_cborBytes); - } else if (_status == Witnet.ResponseStatus.Finalizing) { + } else if (_status == Witnet.QueryResponseStatus.Finalizing) { return Witnet.ResultError({ code: Witnet.ResultErrorCodes.Unknown, reason: "WitOracleResultErrorsLib: not yet finalized" }); - } if (_status == Witnet.ResponseStatus.Awaiting) { + } if (_status == Witnet.QueryResponseStatus.Awaiting) { return Witnet.ResultError({ code: Witnet.ResultErrorCodes.Unknown, reason: "WitOracleResultErrorsLib: not yet reported" @@ -168,7 +168,7 @@ library WitOracleResultErrorsLib { return "inconsistent sources."; } else if ( - code == Witnet.ResultErrorCodes.MalformedResponses + code == Witnet.ResultErrorCodes.MalformedQueryResponses && args.length > 2 ) { return string(abi.encodePacked( diff --git a/contracts/libs/Witnet.sol b/contracts/libs/Witnet.sol index 7878a9f8..da27a719 100644 --- a/contracts/libs/Witnet.sol +++ b/contracts/libs/Witnet.sol @@ -13,20 +13,12 @@ library Witnet { /// Struct containing both request and response data related to every query posted to the Witnet Request Board struct Query { - Request request; - Response response; - } - - /// Possible status of a Witnet query. - enum QueryStatus { - Unknown, - Posted, - Reported, - Finalized + QueryRequest request; + QueryResponse response; } /// Data kept in EVM-storage for every Request posted to the Witnet Request Board. - struct Request { + struct QueryRequest { address requester; // EVM address from which the request was posted. uint24 gasCallback; // Max callback gas limit upon response, if a callback is required. uint72 evmReward; // EVM amount in wei eventually to be paid to the legit result reporter. @@ -35,8 +27,8 @@ library Witnet { RadonSLA witnetSLA; // Minimum Service-Level parameters to be committed by the Witnet blockchain. } - /// Response metadata and result as resolved by the Witnet blockchain. - struct Response { + /// QueryResponse metadata and result as resolved by the Witnet blockchain. + struct QueryResponse { address reporter; // EVM address from which the Data Request result was reported. uint64 finality; // EVM block number at which the reported data will be considered to be finalized. uint32 resultTimestamp; // Unix timestamp (seconds) at which the data request was resolved in the Witnet blockchain. @@ -44,8 +36,8 @@ library Witnet { bytes resultCborBytes; // CBOR-encode result to the request, as resolved in the Witnet blockchain. } - /// Response status from a requester's point of view. - enum ResponseStatus { + /// QueryResponse status from a requester's point of view. + enum QueryResponseStatus { Void, Awaiting, Ready, @@ -54,6 +46,14 @@ library Witnet { Delivered } + /// Possible status of a Witnet query. + enum QueryStatus { + Unknown, + Posted, + Reported, + Finalized + } + /// Data struct containing the Witnet-provided result to a Data Request. struct Result { bool success; // Flag stating whether the request could get solved successfully, or not. @@ -189,7 +189,7 @@ library Witnet { /// 0x56: Any one of the (multiple) Retrieve, Aggregate or Tally scripts were badly formated: MalformedDataRequest, /// 0x57: Values returned from a majority of data sources don't match the expected schema: - MalformedResponses, + MalformedQueryResponses, /// Unallocated: OtherError0x58, OtherError0x59, OtherError0x5A, OtherError0x5B, OtherError0x5C, OtherError0x5D, OtherError0x5E, /// 0x5F: Size of serialized tally result exceeds allowance: diff --git a/contracts/mockups/UsingWitOracle.sol b/contracts/mockups/UsingWitOracle.sol index 83299225..555d4e80 100644 --- a/contracts/mockups/UsingWitOracle.sol +++ b/contracts/mockups/UsingWitOracle.sol @@ -76,9 +76,9 @@ abstract contract UsingWitOracle ) / 100; } - function _witnetCheckQueryResponseStatus(uint256 _witnetQueryId) + function _witnetCheckQueryQueryResponseStatus(uint256 _witnetQueryId) internal view - returns (Witnet.ResponseStatus) + returns (Witnet.QueryResponseStatus) { return __witnet.getQueryResponseStatus(_witnetQueryId); } diff --git a/contracts/mockups/WitConsumer.sol b/contracts/mockups/WitOracleConsumer.sol similarity index 89% rename from contracts/mockups/WitConsumer.sol rename to contracts/mockups/WitOracleConsumer.sol index fbde08b3..c81de76d 100644 --- a/contracts/mockups/WitConsumer.sol +++ b/contracts/mockups/WitOracleConsumer.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import "./UsingWitOracle.sol"; import "../interfaces/IWitOracleConsumer.sol"; -abstract contract WitConsumer +abstract contract WitOracleConsumer is IWitOracleConsumer, UsingWitOracle @@ -13,7 +13,7 @@ abstract contract WitConsumer uint24 internal immutable __witnetCallbackGasLimit; modifier onlyFromWitnet { - require(msg.sender == address(__witnet), "WitConsumer: unauthorized"); + require(msg.sender == address(__witnet), "WitOracleConsumer: unauthorized"); _; } @@ -32,7 +32,7 @@ abstract contract WitConsumer /// =============================================================================================================== - /// --- WitConsumer virtual methods ---------------------------------------------------------------------------- + /// --- WitOracleConsumer virtual methods ---------------------------------------------------------------------------- function _witnetEstimateBaseFee() virtual override internal view returns (uint256) { return ( diff --git a/contracts/mockups/WitOracleRequestConsumer.sol b/contracts/mockups/WitOracleRequestConsumer.sol index 6b12f942..8d7f7558 100644 --- a/contracts/mockups/WitOracleRequestConsumer.sol +++ b/contracts/mockups/WitOracleRequestConsumer.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.0; import "./UsingWitOracleRequest.sol"; -import "./WitConsumer.sol"; +import "./WitOracleConsumer.sol"; abstract contract WitOracleRequestConsumer is UsingWitOracleRequest, - WitConsumer + WitOracleConsumer { using WitnetCBOR for WitnetCBOR.CBOR; using WitnetCBOR for WitnetCBOR.CBOR[]; @@ -21,15 +21,15 @@ abstract contract WitOracleRequestConsumer uint24 _callbackGasLimit ) UsingWitOracleRequest(_witnetRequest, _baseFeeOverheadPercentage) - WitConsumer(_callbackGasLimit) + WitOracleConsumer(_callbackGasLimit) {} function _witnetEstimateBaseFee() - virtual override(UsingWitOracle, WitConsumer) + virtual override(UsingWitOracle, WitOracleConsumer) internal view returns (uint256) { - return WitConsumer._witnetEstimateBaseFee(); + return WitOracleConsumer._witnetEstimateBaseFee(); } function __witnetRequestData( diff --git a/contracts/mockups/WitOracleRequestTemplateConsumer.sol b/contracts/mockups/WitOracleRequestTemplateConsumer.sol index a92f82cc..862d1924 100644 --- a/contracts/mockups/WitOracleRequestTemplateConsumer.sol +++ b/contracts/mockups/WitOracleRequestTemplateConsumer.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.0; import "./UsingWitOracleRequestTemplate.sol"; -import "./WitConsumer.sol"; +import "./WitOracleConsumer.sol"; abstract contract WitOracleRequestTemplateConsumer is UsingWitOracleRequestTemplate, - WitConsumer + WitOracleConsumer { using WitnetCBOR for WitnetCBOR.CBOR; using WitnetCBOR for WitnetCBOR.CBOR[]; @@ -21,15 +21,15 @@ abstract contract WitOracleRequestTemplateConsumer uint24 _callbackGasLimit ) UsingWitOracleRequestTemplate(_witnetRequestTemplate, _baseFeeOverheadPercentage) - WitConsumer(_callbackGasLimit) + WitOracleConsumer(_callbackGasLimit) {} function _witnetEstimateBaseFee() - virtual override(UsingWitOracle, WitConsumer) + virtual override(UsingWitOracle, WitOracleConsumer) internal view returns (uint256) { - return WitConsumer._witnetEstimateBaseFee(); + return WitOracleConsumer._witnetEstimateBaseFee(); } function __witnetRequestData( diff --git a/contracts/apps/WitPriceFeedsSolverBase.sol b/contracts/mockups/WitPriceFeedsSolverBase.sol similarity index 100% rename from contracts/apps/WitPriceFeedsSolverBase.sol rename to contracts/mockups/WitPriceFeedsSolverBase.sol diff --git a/contracts/mockups/WitRandomnessRequestConsumer.sol b/contracts/mockups/WitRandomnessRequestConsumer.sol index cad0a858..8bb04127 100644 --- a/contracts/mockups/WitRandomnessRequestConsumer.sol +++ b/contracts/mockups/WitRandomnessRequestConsumer.sol @@ -3,12 +3,12 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "./WitConsumer.sol"; +import "./WitOracleConsumer.sol"; import "../WitOracleRequest.sol"; abstract contract WitRandomnessRequestConsumer is - WitConsumer + WitOracleConsumer { using Witnet for bytes; using Witnet for bytes32; @@ -26,7 +26,7 @@ abstract contract WitRandomnessRequestConsumer uint24 _callbackGasLimit ) UsingWitOracle(_wrb) - WitConsumer(_callbackGasLimit) + WitOracleConsumer(_callbackGasLimit) { // On-chain building of the Witnet Randomness Request: { diff --git a/test/TestWitnetV2.sol b/test/TestWitnetV2.sol index 8b399c4b..67dc801e 100644 --- a/test/TestWitnetV2.sol +++ b/test/TestWitnetV2.sol @@ -10,8 +10,8 @@ contract TestWitnetV2 { using Witnet for *; - Witnet.Request internal __request; - Witnet.Response internal __response; + Witnet.QueryRequest internal __request; + Witnet.QueryResponse internal __response; uint256 internal __finalityBlock; @@ -22,7 +22,7 @@ contract TestWitnetV2 { } function testWitOracleRequestPackingWithBytecode() external { - __request = Witnet.Request({ + __request = Witnet.QueryRequest({ requester: msg.sender, gasCallback: 500000, evmReward: 10 ** 18, @@ -36,12 +36,12 @@ contract TestWitnetV2 { }); } - function testWitOracleRequestUnpackingWithBytecode() external returns (Witnet.Request memory) { + function testWitOracleRequestUnpackingWithBytecode() external returns (Witnet.QueryRequest memory) { return __request; } function testWitOracleRequestPackingWithRadHash() external { - __request = Witnet.Request({ + __request = Witnet.QueryRequest({ requester: msg.sender, gasCallback: 500000, evmReward: 10 ** 18, @@ -55,12 +55,12 @@ contract TestWitnetV2 { }); } - function testWitOracleRequestUnpackingWithRadHash() external returns (Witnet.Request memory) { + function testWitOracleRequestUnpackingWithRadHash() external returns (Witnet.QueryRequest memory) { return __request; } - function testWitnetResponsePacking() external { - __response = Witnet.Response({ + function testWitnetQueryResponsePacking() external { + __response = Witnet.QueryResponse({ reporter: msg.sender, finality: uint64(block.number), resultTimestamp: uint32(block.timestamp), @@ -69,7 +69,7 @@ contract TestWitnetV2 { }); } - function testWitnetResponseUnpacking() external returns (Witnet.Response memory) { + function testWitnetQueryResponseUnpacking() external returns (Witnet.QueryResponse memory) { return __response; } diff --git a/test/mocks/MyDapp.sol b/test/mocks/MyDapp.sol index eddd94d0..fa7e3646 100644 --- a/test/mocks/MyDapp.sol +++ b/test/mocks/MyDapp.sol @@ -58,11 +58,11 @@ contract MyDapp /// @notice Method to be called from the WitOracle contract as soon as the given Witnet `queryId` /// @notice gets reported, if reported with no errors. /// @dev It should revert if called from any other address different to the WitOracle being used - /// @dev by the WitConsumer contract. Within the implementation of this method, the WitConsumer + /// @dev by the WitOracleConsumer contract. Within the implementation of this method, the WitOracleConsumer /// @dev can call to the WRB as to retrieve the Witnet tracking information (i.e. the `witnetDrTxHash` /// @dev and `witnetDrCommitTxTimestamp`), or the finality status, of the result being reported. function reportWitnetQueryResult( - uint256 _witnetQueryId, uint64, bytes32, uint256, + uint256 _queryId, uint64, bytes32, uint256, WitnetCBOR.CBOR calldata witnetResultCborValue ) override external @@ -70,7 +70,7 @@ contract MyDapp { // randomness = _witnetReadRandomizeFromResultValue(witnetResultCborValue); // delete rubbish; - // witnet.burnQuery(_witnetQueryId); + // witnet.burnQuery(_queryId); // emit Result(queryId, _witnetReadRandomizeFromResultValue(cborValue)); } From a5b3f7923922a8fb4e53d9fb7f9ac6e66bbb7a6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Mon, 5 Aug 2024 10:52:46 +0200 Subject: [PATCH 24/39] refactor: WitnetQuery* -> WitOracle* events --- contracts/apps/WitPriceFeedsV21.sol | 8 +- contracts/apps/WitRandomnessV21.sol | 16 +- .../core/trustable/WitOracleTrustableBase.sol | 162 +++++++++--------- contracts/interfaces/IWitFeeds.sol | 6 +- contracts/interfaces/IWitOracle.sol | 4 +- contracts/interfaces/IWitOracleConsumer.sol | 36 ++-- contracts/interfaces/IWitOracleEvents.sol | 12 +- contracts/interfaces/IWitOracleReporter.sol | 42 ++--- contracts/interfaces/IWitRandomness.sol | 18 +- contracts/interfaces/IWitRandomnessAdmin.sol | 2 +- contracts/mockups/UsingWitOracle.sol | 12 +- contracts/mockups/UsingWitOracleRequest.sol | 4 +- .../mockups/UsingWitOracleRequestTemplate.sol | 4 +- .../mockups/WitOracleRequestConsumer.sol | 4 +- .../WitOracleRequestTemplateConsumer.sol | 4 +- .../mockups/WitRandomnessRequestConsumer.sol | 4 +- test/TestWitnetV2.sol | 4 +- test/mocks/MyDapp.sol | 8 +- 18 files changed, 175 insertions(+), 175 deletions(-) diff --git a/contracts/apps/WitPriceFeedsV21.sol b/contracts/apps/WitPriceFeedsV21.sol index 57618a00..de991eb5 100644 --- a/contracts/apps/WitPriceFeedsV21.sol +++ b/contracts/apps/WitPriceFeedsV21.sol @@ -287,7 +287,7 @@ contract WitPriceFeedsV21 return _checkQueryResponseStatus(latestUpdateQueryId(feedId)); } - function lookupWitnetBytecode(bytes4 feedId) + function lookupWitOracleRequestBytecode(bytes4 feedId) override external view returns (bytes memory) { @@ -299,19 +299,19 @@ contract WitPriceFeedsV21 return _registry().bytecodeOf(__record.radHash); } - function lookupWitnetRadHash(bytes4 feedId) + function lookupWitOracleRequestRadHash(bytes4 feedId) override public view returns (bytes32) { return __records_(feedId).radHash; } - function lookupWitnetRetrievals(bytes4 feedId) + function lookupWitOracleRadonRetrievals(bytes4 feedId) override external view returns (Witnet.RadonRetrieval[] memory _retrievals) { return _registry().lookupRadonRequestRetrievals( - lookupWitnetRadHash(feedId) + lookupWitOracleRequestRadHash(feedId) ); } diff --git a/contracts/apps/WitRandomnessV21.sol b/contracts/apps/WitRandomnessV21.sol index 1f4a9108..0edc132f 100644 --- a/contracts/apps/WitRandomnessV21.sol +++ b/contracts/apps/WitRandomnessV21.sol @@ -33,7 +33,7 @@ contract WitRandomnessV21 /// @notice Unique identifier of the RNG data request used on the Witnet Oracle blockchain for solving randomness. /// @dev Can be used to track all randomness requests solved so far on the Witnet Oracle blockchain. - bytes32 immutable public override witnetRadHash; + bytes32 immutable public override witOracleQueryRadHash; constructor( WitOracle _witnet, @@ -49,7 +49,7 @@ contract WitRandomnessV21 ); // Build Witnet-compliant randomness request: WitOracleRadonRegistry _registry = witnet().registry(); - witnetRadHash = _registry.verifyRadonRequest( + witOracleQueryRadHash = _registry.verifyRadonRequest( abi.decode( abi.encode([ _registry.verifyRadonRetrieval( @@ -372,7 +372,7 @@ contract WitRandomnessV21 /// @notice Requests the Witnet oracle to generate an EVM-agnostic and trustless source of randomness. /// @dev Only one randomness request per block will be actually posted to the Witnet Oracle. - /// @dev Reverts if given SLA security parameters are below witnetQuerySLA(). + /// @dev Reverts if given SLA security parameters are below witOracleQuerySLA(). /// @return Funds actually paid as randomize fee. function randomize(Witnet.RadonSLA calldata _querySLA) external payable @@ -390,7 +390,7 @@ contract WitRandomnessV21 /// @notice when solving randomness requests: /// @notice - number of witnessing nodes contributing to randomness generation /// @notice - reward in $nanoWIT received by every contributing node in the Witnet blockchain - function witnetQuerySLA() + function witOracleQuerySLA() virtual override external view returns (Witnet.RadonSLA memory) @@ -449,16 +449,16 @@ contract WitRandomnessV21 __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - function settleWitnetQuerySLA(Witnet.RadonSLA calldata _witnetQuerySLA) + function settleDefaultQuerySLA(Witnet.RadonSLA calldata _witOracleQuerySLA) virtual override external onlyOwner { _require( - _witnetQuerySLA.isValid(), + _witOracleQuerySLA.isValid(), "invalid SLA" ); - __witnetDefaultSLA = _witnetQuerySLA; + __witnetDefaultSLA = _witOracleQuerySLA; } @@ -478,7 +478,7 @@ contract WitRandomnessV21 _queryId = __witnet.postRequest{ value: msg.value }( - witnetRadHash, + witOracleQueryRadHash, _querySLA ); diff --git a/contracts/core/trustable/WitOracleTrustableBase.sol b/contracts/core/trustable/WitOracleTrustableBase.sol index bb850374..df203938 100644 --- a/contracts/core/trustable/WitOracleTrustableBase.sol +++ b/contracts/core/trustable/WitOracleTrustableBase.sol @@ -339,14 +339,14 @@ abstract contract WitOracleTrustableBase return WitOracleDataLib.seekQueryStatus(_queryId); } - function getQueryStatusBatch(uint256[] calldata _witnetQueryIds) + function getQueryStatusBatch(uint256[] calldata _queryIds) external view override returns (Witnet.QueryStatus[] memory _status) { - _status = new Witnet.QueryStatus[](_witnetQueryIds.length); - for (uint _ix = 0; _ix < _witnetQueryIds.length; _ix ++) { - _status[_ix] = WitOracleDataLib.seekQueryStatus(_witnetQueryIds[_ix]); + _status = new Witnet.QueryStatus[](_queryIds.length); + for (uint _ix = 0; _ix < _queryIds.length; _ix ++) { + _status[_ix] = WitOracleDataLib.seekQueryStatus(_queryIds[_ix]); } } @@ -381,7 +381,7 @@ abstract contract WitOracleTrustableBase { _queryId = __postRequest(_queryRAD, _querySLA, 0); // Let Web3 observers know that a new request has been posted - emit WitnetQuery( + emit WitOracleQuery( _msgSender(), _getGasPrice(), _getMsgValue(), @@ -394,7 +394,7 @@ abstract contract WitOracleTrustableBase /// @notice Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by /// @notice the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the /// @notice reporter who relays back the Witnet-provable result to this request. The Witnet-provable result will be reported - /// @notice directly to the requesting contract. If the report callback fails for any reason, an `WitnetQueryResponseDeliveryFailed` + /// @notice directly to the requesting contract. If the report callback fails for any reason, an `WitOracleQueryResponseDeliveryFailed` /// @notice will be triggered, and the Witnet audit trail will be saved in storage, but not so the actual CBOR-encoded result. /// @dev Reasons to fail: /// @dev - the caller is not a contract implementing the IWitOracleConsumer interface; @@ -423,7 +423,7 @@ abstract contract WitOracleTrustableBase _querySLA, _queryCallbackGasLimit ); - emit WitnetQuery( + emit WitOracleQuery( _msgSender(), _getGasPrice(), _getMsgValue(), @@ -436,7 +436,7 @@ abstract contract WitOracleTrustableBase /// @notice Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by /// @notice the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the /// @notice reporter who relays back the Witnet-provable result to this request. The Witnet-provable result will be reported - /// @notice directly to the requesting contract. If the report callback fails for any reason, a `WitnetQueryResponseDeliveryFailed` + /// @notice directly to the requesting contract. If the report callback fails for any reason, a `WitOracleQueryResponseDeliveryFailed` /// @notice event will be triggered, and the Witnet audit trail will be saved in storage, but not so the CBOR-encoded result. /// @dev Reasons to fail: /// @dev - the caller is not a contract implementing the IWitOracleConsumer interface; @@ -466,7 +466,7 @@ abstract contract WitOracleTrustableBase _queryCallbackGasLimit ); WitOracleDataLib.seekQueryRequest(_queryId).witnetBytecode = _queryUnverifiedBytecode; - emit WitnetQuery( + emit WitOracleQuery( _msgSender(), _getGasPrice(), _getMsgValue(), @@ -486,7 +486,7 @@ abstract contract WitOracleTrustableBase { Witnet.QueryRequest storage __request = WitOracleDataLib.seekQueryRequest(_queryId); __request.evmReward += uint72(_getMsgValue()); - emit WitnetQueryUpgrade( + emit WitOracleQueryUpgrade( _queryId, _msgSender(), _getGasPrice(), @@ -645,15 +645,15 @@ abstract contract WitOracleTrustableBase /// @dev Will assume `block.timestamp` as the timestamp at which the request was solved. /// @dev Fails if: /// @dev - the `_queryId` is not in 'Posted' status. - /// @dev - provided `_queryResultTallyHash` is zero; + /// @dev - provided `_resultTallyHash` is zero; /// @dev - length of provided `_result` is zero. /// @param _queryId The unique identifier of the data request. - /// @param _queryResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. - /// @param _queryResultCborBytes The result itself as bytes. + /// @param _resultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. + /// @param _resultCborBytes The result itself as bytes. function reportResult( uint256 _queryId, - bytes32 _queryResultTallyHash, - bytes calldata _queryResultCborBytes + bytes32 _resultTallyHash, + bytes calldata _resultCborBytes ) external override onlyReporters @@ -662,7 +662,7 @@ abstract contract WitOracleTrustableBase { // results cannot be empty: _require( - _queryResultCborBytes.length != 0, + _resultCborBytes.length != 0, "result cannot be empty" ); // do actual report and return reward transfered to the reproter: @@ -670,8 +670,8 @@ abstract contract WitOracleTrustableBase return __reportResultAndReward( _queryId, uint32(block.timestamp), - _queryResultTallyHash, - _queryResultCborBytes + _resultTallyHash, + _resultCborBytes ); } @@ -679,17 +679,17 @@ abstract contract WitOracleTrustableBase /// @dev Fails if: /// @dev - called from unauthorized address; /// @dev - the `_queryId` is not in 'Posted' status. - /// @dev - provided `_queryResultTallyHash` is zero; - /// @dev - length of provided `_queryResultCborBytes` is zero. + /// @dev - provided `_resultTallyHash` is zero; + /// @dev - length of provided `_resultCborBytes` is zero. /// @param _queryId The unique query identifier - /// @param _queryResultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. - /// @param _queryResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. - /// @param _queryResultCborBytes The result itself as bytes. + /// @param _resultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. + /// @param _resultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. + /// @param _resultCborBytes The result itself as bytes. function reportResult( uint256 _queryId, - uint32 _queryResultTimestamp, - bytes32 _queryResultTallyHash, - bytes calldata _queryResultCborBytes + uint32 _resultTimestamp, + bytes32 _resultTallyHash, + bytes calldata _resultCborBytes ) external override @@ -699,26 +699,26 @@ abstract contract WitOracleTrustableBase { // validate timestamp _require( - _queryResultTimestamp > 0 - && _queryResultTimestamp <= block.timestamp, + _resultTimestamp > 0 + && _resultTimestamp <= block.timestamp, "bad timestamp" ); // results cannot be empty _require( - _queryResultCborBytes.length != 0, + _resultCborBytes.length != 0, "result cannot be empty" ); // do actual report and return reward transfered to the reproter: return __reportResultAndReward( _queryId, - _queryResultTimestamp, - _queryResultTallyHash, - _queryResultCborBytes + _resultTimestamp, + _resultTallyHash, + _resultCborBytes ); } /// @notice Reports Witnet-provided results to multiple requests within a single EVM tx. - /// @notice Emits either a WitnetQueryResponse* or a BatchReportError event per batched report. + /// @notice Emits either a WitOracleQueryResponse* or a BatchReportError event per batched report. /// @dev Fails only if called from unauthorized address. /// @param _batchResults Array of BatchResult structs, every one containing: /// - unique query identifier; @@ -740,9 +740,9 @@ abstract contract WitOracleTrustableBase WitOracleDataLib.notInStatusRevertMessage(Witnet.QueryStatus.Posted) ); } else if ( - uint256(_batchResults[_i].queryResultTimestamp) > block.timestamp - || _batchResults[_i].queryResultTimestamp == 0 - || _batchResults[_i].queryResultCborBytes.length == 0 + uint256(_batchResults[_i].resultTimestamp) > block.timestamp + || _batchResults[_i].resultTimestamp == 0 + || _batchResults[_i].resultCborBytes.length == 0 ) { emit BatchReportError( _batchResults[_i].queryId, @@ -754,9 +754,9 @@ abstract contract WitOracleTrustableBase } else { _batchReward += __reportResult( _batchResults[_i].queryId, - _batchResults[_i].queryResultTimestamp, - _batchResults[_i].queryResultTallyHash, - _batchResults[_i].queryResultCborBytes + _batchResults[_i].resultTimestamp, + _batchResults[_i].resultTallyHash, + _batchResults[_i].resultCborBytes ); } } @@ -846,9 +846,9 @@ abstract contract WitOracleTrustableBase function __reportResult( uint256 _queryId, - uint32 _queryResultTimestamp, - bytes32 _queryResultTallyHash, - bytes calldata _queryResultCborBytes + uint32 _resultTimestamp, + bytes32 _resultTallyHash, + bytes calldata _resultCborBytes ) virtual internal returns (uint256 _evmReward) @@ -870,69 +870,69 @@ abstract contract WitOracleTrustableBase string memory _evmCallbackRevertMessage ) = __reportResultCallback( _queryId, - _queryResultTimestamp, - _queryResultTallyHash, - _queryResultCborBytes, + _resultTimestamp, + _resultTallyHash, + _resultCborBytes, __request.requester, __request.gasCallback ); if (_evmCallbackSuccess) { // => the callback run successfully - emit WitnetQueryReponseDelivered( + emit WitOracleQueryReponseDelivered( _queryId, _getGasPrice(), _evmCallbackActualGas ); } else { // => the callback reverted - emit WitnetQueryResponseDeliveryFailed( + emit WitOracleQueryResponseDeliveryFailed( _queryId, _getGasPrice(), _evmCallbackActualGas, bytes(_evmCallbackRevertMessage).length > 0 ? _evmCallbackRevertMessage : "WitOracle: callback exceeded gas limit", - _queryResultCborBytes + _resultCborBytes ); } // upon delivery, successfull or not, the audit trail is saved into storage, // but not the actual result which was intended to be passed over to the requester: __writeQueryQueryResponse( _queryId, - _queryResultTimestamp, - _queryResultTallyHash, + _resultTimestamp, + _resultTallyHash, hex"" ); } else { // => no callback is involved - emit WitnetQueryResponse( + emit WitOracleQueryResponse( _queryId, _getGasPrice() ); // write query result and audit trail data into storage __writeQueryQueryResponse( _queryId, - _queryResultTimestamp, - _queryResultTallyHash, - _queryResultCborBytes + _resultTimestamp, + _resultTallyHash, + _resultCborBytes ); } } function __reportResultAndReward( uint256 _queryId, - uint32 _queryResultTimestamp, - bytes32 _queryResultTallyHash, - bytes calldata _queryResultCborBytes + uint32 _resultTimestamp, + bytes32 _resultTallyHash, + bytes calldata _resultCborBytes ) virtual internal returns (uint256 _evmReward) { _evmReward = __reportResult( _queryId, - _queryResultTimestamp, - _queryResultTallyHash, - _queryResultCborBytes + _resultTimestamp, + _resultTallyHash, + _resultCborBytes ); // transfer reward to reporter __safeTransferTo( @@ -943,9 +943,9 @@ abstract contract WitOracleTrustableBase function __reportResultCallback( uint256 _queryId, - uint64 _queryResultTimestamp, - bytes32 _queryResultTallyHash, - bytes calldata _queryResultCborBytes, + uint64 _resultTimestamp, + bytes32 _resultTallyHash, + bytes calldata _resultCborBytes, address _evmRequester, uint256 _evmCallbackGasLimit ) @@ -957,14 +957,14 @@ abstract contract WitOracleTrustableBase ) { _evmCallbackActualGas = gasleft(); - if (_queryResultCborBytes[0] == bytes1(0xd8)) { - WitnetCBOR.CBOR[] memory _errors = WitnetCBOR.fromBytes(_queryResultCborBytes).readArray(); + if (_resultCborBytes[0] == bytes1(0xd8)) { + WitnetCBOR.CBOR[] memory _errors = WitnetCBOR.fromBytes(_resultCborBytes).readArray(); if (_errors.length < 2) { // try to report result with unknown error: - try IWitOracleConsumer(_evmRequester).reportWitnetQueryError{gas: _evmCallbackGasLimit}( + try IWitOracleConsumer(_evmRequester).reportWitOracleResultError{gas: _evmCallbackGasLimit}( _queryId, - _queryResultTimestamp, - _queryResultTallyHash, + _resultTimestamp, + _resultTallyHash, block.number, Witnet.ResultErrorCodes.Unknown, WitnetCBOR.CBOR({ @@ -982,10 +982,10 @@ abstract contract WitOracleTrustableBase } } else { // try to report result with parsable error: - try IWitOracleConsumer(_evmRequester).reportWitnetQueryError{gas: _evmCallbackGasLimit}( + try IWitOracleConsumer(_evmRequester).reportWitOracleResultError{gas: _evmCallbackGasLimit}( _queryId, - _queryResultTimestamp, - _queryResultTallyHash, + _resultTimestamp, + _resultTallyHash, block.number, Witnet.ResultErrorCodes(_errors[0].readUint()), _errors[0] @@ -997,12 +997,12 @@ abstract contract WitOracleTrustableBase } } else { // try to report result result with no error : - try IWitOracleConsumer(_evmRequester).reportWitnetQueryResult{gas: _evmCallbackGasLimit}( + try IWitOracleConsumer(_evmRequester).reportWitOracleResultValue{gas: _evmCallbackGasLimit}( _queryId, - _queryResultTimestamp, - _queryResultTallyHash, + _resultTimestamp, + _resultTallyHash, block.number, - WitnetCBOR.fromBytes(_queryResultCborBytes) + WitnetCBOR.fromBytes(_resultCborBytes) ) { _evmCallbackSuccess = true; } catch Error(string memory err) { @@ -1029,18 +1029,18 @@ abstract contract WitOracleTrustableBase function __writeQueryQueryResponse( uint256 _queryId, - uint32 _queryResultTimestamp, - bytes32 _queryResultTallyHash, - bytes memory _queryResultCborBytes + uint32 _resultTimestamp, + bytes32 _resultTallyHash, + bytes memory _resultCborBytes ) virtual internal { WitOracleDataLib.seekQuery(_queryId).response = Witnet.QueryResponse({ reporter: msg.sender, finality: uint64(block.number), - resultTimestamp: _queryResultTimestamp, - resultTallyHash: _queryResultTallyHash, - resultCborBytes: _queryResultCborBytes + resultTimestamp: _resultTimestamp, + resultTallyHash: _resultTallyHash, + resultCborBytes: _resultCborBytes }); } diff --git a/contracts/interfaces/IWitFeeds.sol b/contracts/interfaces/IWitFeeds.sol index c3922d89..5d0d9cfb 100644 --- a/contracts/interfaces/IWitFeeds.sol +++ b/contracts/interfaces/IWitFeeds.sol @@ -50,14 +50,14 @@ interface IWitFeeds { /// Returns the Witnet-compliant bytecode of the data retrieving script to be solved by /// the Witnet oracle blockchain upon every update of the given data feed. - function lookupWitnetBytecode(bytes4 feedId) external view returns (bytes memory); + function lookupWitOracleRequestBytecode(bytes4 feedId) external view returns (bytes memory); /// Returns the RAD hash that uniquely identifies the data retrieving script that gets solved /// by the Witnet oracle blockchain upon every update of the given data feed. - function lookupWitnetRadHash(bytes4 feedId) external view returns (bytes32); + function lookupWitOracleRequestRadHash(bytes4 feedId) external view returns (bytes32); /// Returns the list of actual data sources and offchain computations for the given data feed. - function lookupWitnetRetrievals(bytes4 feedId) external view returns (Witnet.RadonRetrieval[] memory); + function lookupWitOracleRadonRetrievals(bytes4 feedId) external view returns (Witnet.RadonRetrieval[] memory); /// Triggers a fresh update on the Witnet oracle blockchain for the given data feed, /// using the defaultRadonSLA() security parameters. diff --git a/contracts/interfaces/IWitOracle.sol b/contracts/interfaces/IWitOracle.sol index b9670c9b..afd11bac 100644 --- a/contracts/interfaces/IWitOracle.sol +++ b/contracts/interfaces/IWitOracle.sol @@ -99,7 +99,7 @@ interface IWitOracle { /// @notice Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by /// @notice the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the /// @notice reporter who relays back the Witnet-provable result to this request. The Witnet-provable result will be reported - /// @notice directly to the requesting contract. If the report callback fails for any reason, an `WitnetQueryResponseDeliveryFailed` + /// @notice directly to the requesting contract. If the report callback fails for any reason, an `WitOracleQueryResponseDeliveryFailed` /// @notice will be triggered, and the Witnet audit trail will be saved in storage, but not so the actual CBOR-encoded result. /// @dev Reasons to fail: /// @dev - the caller is not a contract implementing the IWitOracleConsumer interface; @@ -126,7 +126,7 @@ interface IWitOracle { /// @notice Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by /// @notice the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the /// @notice reporter who relays back the Witnet-provable result to this request. The Witnet-provable result will be reported - /// @notice directly to the requesting contract. If the report callback fails for any reason, a `WitnetQueryResponseDeliveryFailed` + /// @notice directly to the requesting contract. If the report callback fails for any reason, a `WitOracleQueryResponseDeliveryFailed` /// @notice event will be triggered, and the Witnet audit trail will be saved in storage, but not so the CBOR-encoded result. /// @dev Reasons to fail: /// @dev - the caller is not a contract implementing the IWitOracleConsumer interface; diff --git a/contracts/interfaces/IWitOracleConsumer.sol b/contracts/interfaces/IWitOracleConsumer.sol index 13642e41..7d58196e 100644 --- a/contracts/interfaces/IWitOracleConsumer.sol +++ b/contracts/interfaces/IWitOracleConsumer.sol @@ -9,16 +9,16 @@ interface IWitOracleConsumer { /// @notice gets reported, if reported with no errors. /// @dev It should revert if called from any other address different to the WitOracle being used /// @dev by the WitOracleConsumer contract. - /// @param witnetQueryId The unique identifier of the Witnet query being reported. - /// @param witnetResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. - /// @param witnetResultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. - /// @param witnetEvmFinalityBlock EVM block at which the provided data can be considered to be final. + /// @param queryId The unique identifier of the Witnet query being reported. + /// @param resultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. + /// @param resultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. + /// @param resultEvmFinalityBlock EVM block at which the provided data can be considered to be final. /// @param witnetResultCborValue The CBOR-encoded resulting value of the Witnet query being reported. - function reportWitnetQueryResult( - uint256 witnetQueryId, - uint64 witnetResultTimestamp, - bytes32 witnetResultTallyHash, - uint256 witnetEvmFinalityBlock, + function reportWitOracleResultValue( + uint256 queryId, + uint64 resultTimestamp, + bytes32 resultTallyHash, + uint256 resultEvmFinalityBlock, WitnetCBOR.CBOR calldata witnetResultCborValue ) external; @@ -26,17 +26,17 @@ interface IWitOracleConsumer { /// @notice gets reported, if reported WITH errors. /// @dev It should revert if called from any other address different to the WitOracle being used /// @dev by the WitOracleConsumer contract. - /// @param witnetQueryId The unique identifier of the Witnet query being reported. - /// @param witnetResultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. - /// @param witnetResultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. - /// @param witnetEvmFinalityBlock EVM block at which the provided data can be considered to be final. + /// @param queryId The unique identifier of the Witnet query being reported. + /// @param resultTallyHash Hash of the commit/reveal witnessing act that took place in the Witnet blockahin. + /// @param resultTimestamp Timestamp at which the reported value was captured by the Witnet blockchain. + /// @param resultEvmFinalityBlock EVM block at which the provided data can be considered to be final. /// @param errorCode The error code enum identifying the error produced during resolution on the Witnet blockchain. /// @param errorArgs Error arguments, if any. An empty buffer is to be passed if no error arguments apply. - function reportWitnetQueryError( - uint256 witnetQueryId, - uint64 witnetResultTimestamp, - bytes32 witnetResultTallyHash, - uint256 witnetEvmFinalityBlock, + function reportWitOracleResultError( + uint256 queryId, + uint64 resultTimestamp, + bytes32 resultTallyHash, + uint256 resultEvmFinalityBlock, Witnet.ResultErrorCodes errorCode, WitnetCBOR.CBOR calldata errorArgs ) external; diff --git a/contracts/interfaces/IWitOracleEvents.sol b/contracts/interfaces/IWitOracleEvents.sol index 5682818d..ce7f3e48 100644 --- a/contracts/interfaces/IWitOracleEvents.sol +++ b/contracts/interfaces/IWitOracleEvents.sol @@ -6,7 +6,7 @@ import "../libs/Witnet.sol"; interface IWitOracleEvents { /// Emitted every time a new query containing some verified data request is posted to the WitOracle. - event WitnetQuery( + event WitOracleQuery( address evmRequester, uint256 evmGasPrice, uint256 evmReward, @@ -16,7 +16,7 @@ interface IWitOracleEvents { ); /// Emitted every time a new query containing some unverified data request bytecode is posted to the WRB. - event WitnetQuery( + event WitOracleQuery( address evmRequester, uint256 evmGasPrice, uint256 evmReward, @@ -26,7 +26,7 @@ interface IWitOracleEvents { ); /// Emitted when the reward of some not-yet reported query gets upgraded. - event WitnetQueryUpgrade( + event WitOracleQueryUpgrade( uint256 queryId, address evmSender, uint256 evmGasPrice, @@ -34,20 +34,20 @@ interface IWitOracleEvents { ); /// Emitted when a query with no callback gets reported into the WRB. - event WitnetQueryResponse( + event WitOracleQueryResponse( uint256 queryId, uint256 evmGasPrice ); /// Emitted when a query with a callback gets successfully reported into the WRB. - event WitnetQueryReponseDelivered( + event WitOracleQueryReponseDelivered( uint256 queryId, uint256 evmGasPrice, uint256 evmCallbackGas ); /// Emitted when a query with a callback cannot get reported into the WRB. - event WitnetQueryResponseDeliveryFailed( + event WitOracleQueryResponseDeliveryFailed( uint256 queryId, uint256 evmGasPrice, uint256 evmCallbackActualGas, diff --git a/contracts/interfaces/IWitOracleReporter.sol b/contracts/interfaces/IWitOracleReporter.sol index 5405b3fe..54264dc8 100644 --- a/contracts/interfaces/IWitOracleReporter.sol +++ b/contracts/interfaces/IWitOracleReporter.sol @@ -12,7 +12,7 @@ interface IWitOracleReporter { /// @notice based on the gas price of the calling transaction. Data requesters should consider upgrading the reward on /// @notice queries providing no actual earnings. function estimateReportEarnings( - uint256[] calldata witnetQueryIds, + uint256[] calldata queryIds, bytes calldata reportTxMsgData, uint256 reportTxGasPrice, uint256 nanoWitPrice @@ -27,37 +27,37 @@ interface IWitOracleReporter { /// @notice Reports the Witnet-provided result to a previously posted request. /// @dev Will assume `block.timestamp` as the timestamp at which the request was solved. /// @dev Fails if: - /// @dev - the `_witnetQueryId` is not in 'Posted' status. + /// @dev - the `_queryId` is not in 'Posted' status. /// @dev - provided `_tallyHash` is zero; /// @dev - length of provided `_result` is zero. - /// @param witnetQueryId The unique identifier of the data request. - /// @param witnetQueryResultTallyHash The hash of the corresponding data request transaction in Witnet. - /// @param witnetQueryResultCborBytes The result itself as bytes. + /// @param queryId The unique identifier of the data request. + /// @param resultTallyHash The hash of the corresponding data request transaction in Witnet. + /// @param resultCborBytes The result itself as bytes. function reportResult( - uint256 witnetQueryId, - bytes32 witnetQueryResultTallyHash, - bytes calldata witnetQueryResultCborBytes + uint256 queryId, + bytes32 resultTallyHash, + bytes calldata resultCborBytes ) external returns (uint256); /// @notice Reports the Witnet-provided result to a previously posted request. /// @dev Fails if: /// @dev - called from unauthorized address; - /// @dev - the `_witnetQueryId` is not in 'Posted' status. + /// @dev - the `_queryId` is not in 'Posted' status. /// @dev - provided `_tallyHash` is zero; /// @dev - length of provided `_result` is zero. - /// @param witnetQueryId The unique query identifier - /// @param witnetQueryResultTimestamp The timestamp of the solving tally transaction in Witnet. - /// @param witnetQueryResultTallyHash The hash of the corresponding data request transaction in Witnet. - /// @param witnetQueryResultCborBytes The result itself as bytes. + /// @param queryId The unique query identifier + /// @param resultTimestamp The timestamp of the solving tally transaction in Witnet. + /// @param resultTallyHash The hash of the corresponding data request transaction in Witnet. + /// @param resultCborBytes The result itself as bytes. function reportResult( - uint256 witnetQueryId, - uint32 witnetQueryResultTimestamp, - bytes32 witnetQueryResultTallyHash, - bytes calldata witnetQueryResultCborBytes + uint256 queryId, + uint32 resultTimestamp, + bytes32 resultTallyHash, + bytes calldata resultCborBytes ) external returns (uint256); /// @notice Reports Witnet-provided results to multiple requests within a single EVM tx. - /// @notice Emits either a WitnetQueryResponse* or a BatchReportError event per batched report. + /// @notice Emits either a WitOracleQueryResponse* or a BatchReportError event per batched report. /// @dev Fails only if called from unauthorized address. /// @param _batchResults Array of BatchResult structs, every one containing: /// - unique query identifier; @@ -68,9 +68,9 @@ interface IWitOracleReporter { struct BatchResult { uint256 queryId; - uint32 queryResultTimestamp; - bytes32 queryResultTallyHash; - bytes queryResultCborBytes; + uint32 resultTimestamp; + bytes32 resultTallyHash; + bytes resultCborBytes; } event BatchReportError(uint256 queryId, string reason); diff --git a/contracts/interfaces/IWitRandomness.sol b/contracts/interfaces/IWitRandomness.sol index a45a7458..23ddadb9 100644 --- a/contracts/interfaces/IWitRandomness.sol +++ b/contracts/interfaces/IWitRandomness.sol @@ -32,13 +32,13 @@ interface IWitRandomness { /// @dev iii. all `randomize()` requests that took place on or after the given block were solved with errors. /// @param blockNumber Block number from which the search will start. /// @return witnetResultRandomness Random value provided by the Witnet blockchain and used for solving randomness after given block. - /// @return witnetResultTimestamp Timestamp at which the randomness value was generated by the Witnet blockchain. - /// @return witnetResultTallyHash Hash of the witnessing commit/reveal act that took place on the Witnet blockchain. + /// @return resultTimestamp Timestamp at which the randomness value was generated by the Witnet blockchain. + /// @return resultTallyHash Hash of the witnessing commit/reveal act that took place on the Witnet blockchain. /// @return witnetResultFinalityBlock EVM block number from which the provided randomness can be considered to be final. function fetchRandomnessAfterProof(uint256 blockNumber) external view returns ( bytes32 witnetResultRandomness, - uint64 witnetResultTimestamp, - bytes32 witnetResultTallyHash, + uint64 resultTimestamp, + bytes32 resultTallyHash, uint256 witnetResultFinalityBlock ); @@ -48,11 +48,11 @@ interface IWitRandomness { /// @notice Retrieves metadata related to the randomize request that got posted to the /// @notice Witnet Oracle contract on the given block number. /// @dev Returns zero values if no randomize request was actually posted on the given block. - /// @return witnetQueryId Identifier of the underlying Witnet query created on the given block number. + /// @return queryId Identifier of the underlying Witnet query created on the given block number. /// @return prevRandomizeBlock Block number in which a randomize request got posted just before this one. 0 if none. /// @return nextRandomizeBlock Block number in which a randomize request got posted just after this one, 0 if none. function getRandomizeData(uint256 blockNumber) external view returns ( - uint256 witnetQueryId, + uint256 queryId, uint256 prevRandomizeBlock, uint256 nextRandomizeBlock ); @@ -98,7 +98,7 @@ interface IWitRandomness { /// @notice while fulfilling the given SLA data security parameters. /// @dev Only one randomness request per block will be actually posted to the Witnet Oracle. /// @dev Unused funds will be transferred back to the `msg.sender`. - /// @dev Passed SLA security parameters must be equal or greater than `witnetQuerySLA()`. + /// @dev Passed SLA security parameters must be equal or greater than `witOracleQuerySLA()`. /// @return Funds actually paid as randomize fee. function randomize(Witnet.RadonSLA calldata) external payable returns (uint256); @@ -106,8 +106,8 @@ interface IWitRandomness { /// @notice when solving randomness requests: /// @notice - number of witnessing nodes contributing to randomness generation /// @notice - reward in $nanoWIT received per witnessing node in the Witnet blockchain - function witnetQuerySLA() external view returns (Witnet.RadonSLA memory); + function witOracleQuerySLA() external view returns (Witnet.RadonSLA memory); /// @notice Returns the unique identifier of the Witnet-compliant data request being used for solving randomness. - function witnetRadHash() external view returns (bytes32); + function witOracleQueryRadHash() external view returns (bytes32); } diff --git a/contracts/interfaces/IWitRandomnessAdmin.sol b/contracts/interfaces/IWitRandomnessAdmin.sol index d7ad145d..ecfcfa8e 100644 --- a/contracts/interfaces/IWitRandomnessAdmin.sol +++ b/contracts/interfaces/IWitRandomnessAdmin.sol @@ -11,5 +11,5 @@ interface IWitRandomnessAdmin { function pendingOwner() external returns (address); function transferOwnership(address) external; function settleBaseFeeOverheadPercentage(uint16) external; - function settleWitnetQuerySLA(Witnet.RadonSLA calldata) external; + function settleDefaultQuerySLA(Witnet.RadonSLA calldata) external; } \ No newline at end of file diff --git a/contracts/mockups/UsingWitOracle.sol b/contracts/mockups/UsingWitOracle.sol index 555d4e80..19659ebe 100644 --- a/contracts/mockups/UsingWitOracle.sol +++ b/contracts/mockups/UsingWitOracle.sol @@ -47,8 +47,8 @@ abstract contract UsingWitOracle /// @dev Provides a convenient way for client contracts extending this to block the execution of the main logic of the /// @dev contract until a particular request has been successfully solved and reported by Witnet, /// @dev either with an error or successfully. - modifier witnetQuerySolved(uint256 _witnetQueryId) { - require(_witnetCheckQueryResultAvailability(_witnetQueryId), "UsingWitOracle: unsolved query"); + modifier witnetQuerySolved(uint256 _queryId) { + require(_witnetCheckQueryResultAvailability(_queryId), "UsingWitOracle: unsolved query"); _; } @@ -76,17 +76,17 @@ abstract contract UsingWitOracle ) / 100; } - function _witnetCheckQueryQueryResponseStatus(uint256 _witnetQueryId) + function _witnetCheckQueryQueryResponseStatus(uint256 _queryId) internal view returns (Witnet.QueryResponseStatus) { - return __witnet.getQueryResponseStatus(_witnetQueryId); + return __witnet.getQueryResponseStatus(_queryId); } - function _witnetCheckQueryResultError(uint256 _witnetQueryId) + function _witnetCheckQueryResultError(uint256 _queryId) internal view returns (Witnet.ResultError memory) { - return __witnet.getQueryResultError(_witnetQueryId); + return __witnet.getQueryResultError(_queryId); } } diff --git a/contracts/mockups/UsingWitOracleRequest.sol b/contracts/mockups/UsingWitOracleRequest.sol index f565a06e..531a5afd 100644 --- a/contracts/mockups/UsingWitOracleRequest.sol +++ b/contracts/mockups/UsingWitOracleRequest.sol @@ -36,13 +36,13 @@ abstract contract UsingWitOracleRequest function __witnetRequestData( uint256 _witnetEvmReward, - Witnet.RadonSLA memory _witnetQuerySLA + Witnet.RadonSLA memory _witOracleQuerySLA ) virtual internal returns (uint256) { return __witnet.postRequest{value: _witnetEvmReward}( __witnetRequestRadHash, - _witnetQuerySLA + _witOracleQuerySLA ); } } diff --git a/contracts/mockups/UsingWitOracleRequestTemplate.sol b/contracts/mockups/UsingWitOracleRequestTemplate.sol index 17797323..a78248b8 100644 --- a/contracts/mockups/UsingWitOracleRequestTemplate.sol +++ b/contracts/mockups/UsingWitOracleRequestTemplate.sol @@ -51,13 +51,13 @@ abstract contract UsingWitOracleRequestTemplate function __witnetRequestData( uint256 _witnetEvmReward, string[][] memory _witnetRequestArgs, - Witnet.RadonSLA memory _witnetQuerySLA + Witnet.RadonSLA memory _witOracleQuerySLA ) virtual internal returns (uint256) { return __witnet.postRequest{value: _witnetEvmReward}( _witnetBuildRadHash(_witnetRequestArgs), - _witnetQuerySLA + _witOracleQuerySLA ); } } diff --git a/contracts/mockups/WitOracleRequestConsumer.sol b/contracts/mockups/WitOracleRequestConsumer.sol index 8d7f7558..93271b50 100644 --- a/contracts/mockups/WitOracleRequestConsumer.sol +++ b/contracts/mockups/WitOracleRequestConsumer.sol @@ -34,7 +34,7 @@ abstract contract WitOracleRequestConsumer function __witnetRequestData( uint256 _witnetEvmReward, - Witnet.RadonSLA memory _witnetQuerySLA + Witnet.RadonSLA memory _witOracleQuerySLA ) virtual override internal returns (uint256) @@ -43,7 +43,7 @@ abstract contract WitOracleRequestConsumer value: _witnetEvmReward }( __witnetRequestRadHash, - _witnetQuerySLA, + _witOracleQuerySLA, __witnetCallbackGasLimit ); } diff --git a/contracts/mockups/WitOracleRequestTemplateConsumer.sol b/contracts/mockups/WitOracleRequestTemplateConsumer.sol index 862d1924..98ed7d59 100644 --- a/contracts/mockups/WitOracleRequestTemplateConsumer.sol +++ b/contracts/mockups/WitOracleRequestTemplateConsumer.sol @@ -35,7 +35,7 @@ abstract contract WitOracleRequestTemplateConsumer function __witnetRequestData( uint256 _witnetEvmReward, string[][] memory _witnetRequestArgs, - Witnet.RadonSLA memory _witnetQuerySLA + Witnet.RadonSLA memory _witOracleQuerySLA ) virtual override internal returns (uint256) @@ -44,7 +44,7 @@ abstract contract WitOracleRequestTemplateConsumer value: _witnetEvmReward }( _witnetBuildRadHash(_witnetRequestArgs), - _witnetQuerySLA, + _witOracleQuerySLA, __witnetCallbackGasLimit ); } diff --git a/contracts/mockups/WitRandomnessRequestConsumer.sol b/contracts/mockups/WitRandomnessRequestConsumer.sol index 8bb04127..e3a001b9 100644 --- a/contracts/mockups/WitRandomnessRequestConsumer.sol +++ b/contracts/mockups/WitRandomnessRequestConsumer.sol @@ -74,7 +74,7 @@ abstract contract WitRandomnessRequestConsumer function __witnetRandomize( uint256 _witnetEvmReward, - Witnet.RadonSLA memory _witnetQuerySLA + Witnet.RadonSLA memory _witOracleQuerySLA ) virtual internal returns (uint256 _randomizeId) @@ -83,7 +83,7 @@ abstract contract WitRandomnessRequestConsumer value: _witnetEvmReward }( __witnetRandomnessRadHash, - _witnetQuerySLA, + _witOracleQuerySLA, __witnetCallbackGasLimit ); } diff --git a/test/TestWitnetV2.sol b/test/TestWitnetV2.sol index 67dc801e..4458b56a 100644 --- a/test/TestWitnetV2.sol +++ b/test/TestWitnetV2.sol @@ -59,7 +59,7 @@ contract TestWitnetV2 { return __request; } - function testWitnetQueryResponsePacking() external { + function testWitOracleQueryResponsePacking() external { __response = Witnet.QueryResponse({ reporter: msg.sender, finality: uint64(block.number), @@ -69,7 +69,7 @@ contract TestWitnetV2 { }); } - function testWitnetQueryResponseUnpacking() external returns (Witnet.QueryResponse memory) { + function testWitOracleQueryResponseUnpacking() external returns (Witnet.QueryResponse memory) { return __response; } diff --git a/test/mocks/MyDapp.sol b/test/mocks/MyDapp.sol index fa7e3646..d7ca9672 100644 --- a/test/mocks/MyDapp.sol +++ b/test/mocks/MyDapp.sol @@ -61,7 +61,7 @@ contract MyDapp /// @dev by the WitOracleConsumer contract. Within the implementation of this method, the WitOracleConsumer /// @dev can call to the WRB as to retrieve the Witnet tracking information (i.e. the `witnetDrTxHash` /// @dev and `witnetDrCommitTxTimestamp`), or the finality status, of the result being reported. - function reportWitnetQueryResult( + function reportWitOracleResultValue( uint256 _queryId, uint64, bytes32, uint256, WitnetCBOR.CBOR calldata witnetResultCborValue ) @@ -74,15 +74,15 @@ contract MyDapp // emit Result(queryId, _witnetReadRandomizeFromResultValue(cborValue)); } - function reportWitnetQueryError( - uint256 witnetQueryId, + function reportWitOracleResultError( + uint256 queryId, uint64, bytes32, uint256, Witnet.ResultErrorCodes errorCode, WitnetCBOR.CBOR calldata ) virtual external onlyFromWitnet { - emit Error(witnetQueryId, errorCode); + emit Error(queryId, errorCode); } From a029bc7f5b6b409c9b51d816cea16b249f8e58c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Mon, 5 Aug 2024 11:03:10 +0200 Subject: [PATCH 25/39] refactor: merge IFeed into IWitFeeds --- contracts/WitFeeds.sol | 2 -- contracts/interfaces/IFeeds.sol | 12 ------------ contracts/interfaces/IWitFeeds.sol | 26 ++++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 14 deletions(-) delete mode 100644 contracts/interfaces/IFeeds.sol diff --git a/contracts/WitFeeds.sol b/contracts/WitFeeds.sol index 9248d04c..4039f470 100644 --- a/contracts/WitFeeds.sol +++ b/contracts/WitFeeds.sol @@ -2,7 +2,6 @@ pragma solidity >=0.7.0 <0.9.0; -import "./interfaces/IFeeds.sol"; import "./interfaces/IWitFeeds.sol"; import "./interfaces/IWitFeedsEvents.sol"; import "./interfaces/IWitOracleAppliance.sol"; @@ -12,7 +11,6 @@ import "ado-contracts/contracts/interfaces/IERC2362.sol"; abstract contract WitFeeds is IERC2362, - IFeeds, IWitFeeds, IWitFeedsEvents, IWitOracleAppliance, diff --git a/contracts/interfaces/IFeeds.sol b/contracts/interfaces/IFeeds.sol deleted file mode 100644 index 92b9715d..00000000 --- a/contracts/interfaces/IFeeds.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity >=0.8.0 <0.9.0; - -interface IFeeds { - function footprint() external view returns (bytes4); - function hash(string calldata caption) external pure returns (bytes4); - function lookupCaption(bytes4) external view returns (string memory); - function supportedFeeds() external view returns (bytes4[] memory, string[] memory, bytes32[] memory); - function supportsCaption(string calldata) external view returns (bool); - function totalFeeds() external view returns (uint256); -} diff --git a/contracts/interfaces/IWitFeeds.sol b/contracts/interfaces/IWitFeeds.sol index 5d0d9cfb..851b767b 100644 --- a/contracts/interfaces/IWitFeeds.sol +++ b/contracts/interfaces/IWitFeeds.sol @@ -22,6 +22,16 @@ interface IWitFeeds { /// update with the given the _evmGasPrice value. function estimateUpdateRequestFee(uint256 evmGasPrice) external view returns (uint); + /// Returns a unique hash determined by the combination of data sources being used by + /// supported non-routed price feeds, and dependencies of all supported routed + /// price feeds. The footprint changes if any price feed is modified, added, removed + /// or if the dependency tree of any routed price feed is altered. + function footprint() external view returns (bytes4); + + /// This pure function determines the ERC-2362 identifier of the given data feed + /// caption string, truncated to bytes4. + function hash(string calldata caption) external pure returns (bytes4); + /// Returns the query id (in the context of the WitOracle addressed by witnet()) /// that solved the most recently updated value for the given feed. function lastValidQueryId(bytes4 feedId) external view returns (uint256); @@ -48,6 +58,9 @@ interface IWitFeeds { /// update attempt for the given data feed, if any. function latestUpdateResultError(bytes4 feedId) external view returns (Witnet.ResultError memory); + /// Returns the ERC-2362 caption of the given feed identifier, if known. + function lookupCaption(bytes4) external view returns (string memory); + /// Returns the Witnet-compliant bytecode of the data retrieving script to be solved by /// the Witnet oracle blockchain upon every update of the given data feed. function lookupWitOracleRequestBytecode(bytes4 feedId) external view returns (bytes memory); @@ -66,4 +79,17 @@ interface IWitFeeds { /// Triggers a fresh update for the given data feed, requiring also the SLA data security parameters /// that will have to be fulfilled on Witnet. function requestUpdate(bytes4 feedId, Witnet.RadonSLA calldata updateSLA) external payable returns (uint256 usedFunds); + + /// Returns the list of feed ERC-2362 ids, captions and RAD hashes of all currently supported + /// data feeds. The RAD hash of a data feed determines in a verifiable way the actual data sources + /// and off-chain computations solved by the Witnet oracle blockchain upon every data update. + /// The RAD hash value for a routed feed actually contains the address of the IWitnetPriceSolver + /// logic contract that solves it. + function supportedFeeds() external view returns (bytes4[] memory, string[] memory, bytes32[] memory); + + /// Tells whether the given ERC-2362 feed caption is currently supported. + function supportsCaption(string calldata) external view returns (bool); + + /// Total number of data feeds, routed or not, that are currently supported. + function totalFeeds() external view returns (uint256); } From 7cc31f8eab66d331d242df872bf97740c200bad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Mon, 5 Aug 2024 11:13:24 +0200 Subject: [PATCH 26/39] refactor: IWitOracleAppliance.witnet() -> witOracle() --- contracts/WitPriceFeeds.sol | 5 +- contracts/apps/WitPriceFeedsV21.sol | 36 +++---- contracts/apps/WitRandomnessV21.sol | 44 ++++----- .../core/trustable/WitOracleTrustableBase.sol | 2 +- .../WitOracleRadonRegistryDefault.sol | 6 +- .../WitOracleRadonRegistryNoSha256.sol | 2 +- .../WitOracleRequestFactoryCfxCore.sol | 4 +- .../WitOracleRequestFactoryDefault.sol | 98 +++++++++---------- .../data/WitOracleRequestFactoryData.sol | 6 +- contracts/interfaces/IWitFeeds.sol | 2 +- contracts/interfaces/IWitOracleAppliance.sol | 2 +- .../interfaces/IWitOracleRequestTemplate.sol | 2 +- contracts/mockups/UsingWitOracle.sol | 36 +++---- .../mockups/UsingWitOracleRandomness.sol | 10 +- contracts/mockups/UsingWitOracleRequest.sol | 28 +++--- .../mockups/UsingWitOracleRequestTemplate.sol | 38 +++---- contracts/mockups/WitOracleConsumer.sol | 22 ++--- .../mockups/WitOracleRequestConsumer.sol | 22 ++--- .../WitOracleRequestTemplateConsumer.sol | 24 ++--- .../mockups/WitRandomnessRequestConsumer.sol | 28 +++--- migrations/scripts/3_core.js | 4 +- migrations/scripts/5_apps.js | 2 +- test/mocks/MyDapp.sol | 14 +-- 23 files changed, 220 insertions(+), 217 deletions(-) diff --git a/contracts/WitPriceFeeds.sol b/contracts/WitPriceFeeds.sol index e2de2b55..94c4908e 100644 --- a/contracts/WitPriceFeeds.sol +++ b/contracts/WitPriceFeeds.sol @@ -13,6 +13,9 @@ abstract contract WitPriceFeeds IWitPriceFeeds { constructor() - WitFeeds(Witnet.RadonDataTypes.Integer, "Price-") + WitFeeds( + Witnet.RadonDataTypes.Integer, + "Price-" + ) {} } diff --git a/contracts/apps/WitPriceFeedsV21.sol b/contracts/apps/WitPriceFeedsV21.sol index de991eb5..3af65105 100644 --- a/contracts/apps/WitPriceFeedsV21.sol +++ b/contracts/apps/WitPriceFeedsV21.sol @@ -36,14 +36,14 @@ contract WitPriceFeedsV21 } bytes4 immutable public override specs = type(WitPriceFeeds).interfaceId; - WitOracle immutable public override witnet; + WitOracle immutable public override witOracle; WitOracleRadonRegistry immutable internal __registry; Witnet.RadonSLA private __defaultRadonSLA; uint16 private __baseFeeOverheadPercentage; constructor( - WitOracle _wrb, + WitOracle _witOracle, bool _upgradable, bytes32 _versionTag ) @@ -54,11 +54,11 @@ contract WitPriceFeedsV21 "io.witnet.proxiable.feeds.price" ) { - witnet = _wrb; + witOracle = _witOracle; } function _registry() virtual internal view returns (WitOracleRadonRegistry) { - return witnet.registry(); + return witOracle.registry(); } // solhint-disable-next-line payable-fallback @@ -127,11 +127,11 @@ contract WitPriceFeedsV21 __proxiable().codehash = codehash(); _require( - address(witnet).code.length > 0, + address(witOracle).code.length > 0, "inexistent oracle" ); _require( - witnet.specs() == type(WitOracle).interfaceId, + witOracle.specs() == type(WitOracle).interfaceId, "uncompliant oracle" ); emit Upgraded(_owner, base(), codehash(), version()); @@ -233,7 +233,7 @@ contract WitPriceFeedsV21 public view returns (uint) { - return (IWitOracleLegacy(address(witnet)).estimateBaseFee(_evmGasPrice, 32) + return (IWitOracleLegacy(address(witOracle)).estimateBaseFee(_evmGasPrice, 32) * (100 + __baseFeeOverheadPercentage) ) / 100; } @@ -249,7 +249,7 @@ contract WitPriceFeedsV21 override public view returns (Witnet.QueryResponse memory) { - return witnet.getQueryResponse(_lastValidQueryId(feedId)); + return witOracle.getQueryResponse(_lastValidQueryId(feedId)); } function latestUpdateQueryId(bytes4 feedId) @@ -263,21 +263,21 @@ contract WitPriceFeedsV21 override external view returns (Witnet.QueryRequest memory) { - return witnet.getQueryRequest(latestUpdateQueryId(feedId)); + return witOracle.getQueryRequest(latestUpdateQueryId(feedId)); } function latestUpdateQueryResponse(bytes4 feedId) override external view returns (Witnet.QueryResponse memory) { - return witnet.getQueryResponse(latestUpdateQueryId(feedId)); + return witOracle.getQueryResponse(latestUpdateQueryId(feedId)); } function latestUpdateResultError(bytes4 feedId) override external view returns (Witnet.ResultError memory) { - return witnet.getQueryResultError(latestUpdateQueryId(feedId)); + return witOracle.getQueryResultError(latestUpdateQueryId(feedId)); } function latestUpdateQueryResponseStatus(bytes4 feedId) @@ -688,7 +688,7 @@ contract WitPriceFeedsV21 returns (Witnet.QueryResponseStatus) { if (_queryId > 0) { - return witnet.getQueryResponseStatus(_queryId); + return witOracle.getQueryResponseStatus(_queryId); } else { return Witnet.QueryResponseStatus.Ready; } @@ -709,7 +709,7 @@ contract WitPriceFeedsV21 uint _latestUpdateQueryId = latestUpdateQueryId(feedId); if ( _latestUpdateQueryId > 0 - && witnet.getQueryResponseStatus(_latestUpdateQueryId) == Witnet.QueryResponseStatus.Ready + && witOracle.getQueryResponseStatus(_latestUpdateQueryId) == Witnet.QueryResponseStatus.Ready ) { return _latestUpdateQueryId; } else { @@ -751,11 +751,11 @@ contract WitPriceFeedsV21 if (_latestStatus == Witnet.QueryResponseStatus.Awaiting) { // latest update is still pending, so just increase the reward // accordingly to current tx gasprice: - Witnet.QueryRequest memory _request = witnet.getQueryRequest(_latestId); + Witnet.QueryRequest memory _request = witOracle.getQueryRequest(_latestId); int _deltaReward = int(int72(_request.evmReward)) - int(_usedFunds); if (_deltaReward > 0) { _usedFunds = uint(_deltaReward); - witnet.upgradeQueryEvmReward{value: _usedFunds}(_latestId); + witOracle.upgradeQueryEvmReward{value: _usedFunds}(_latestId); } else { _usedFunds = 0; } @@ -764,16 +764,16 @@ contract WitPriceFeedsV21 if (_latestStatus == Witnet.QueryResponseStatus.Ready) { // If so, remove previous last valid query from the WRB: if (__feed.lastValidQueryId > 0) { - witnet.fetchQueryResponse(__feed.lastValidQueryId); + witOracle.fetchQueryResponse(__feed.lastValidQueryId); } __feed.lastValidQueryId = _latestId; } else { // Otherwise, try to delete latest query, as it was faulty // and we are about to post a new update request: - try witnet.fetchQueryResponse(_latestId) {} catch {} + try witOracle.fetchQueryResponse(_latestId) {} catch {} } // Post update request to the WRB: - _latestId = witnet.postRequest{value: _usedFunds}( + _latestId = witOracle.postRequest{value: _usedFunds}( __feed.radHash, querySLA ); diff --git a/contracts/apps/WitRandomnessV21.sol b/contracts/apps/WitRandomnessV21.sol index 0edc132f..d089fbc8 100644 --- a/contracts/apps/WitRandomnessV21.sol +++ b/contracts/apps/WitRandomnessV21.sol @@ -36,19 +36,19 @@ contract WitRandomnessV21 bytes32 immutable public override witOracleQueryRadHash; constructor( - WitOracle _witnet, + WitOracle _witOracle, address _operator ) Ownable(_operator) - UsingWitOracle(_witnet) + UsingWitOracle(_witOracle) { _require( - address(_witnet) == address(0) - || _witnet.specs() == type(WitOracle).interfaceId, + address(_witOracle) == address(0) + || _witOracle.specs() == type(WitOracle).interfaceId, "uncompliant oracle" ); // Build Witnet-compliant randomness request: - WitOracleRadonRegistry _registry = witnet().registry(); + WitOracleRadonRegistry _registry = witOracle().registry(); witOracleQueryRadHash = _registry.verifyRadonRequest( abi.decode( abi.encode([ @@ -70,7 +70,7 @@ contract WitRandomnessV21 filters: new Witnet.RadonFilter[](0) }) ); - __witnetDefaultSLA.maxTallyResultSize = 34; + __witOracleDefaultSLA.maxTallyResultSize = 34; } receive() virtual external payable { @@ -95,10 +95,10 @@ contract WitRandomnessV21 return type(WitRandomness).interfaceId; } - function witnet() override (IWitOracleAppliance, UsingWitOracle) + function witOracle() override (IWitOracleAppliance, UsingWitOracle) public view returns (WitOracle) { - return UsingWitOracle.witnet(); + return UsingWitOracle.witOracle(); } @@ -113,8 +113,8 @@ contract WitRandomnessV21 returns (uint256) { return ( - __witnet.estimateBaseFee(_evmGasPrice) - * (100 + __witnetBaseFeeOverheadPercentage) + __witOracle.estimateBaseFee(_evmGasPrice) + * (100 + __witOracleBaseFeeOverheadPercentage) ) / 100; } @@ -154,10 +154,10 @@ contract WitRandomnessV21 "not randomized" ); - Witnet.QueryResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); + Witnet.QueryResponseStatus _status = __witOracle.getQueryResponseStatus(_queryId); if (_status == Witnet.QueryResponseStatus.Ready) { return ( - __witnet.getQueryResultCborBytes(_queryId) + __witOracle.getQueryResultCborBytes(_queryId) .toWitnetResult() .asBytes32() ); @@ -207,9 +207,9 @@ contract WitRandomnessV21 "not randomized" ); - Witnet.QueryResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); + Witnet.QueryResponseStatus _status = __witOracle.getQueryResponseStatus(_queryId); if (_status == Witnet.QueryResponseStatus.Ready) { - Witnet.QueryResponse memory _queryResponse = __witnet.getQueryResponse(_queryId); + Witnet.QueryResponse memory _queryResponse = __witOracle.getQueryResponse(_queryId); _resultTimestamp = _queryResponse.resultTimestamp; _resultTallyHash = _queryResponse.resultTallyHash; _resultFinalityBlock = _queryResponse.finality; @@ -310,7 +310,7 @@ contract WitRandomnessV21 return Witnet.QueryResponseStatus.Void; } else { - Witnet.QueryResponseStatus _status = __witnet.getQueryResponseStatus(_queryId); + Witnet.QueryResponseStatus _status = __witOracle.getQueryResponseStatus(_queryId); if (_status == Witnet.QueryResponseStatus.Error) { uint256 _nextRandomizeBlock = __storage().randomize_[_blockNumber].nextBlock; if (_nextRandomizeBlock != 0) { @@ -367,7 +367,7 @@ contract WitRandomnessV21 virtual override returns (uint256) { - return __postRandomizeQuery(__witnetDefaultSLA); + return __postRandomizeQuery(__witOracleDefaultSLA); } /// @notice Requests the Witnet oracle to generate an EVM-agnostic and trustless source of randomness. @@ -380,7 +380,7 @@ contract WitRandomnessV21 returns (uint256) { _require( - _querySLA.equalOrGreaterThan(__witnetDefaultSLA), + _querySLA.equalOrGreaterThan(__witOracleDefaultSLA), "unsecure randomize" ); return __postRandomizeQuery(_querySLA); @@ -395,7 +395,7 @@ contract WitRandomnessV21 external view returns (Witnet.RadonSLA memory) { - return __witnetDefaultSLA; + return __witOracleDefaultSLA; } @@ -414,7 +414,7 @@ contract WitRandomnessV21 external view returns (uint16) { - return __witnetBaseFeeOverheadPercentage; + return __witOracleBaseFeeOverheadPercentage; } function owner() @@ -446,7 +446,7 @@ contract WitRandomnessV21 external onlyOwner { - __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; + __witOracleBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } function settleDefaultQuerySLA(Witnet.RadonSLA calldata _witOracleQuerySLA) @@ -458,7 +458,7 @@ contract WitRandomnessV21 _witOracleQuerySLA.isValid(), "invalid SLA" ); - __witnetDefaultSLA = _witOracleQuerySLA; + __witOracleDefaultSLA = _witOracleQuerySLA; } @@ -475,7 +475,7 @@ contract WitRandomnessV21 _evmUsedFunds = msg.value; // Post the Witnet Randomness request: - _queryId = __witnet.postRequest{ + _queryId = __witOracle.postRequest{ value: msg.value }( witOracleQueryRadHash, diff --git a/contracts/core/trustable/WitOracleTrustableBase.sol b/contracts/core/trustable/WitOracleTrustableBase.sol index df203938..203163c0 100644 --- a/contracts/core/trustable/WitOracleTrustableBase.sol +++ b/contracts/core/trustable/WitOracleTrustableBase.sol @@ -205,7 +205,7 @@ abstract contract WitOracleTrustableBase _require(address(registry).code.length > 0, "inexistent registry"); _require(registry.specs() == type(WitOracleRadonRegistry).interfaceId, "uncompliant registry"); _require(address(factory).code.length > 0, "inexistent factory"); - _require(address(factory.witnet()) == address(this), "discordant factory"); + _require(address(factory.witOracle()) == address(this), "discordant factory"); // Set reporters, if any __setReporters(_newReporters); diff --git a/contracts/core/trustless/WitOracleRadonRegistryDefault.sol b/contracts/core/trustless/WitOracleRadonRegistryDefault.sol index 08028f2f..ae867184 100644 --- a/contracts/core/trustless/WitOracleRadonRegistryDefault.sol +++ b/contracts/core/trustless/WitOracleRadonRegistryDefault.sol @@ -196,7 +196,7 @@ contract WitOracleRadonRegistryDefault function hashOf(bytes calldata _radBytecode) external pure override returns (bytes32) { // todo: validate correctness of _radBytecode - return _witnetHash(_radBytecode); + return _witOracleHash(_radBytecode); } function lookupRadonReducer(bytes32 _hash) @@ -504,7 +504,7 @@ contract WitOracleRadonRegistryDefault ); // Calculate radhash and add request metadata and rad bytecode to storage: - _radHash = _witnetHash(_bytecode); + _radHash = _witOracleHash(_bytecode); __database().rads[hash] = _radHash; __database().radsBytecode[_radHash] = _bytecode; __database().requests[_radHash] = RadonRequestPacked({ @@ -538,7 +538,7 @@ contract WitOracleRadonRegistryDefault } } - function _witnetHash(bytes memory chunk) virtual internal pure returns (bytes32) { + function _witOracleHash(bytes memory chunk) virtual internal pure returns (bytes32) { return sha256(chunk); } diff --git a/contracts/core/trustless/WitOracleRadonRegistryNoSha256.sol b/contracts/core/trustless/WitOracleRadonRegistryNoSha256.sol index 82a36e56..9987c174 100644 --- a/contracts/core/trustless/WitOracleRadonRegistryNoSha256.sol +++ b/contracts/core/trustless/WitOracleRadonRegistryNoSha256.sol @@ -17,7 +17,7 @@ contract WitOracleRadonRegistryNoSha256 WitOracleRadonRegistryDefault(_upgradable, _versionTag) {} - function _witnetHash(bytes memory chunk) virtual override internal pure returns (bytes32) { + function _witOracleHash(bytes memory chunk) virtual override internal pure returns (bytes32) { return keccak256(chunk); } } \ No newline at end of file diff --git a/contracts/core/trustless/WitOracleRequestFactoryCfxCore.sol b/contracts/core/trustless/WitOracleRequestFactoryCfxCore.sol index f3408d61..7f5df49a 100644 --- a/contracts/core/trustless/WitOracleRequestFactoryCfxCore.sol +++ b/contracts/core/trustless/WitOracleRequestFactoryCfxCore.sol @@ -10,11 +10,11 @@ contract WitOracleRequestFactoryCfxCore WitOracleRequestFactoryDefault { constructor( - WitOracle _witnet, + WitOracle _witOracle, bool _upgradable, bytes32 _versionTag ) - WitOracleRequestFactoryDefault(_witnet, _upgradable, _versionTag) + WitOracleRequestFactoryDefault(_witOracle, _upgradable, _versionTag) {} function _cloneDeterministic(bytes32 _salt) diff --git a/contracts/core/trustless/WitOracleRequestFactoryDefault.sol b/contracts/core/trustless/WitOracleRequestFactoryDefault.sol index 2361d61c..c3b4e1c3 100644 --- a/contracts/core/trustless/WitOracleRequestFactoryDefault.sol +++ b/contracts/core/trustless/WitOracleRequestFactoryDefault.sol @@ -20,7 +20,7 @@ contract WitOracleRequestFactoryDefault WitnetUpgradableBase { /// @notice Reference to the Witnet Request Board that all templates built out from this factory will refer to. - WitOracle immutable public override witnet; + WitOracle immutable public override witOracle; modifier notOnFactory { _require( @@ -47,20 +47,20 @@ contract WitOracleRequestFactoryDefault modifier onlyOnRequests { _require( - __witnetRequest().radHash != bytes32(0), + __witOracleRequest().radHash != bytes32(0), "not a request" ); _; } modifier onlyOnTemplates { _require( - __witnetRequestTemplate().tallyReduceHash != bytes32(0), + __witOracleRequestTemplate().tallyReduceHash != bytes32(0), "not a template" ); _; } constructor( - WitOracle _witnet, + WitOracle _witOracle, bool _upgradable, bytes32 _versionTag ) @@ -71,15 +71,15 @@ contract WitOracleRequestFactoryDefault "io.witnet.requests.factory" ) { - witnet = _witnet; + witOracle = _witOracle; // let logic contract be used as a factory, while avoiding further initializations: __proxiable().proxy = address(this); __proxiable().implementation = address(this); - __witnetRequestFactory().owner = address(0); + __witOracleRequestFactory().owner = address(0); } function _getWitOracleRadonRegistry() virtual internal view returns (WitOracleRadonRegistry) { - return witnet.registry(); + return witOracle.registry(); } function initializeWitOracleRequest(bytes32 _radHash) @@ -87,7 +87,7 @@ contract WitOracleRequestFactoryDefault returns (address) { _require(_radHash != bytes32(0), "no rad hash?"); - __witnetRequest().radHash = _radHash; + __witOracleRequest().radHash = _radHash; return address(this); } @@ -103,7 +103,7 @@ contract WitOracleRequestFactoryDefault _require(_aggregateReduceHash != bytes16(0), "no aggregate reducer?"); _require(_tallyReduceHash != bytes16(0), "no tally reducer?"); - WitOracleRequestTemplateStorage storage __data = __witnetRequestTemplate(); + WitOracleRequestTemplateStorage storage __data = __witOracleRequestTemplate(); __data.retrieveHashes = _retrieveHashes; __data.aggregateReduceHash = _aggregateReduceHash; __data.tallyReduceHash = _tallyReduceHash; @@ -120,7 +120,7 @@ contract WitOracleRequestFactoryDefault virtual override returns (address) { - return __witnetRequestFactory().pendingOwner; + return __witOracleRequestFactory().pendingOwner; } /// @notice Returns the address of the current owner. @@ -129,7 +129,7 @@ contract WitOracleRequestFactoryDefault public view returns (address) { - return __witnetRequestFactory().owner; + return __witOracleRequestFactory().owner; } /// @notice Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. @@ -138,7 +138,7 @@ contract WitOracleRequestFactoryDefault virtual override public onlyOwner { - __witnetRequestFactory().pendingOwner = _newOwner; + __witOracleRequestFactory().pendingOwner = _newOwner; emit OwnershipTransferStarted(owner(), _newOwner); } @@ -148,10 +148,10 @@ contract WitOracleRequestFactoryDefault internal virtual override { - delete __witnetRequestFactory().pendingOwner; + delete __witOracleRequestFactory().pendingOwner; address _oldOwner = owner(); if (_newOwner != _oldOwner) { - __witnetRequestFactory().owner = _newOwner; + __witOracleRequestFactory().owner = _newOwner; emit OwnershipTransferred(_oldOwner, _newOwner); } } @@ -170,12 +170,12 @@ contract WitOracleRequestFactoryDefault // Trying to intialize an upgradable factory instance... { - address _owner = __witnetRequestFactory().owner; + address _owner = __witOracleRequestFactory().owner; if (_owner == address(0)) { // Upon first initialization of an upgradable factory, // set owner from the one specified in _initData _owner = abi.decode(_initData, (address)); - __witnetRequestFactory().owner = _owner; + __witOracleRequestFactory().owner = _owner; } else { // only the owner can upgrade an upgradable factory _require( @@ -190,8 +190,8 @@ contract WitOracleRequestFactoryDefault } __proxiable().implementation = base(); - _require(address(witnet).code.length > 0, "inexistent request board"); - _require(witnet.specs() == type(WitOracle).interfaceId, "uncompliant request board"); + _require(address(witOracle).code.length > 0, "inexistent request board"); + _require(witOracle.specs() == type(WitOracle).interfaceId, "uncompliant request board"); emit Upgraded(msg.sender, base(), codehash(), version()); } @@ -199,7 +199,7 @@ contract WitOracleRequestFactoryDefault /// Tells whether provided address could eventually upgrade the contract. function isUpgradableFrom(address _from) external view override returns (bool) { - address _owner = __witnetRequestFactory().owner; + address _owner = __witOracleRequestFactory().owner; return ( // false if the logic contract is intrinsically not upgradable, or `_from` is no owner isUpgradable() @@ -219,8 +219,8 @@ contract WitOracleRequestFactoryDefault returns (bool) { return ( - __witnetRequestTemplate().tallyReduceHash != bytes16(0) - || __witnetRequest().radHash != bytes32(0) + __witOracleRequestTemplate().tallyReduceHash != bytes16(0) + || __witOracleRequest().radHash != bytes32(0) || __implementation() == base() ); } @@ -246,9 +246,9 @@ contract WitOracleRequestFactoryDefault public view returns (string memory) { - if (__witnetRequest().radHash != bytes32(0)) { + if (__witOracleRequest().radHash != bytes32(0)) { return type(WitOracleRequest).name; - } else if (__witnetRequestTemplate().tallyReduceHash != bytes16(0)) { + } else if (__witOracleRequestTemplate().tallyReduceHash != bytes16(0)) { return type(WitOracleRequestTemplate).name; } else { return type(WitOracleRequestFactory).name; @@ -260,9 +260,9 @@ contract WitOracleRequestFactoryDefault external view returns (bytes4) { - if (__witnetRequest().radHash != bytes32(0)) { + if (__witOracleRequest().radHash != bytes32(0)) { return type(WitOracleRequest).interfaceId; - } else if (__witnetRequestTemplate().tallyReduceHash != bytes16(0)) { + } else if (__witOracleRequestTemplate().tallyReduceHash != bytes16(0)) { return type(WitOracleRequestTemplate).interfaceId; } else { return type(WitOracleRequestFactory).interfaceId; @@ -280,15 +280,15 @@ contract WitOracleRequestFactoryDefault returns (Witnet.RadonReducer memory, Witnet.RadonReducer memory) { WitOracleRadonRegistry _registry = _getWitOracleRadonRegistry(); - if (__witnetRequest().radHash != bytes32(0)) { + if (__witOracleRequest().radHash != bytes32(0)) { return ( - _registry.lookupRadonRequestAggregator(__witnetRequest().radHash), - _registry.lookupRadonRequestTally(__witnetRequest().radHash) + _registry.lookupRadonRequestAggregator(__witOracleRequest().radHash), + _registry.lookupRadonRequestTally(__witOracleRequest().radHash) ); } else { return ( - _registry.lookupRadonReducer(__witnetRequestTemplate().aggregateReduceHash), - _registry.lookupRadonReducer(__witnetRequestTemplate().tallyReduceHash) + _registry.lookupRadonReducer(__witOracleRequestTemplate().aggregateReduceHash), + _registry.lookupRadonReducer(__witOracleRequestTemplate().tallyReduceHash) ); } } @@ -299,18 +299,18 @@ contract WitOracleRequestFactoryDefault notOnFactory returns (Witnet.RadonRetrieval memory) { - if (__witnetRequest().radHash != bytes32(0)) { + if (__witOracleRequest().radHash != bytes32(0)) { return _getWitOracleRadonRegistry().lookupRadonRequestRetrievalByIndex( - __witnetRequest().radHash, + __witOracleRequest().radHash, _index ); } else { _require( - _index < __witnetRequestTemplate().retrieveHashes.length, + _index < __witOracleRequestTemplate().retrieveHashes.length, "index out of range" ); return _getWitOracleRadonRegistry().lookupRadonRetrieval( - __witnetRequestTemplate().retrieveHashes[_index] + __witOracleRequestTemplate().retrieveHashes[_index] ); } } @@ -322,15 +322,15 @@ contract WitOracleRequestFactoryDefault returns (Witnet.RadonRetrieval[] memory _retrievals) { WitOracleRadonRegistry _registry = _getWitOracleRadonRegistry(); - if (__witnetRequest().radHash != bytes32(0)) { + if (__witOracleRequest().radHash != bytes32(0)) { return _registry.lookupRadonRequestRetrievals( - __witnetRequest().radHash + __witOracleRequest().radHash ); } else { - _retrievals = new Witnet.RadonRetrieval[](__witnetRequestTemplate().retrieveHashes.length); + _retrievals = new Witnet.RadonRetrieval[](__witOracleRequestTemplate().retrieveHashes.length); for (uint _ix = 0; _ix < _retrievals.length; _ix ++) { _retrievals[_ix] = _registry.lookupRadonRetrieval( - __witnetRequestTemplate().retrieveHashes[_ix] + __witOracleRequestTemplate().retrieveHashes[_ix] ); } } @@ -342,13 +342,13 @@ contract WitOracleRequestFactoryDefault notOnFactory returns (Witnet.RadonDataTypes) { - if (__witnetRequest().radHash != bytes32(0)) { + if (__witOracleRequest().radHash != bytes32(0)) { return _getWitOracleRadonRegistry().lookupRadonRequestResultDataType( - __witnetRequest().radHash + __witOracleRequest().radHash ); } else { return _getWitOracleRadonRegistry().lookupRadonRetrievalResultDataType( - __witnetRequestTemplate().retrieveHashes[0] + __witOracleRequestTemplate().retrieveHashes[0] ); } } @@ -488,7 +488,7 @@ contract WitOracleRequestFactoryDefault returns (address _request) { WitOracleRadonRegistry _registry = _getWitOracleRadonRegistry(); - WitOracleRequestTemplateStorage storage __template = __witnetRequestTemplate(); + WitOracleRequestTemplateStorage storage __template = __witOracleRequestTemplate(); // Verify Radon Request using template's retrieve hashes, aggregate and tally reducers, // and given args: @@ -523,10 +523,10 @@ contract WitOracleRequestFactoryDefault { WitOracleRadonRegistry _registry = _getWitOracleRadonRegistry(); - _argsCount = new uint256[](__witnetRequestTemplate().retrieveHashes.length); + _argsCount = new uint256[](__witOracleRequestTemplate().retrieveHashes.length); for (uint _ix = 0; _ix < _argsCount.length; _ix ++) { _argsCount[_ix] = _registry.lookupRadonRetrievalArgsCount( - __witnetRequestTemplate().retrieveHashes[_ix] + __witOracleRequestTemplate().retrieveHashes[_ix] ); } } @@ -537,9 +537,9 @@ contract WitOracleRequestFactoryDefault returns (bytes32) { return IWitOracleRadonRegistryLegacy(address(_getWitOracleRadonRegistry())).verifyRadonRequest( - __witnetRequestTemplate().retrieveHashes, - bytes32(__witnetRequestTemplate().aggregateReduceHash), - bytes32(__witnetRequestTemplate().tallyReduceHash), + __witOracleRequestTemplate().retrieveHashes, + bytes32(__witOracleRequestTemplate().aggregateReduceHash), + bytes32(__witOracleRequestTemplate().tallyReduceHash), 0, _args ); @@ -554,7 +554,7 @@ contract WitOracleRequestFactoryDefault returns (bytes memory) { return _getWitOracleRadonRegistry().bytecodeOf( - __witnetRequest().radHash + __witOracleRequest().radHash ); } @@ -563,7 +563,7 @@ contract WitOracleRequestFactoryDefault onlyOnRequests returns (bytes32) { - return __witnetRequest().radHash; + return __witOracleRequest().radHash; } diff --git a/contracts/data/WitOracleRequestFactoryData.sol b/contracts/data/WitOracleRequestFactoryData.sol index e26e5157..e34d59d3 100644 --- a/contracts/data/WitOracleRequestFactoryData.sol +++ b/contracts/data/WitOracleRequestFactoryData.sol @@ -41,7 +41,7 @@ contract WitOracleRequestFactoryData { bytes16 tallyReduceHash; } - function __witnetRequestFactory() + function __witOracleRequestFactory() internal pure returns (WitOracleRequestFactoryStorage storage ptr) { @@ -50,7 +50,7 @@ contract WitOracleRequestFactoryData { } } - function __witnetRequest() + function __witOracleRequest() internal pure returns (WitOracleRequestStorage storage ptr) { @@ -59,7 +59,7 @@ contract WitOracleRequestFactoryData { } } - function __witnetRequestTemplate() + function __witOracleRequestTemplate() internal pure returns (WitOracleRequestTemplateStorage storage ptr) { diff --git a/contracts/interfaces/IWitFeeds.sol b/contracts/interfaces/IWitFeeds.sol index 851b767b..2b190fa0 100644 --- a/contracts/interfaces/IWitFeeds.sol +++ b/contracts/interfaces/IWitFeeds.sol @@ -32,7 +32,7 @@ interface IWitFeeds { /// caption string, truncated to bytes4. function hash(string calldata caption) external pure returns (bytes4); - /// Returns the query id (in the context of the WitOracle addressed by witnet()) + /// Returns the query id (in the context of the WitOracle addressed by witOracle()) /// that solved the most recently updated value for the given feed. function lastValidQueryId(bytes4 feedId) external view returns (uint256); diff --git a/contracts/interfaces/IWitOracleAppliance.sol b/contracts/interfaces/IWitOracleAppliance.sol index ffc3637e..72133bcb 100644 --- a/contracts/interfaces/IWitOracleAppliance.sol +++ b/contracts/interfaces/IWitOracleAppliance.sol @@ -9,5 +9,5 @@ abstract contract IWitOracleAppliance IWitAppliance { /// @notice Returns the WitOracle address that this appliance is bound to. - function witnet() virtual external view returns (WitOracle); + function witOracle() virtual external view returns (WitOracle); } diff --git a/contracts/interfaces/IWitOracleRequestTemplate.sol b/contracts/interfaces/IWitOracleRequestTemplate.sol index 45cd6fe3..1df28201 100644 --- a/contracts/interfaces/IWitOracleRequestTemplate.sol +++ b/contracts/interfaces/IWitOracleRequestTemplate.sol @@ -51,7 +51,7 @@ interface IWitOracleRequestTemplate { /// made out of the data sources, aggregate and tally Radon Reducers that /// compose this WitOracleRequestTemplate. While no WitOracleRequest instance is /// actually constructed, the returned value will be accepted as a valid - /// RAD hash on the witnet() contract from now on. + /// RAD hash on the witOracle() contract from now on. /// Reverts if: /// - the ranks of passed array don't match either the number of this /// template's data sources, or the number of required parameters by diff --git a/contracts/mockups/UsingWitOracle.sol b/contracts/mockups/UsingWitOracle.sol index 19659ebe..f1e86a3d 100644 --- a/contracts/mockups/UsingWitOracle.sol +++ b/contracts/mockups/UsingWitOracle.sol @@ -13,17 +13,17 @@ abstract contract UsingWitOracle IWitOracleEvents { /// @dev Immutable reference to the Witnet Request Board contract. - WitOracle internal immutable __witnet; + WitOracle internal immutable __witOracle; /// @dev Default Security-Level Agreement parameters to be fulfilled by the Witnet blockchain /// @dev when solving a data request. - Witnet.RadonSLA internal __witnetDefaultSLA; + Witnet.RadonSLA internal __witOracleDefaultSLA; /// @dev Percentage over base fee to pay on every data request, /// @dev as to deal with volatility of evmGasPrice and evmWitPrice during the live time of /// @dev a data request (since being posted until a result gets reported back), at both the EVM and /// @dev the Witnet blockchain levels, respectivelly. - uint16 internal __witnetBaseFeeOverheadPercentage; + uint16 internal __witOracleBaseFeeOverheadPercentage; /// @param _wrb Address of the WitOracle contract. constructor(WitOracle _wrb) { @@ -31,8 +31,8 @@ abstract contract UsingWitOracle _wrb.specs() == type(WitOracle).interfaceId, "UsingWitOracle: uncompliant WitOracle" ); - __witnet = _wrb; - __witnetDefaultSLA = Witnet.RadonSLA({ + __witOracle = _wrb; + __witOracleDefaultSLA = Witnet.RadonSLA({ // Number of nodes in the Witnet blockchain that will take part in solving the data request: witNumWitnesses: 10, // Reward in $nanoWIT to be paid to every node in the Witnet blockchain involved in solving some data query. @@ -41,52 +41,52 @@ abstract contract UsingWitOracle maxTallyResultSize: 32 }); - __witnetBaseFeeOverheadPercentage = 33; // defaults to 33% + __witOracleBaseFeeOverheadPercentage = 33; // defaults to 33% } /// @dev Provides a convenient way for client contracts extending this to block the execution of the main logic of the /// @dev contract until a particular request has been successfully solved and reported by Witnet, /// @dev either with an error or successfully. modifier witnetQuerySolved(uint256 _queryId) { - require(_witnetCheckQueryResultAvailability(_queryId), "UsingWitOracle: unsolved query"); + require(_witOracleCheckQueryResultAvailability(_queryId), "UsingWitOracle: unsolved query"); _; } - function witnet() virtual public view returns (WitOracle) { - return __witnet; + function witOracle() virtual public view returns (WitOracle) { + return __witOracle; } /// @notice Check if given query was already reported back from the Witnet oracle. /// @param _id The unique identifier of a previously posted data request. - function _witnetCheckQueryResultAvailability(uint256 _id) + function _witOracleCheckQueryResultAvailability(uint256 _id) internal view returns (bool) { - return __witnet.getQueryStatus(_id) == Witnet.QueryStatus.Reported; + return __witOracle.getQueryStatus(_id) == Witnet.QueryStatus.Reported; } /// @notice Estimate the minimum reward required for posting a data request, using `tx.gasprice` as a reference. - function _witnetEstimateBaseFee() + function _witOracleEstimateBaseFee() virtual internal view returns (uint256) { return ( - (100 + __witnetBaseFeeOverheadPercentage) - * __witnet.estimateBaseFee(tx.gasprice) + (100 + __witOracleBaseFeeOverheadPercentage) + * __witOracle.estimateBaseFee(tx.gasprice) ) / 100; } - function _witnetCheckQueryQueryResponseStatus(uint256 _queryId) + function _witOracleCheckQueryQueryResponseStatus(uint256 _queryId) internal view returns (Witnet.QueryResponseStatus) { - return __witnet.getQueryResponseStatus(_queryId); + return __witOracle.getQueryResponseStatus(_queryId); } - function _witnetCheckQueryResultError(uint256 _queryId) + function _witOracleCheckQueryResultError(uint256 _queryId) internal view returns (Witnet.ResultError memory) { - return __witnet.getQueryResultError(_queryId); + return __witOracle.getQueryResultError(_queryId); } } diff --git a/contracts/mockups/UsingWitOracleRandomness.sol b/contracts/mockups/UsingWitOracleRandomness.sol index c7cedc43..7c096cb3 100644 --- a/contracts/mockups/UsingWitOracleRandomness.sol +++ b/contracts/mockups/UsingWitOracleRandomness.sol @@ -16,14 +16,14 @@ abstract contract UsingWitOracleRandomness WitOracle immutable public witnet; WitRandomness immutable public __RNG; - constructor(WitRandomness _witnetRandomness) { + constructor(WitRandomness _witOracleRandomness) { require( - address(_witnetRandomness).code.length > 0 - && _witnetRandomness.specs() == type(WitRandomness).interfaceId, + address(_witOracleRandomness).code.length > 0 + && _witOracleRandomness.specs() == type(WitRandomness).interfaceId, "UsingWitOracleRandomness: uncompliant WitRandomness appliance" ); - __RNG = _witnetRandomness; - witnet = __RNG.witnet(); + __RNG = _witOracleRandomness; + witnet = __RNG.witOracle(); } } diff --git a/contracts/mockups/UsingWitOracleRequest.sol b/contracts/mockups/UsingWitOracleRequest.sol index 531a5afd..7bbc80cf 100644 --- a/contracts/mockups/UsingWitOracleRequest.sol +++ b/contracts/mockups/UsingWitOracleRequest.sol @@ -9,39 +9,39 @@ abstract contract UsingWitOracleRequest { WitOracleRequest immutable public dataRequest; - bytes32 immutable internal __witnetRequestRadHash; + bytes32 immutable internal __witOracleRequestRadHash; - /// @param _witnetRequest Address of the WitOracleRequest contract containing the actual data request. + /// @param _witOracleRequest Address of the WitOracleRequest contract containing the actual data request. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. constructor ( - WitOracleRequest _witnetRequest, + WitOracleRequest _witOracleRequest, uint16 _baseFeeOverheadPercentage ) - UsingWitOracle(_witnetRequest.witnet()) + UsingWitOracle(_witOracleRequest.witOracle()) { require( - _witnetRequest.specs() == type(WitOracleRequest).interfaceId, + _witOracleRequest.specs() == type(WitOracleRequest).interfaceId, "UsingWitOracleRequest: uncompliant WitOracleRequest" ); - dataRequest = _witnetRequest; - __witnetRequestRadHash = _witnetRequest.radHash(); - __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; + dataRequest = _witOracleRequest; + __witOracleRequestRadHash = _witOracleRequest.radHash(); + __witOracleBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - function __witnetRequestData(uint256 _witnetEvmReward) + function __witOracleRequestData(uint256 _witOracleEvmReward) virtual internal returns (uint256) { - return __witnetRequestData(_witnetEvmReward, __witnetDefaultSLA); + return __witOracleRequestData(_witOracleEvmReward, __witOracleDefaultSLA); } - function __witnetRequestData( - uint256 _witnetEvmReward, + function __witOracleRequestData( + uint256 _witOracleEvmReward, Witnet.RadonSLA memory _witOracleQuerySLA ) virtual internal returns (uint256) { - return __witnet.postRequest{value: _witnetEvmReward}( - __witnetRequestRadHash, + return __witOracle.postRequest{value: _witOracleEvmReward}( + __witOracleRequestRadHash, _witOracleQuerySLA ); } diff --git a/contracts/mockups/UsingWitOracleRequestTemplate.sol b/contracts/mockups/UsingWitOracleRequestTemplate.sol index a78248b8..46076e60 100644 --- a/contracts/mockups/UsingWitOracleRequestTemplate.sol +++ b/contracts/mockups/UsingWitOracleRequestTemplate.sol @@ -11,52 +11,52 @@ abstract contract UsingWitOracleRequestTemplate { WitOracleRequestTemplate immutable public dataRequestTemplate; - /// @param _witnetRequestTemplate Address of the WitOracleRequestTemplate from which actual data requests will get built. + /// @param _witOracleRequestTemplate Address of the WitOracleRequestTemplate from which actual data requests will get built. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. constructor ( - WitOracleRequestTemplate _witnetRequestTemplate, + WitOracleRequestTemplate _witOracleRequestTemplate, uint16 _baseFeeOverheadPercentage ) - UsingWitOracle(_witnetRequestTemplate.witnet()) + UsingWitOracle(_witOracleRequestTemplate.witOracle()) { require( - _witnetRequestTemplate.specs() == type(WitOracleRequestTemplate).interfaceId, + _witOracleRequestTemplate.specs() == type(WitOracleRequestTemplate).interfaceId, "UsingWitOracleRequestTemplate: uncompliant WitOracleRequestTemplate" ); - dataRequestTemplate = _witnetRequestTemplate; - __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; + dataRequestTemplate = _witOracleRequestTemplate; + __witOracleBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - function _witnetBuildRadHash(string[][] memory _witnetRequestArgs) + function _witOracleBuildRadHash(string[][] memory _witOracleRequestArgs) internal returns (bytes32) { - return dataRequestTemplate.verifyRadonRequest(_witnetRequestArgs); + return dataRequestTemplate.verifyRadonRequest(_witOracleRequestArgs); } - function _witnetBuildRequest(string[][] memory _witnetRequestArgs) + function _witOracleBuildRequest(string[][] memory _witOracleRequestArgs) internal returns (WitOracleRequest) { - return WitOracleRequest(dataRequestTemplate.buildWitOracleRequest(_witnetRequestArgs)); + return WitOracleRequest(dataRequestTemplate.buildWitOracleRequest(_witOracleRequestArgs)); } - function __witnetRequestData( - uint256 _witnetEvmReward, - string[][] memory _witnetRequestArgs + function __witOracleRequestData( + uint256 _witOracleEvmReward, + string[][] memory _witOracleRequestArgs ) virtual internal returns (uint256) { - return __witnetRequestData(_witnetEvmReward, _witnetRequestArgs, __witnetDefaultSLA); + return __witOracleRequestData(_witOracleEvmReward, _witOracleRequestArgs, __witOracleDefaultSLA); } - function __witnetRequestData( - uint256 _witnetEvmReward, - string[][] memory _witnetRequestArgs, + function __witOracleRequestData( + uint256 _witOracleEvmReward, + string[][] memory _witOracleRequestArgs, Witnet.RadonSLA memory _witOracleQuerySLA ) virtual internal returns (uint256) { - return __witnet.postRequest{value: _witnetEvmReward}( - _witnetBuildRadHash(_witnetRequestArgs), + return __witOracle.postRequest{value: _witOracleEvmReward}( + _witOracleBuildRadHash(_witOracleRequestArgs), _witOracleQuerySLA ); } diff --git a/contracts/mockups/WitOracleConsumer.sol b/contracts/mockups/WitOracleConsumer.sol index c81de76d..a1a8edcb 100644 --- a/contracts/mockups/WitOracleConsumer.sol +++ b/contracts/mockups/WitOracleConsumer.sol @@ -10,16 +10,16 @@ abstract contract WitOracleConsumer UsingWitOracle { /// @dev Maximum gas to be spent by the IWitOracleConsumer's callback methods. - uint24 internal immutable __witnetCallbackGasLimit; + uint24 internal immutable __witOracleCallbackGasLimit; modifier onlyFromWitnet { - require(msg.sender == address(__witnet), "WitOracleConsumer: unauthorized"); + require(msg.sender == address(__witOracle), "WitOracleConsumer: unauthorized"); _; } /// @param _callbackGasLimit Maximum gas to be spent by the IWitOracleConsumer's callback methods. constructor (uint24 _callbackGasLimit) { - __witnetCallbackGasLimit = _callbackGasLimit; + __witOracleCallbackGasLimit = _callbackGasLimit; } @@ -27,19 +27,19 @@ abstract contract WitOracleConsumer /// --- Base implementation of IWitOracleConsumer -------------------------------------------------------------------- function reportableFrom(address _from) virtual override external view returns (bool) { - return _from == address(__witnet); + return _from == address(__witOracle); } /// =============================================================================================================== /// --- WitOracleConsumer virtual methods ---------------------------------------------------------------------------- - function _witnetEstimateBaseFee() virtual override internal view returns (uint256) { + function _witOracleEstimateBaseFee() virtual override internal view returns (uint256) { return ( - (100 + __witnetBaseFeeOverheadPercentage) - * __witnet.estimateBaseFeeWithCallback( + (100 + __witOracleBaseFeeOverheadPercentage) + * __witOracle.estimateBaseFeeWithCallback( tx.gasprice, - __witnetCallbackGasLimit + __witOracleCallbackGasLimit ) ) / 100; } @@ -48,13 +48,13 @@ abstract contract WitOracleConsumer /// @notice Estimate the minimum reward required for posting a data request, using `tx.gasprice` as a reference. /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. /// @param _callbackGasLimit Maximum gas to be spent when reporting the data request result. - function _witnetEstimateBaseFeeWithCallback(uint24 _callbackGasLimit) + function _witOracleEstimateBaseFeeWithCallback(uint24 _callbackGasLimit) virtual internal view returns (uint256) { return ( - (100 + __witnetBaseFeeOverheadPercentage) - * __witnet.estimateBaseFeeWithCallback( + (100 + __witOracleBaseFeeOverheadPercentage) + * __witOracle.estimateBaseFeeWithCallback( tx.gasprice, _callbackGasLimit ) diff --git a/contracts/mockups/WitOracleRequestConsumer.sol b/contracts/mockups/WitOracleRequestConsumer.sol index 93271b50..943daee4 100644 --- a/contracts/mockups/WitOracleRequestConsumer.sol +++ b/contracts/mockups/WitOracleRequestConsumer.sol @@ -12,39 +12,39 @@ abstract contract WitOracleRequestConsumer using WitnetCBOR for WitnetCBOR.CBOR; using WitnetCBOR for WitnetCBOR.CBOR[]; - /// @param _witnetRequest Address of the WitOracleRequest contract containing the actual data request. + /// @param _witOracleRequest Address of the WitOracleRequest contract containing the actual data request. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. /// @param _callbackGasLimit Maximum gas to be spent by the IWitOracleConsumer's callback methods. constructor( - WitOracleRequest _witnetRequest, + WitOracleRequest _witOracleRequest, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit ) - UsingWitOracleRequest(_witnetRequest, _baseFeeOverheadPercentage) + UsingWitOracleRequest(_witOracleRequest, _baseFeeOverheadPercentage) WitOracleConsumer(_callbackGasLimit) {} - function _witnetEstimateBaseFee() + function _witOracleEstimateBaseFee() virtual override(UsingWitOracle, WitOracleConsumer) internal view returns (uint256) { - return WitOracleConsumer._witnetEstimateBaseFee(); + return WitOracleConsumer._witOracleEstimateBaseFee(); } - function __witnetRequestData( - uint256 _witnetEvmReward, + function __witOracleRequestData( + uint256 _witOracleEvmReward, Witnet.RadonSLA memory _witOracleQuerySLA ) virtual override internal returns (uint256) { - return __witnet.postRequestWithCallback{ - value: _witnetEvmReward + return __witOracle.postRequestWithCallback{ + value: _witOracleEvmReward }( - __witnetRequestRadHash, + __witOracleRequestRadHash, _witOracleQuerySLA, - __witnetCallbackGasLimit + __witOracleCallbackGasLimit ); } } diff --git a/contracts/mockups/WitOracleRequestTemplateConsumer.sol b/contracts/mockups/WitOracleRequestTemplateConsumer.sol index 98ed7d59..213094ff 100644 --- a/contracts/mockups/WitOracleRequestTemplateConsumer.sol +++ b/contracts/mockups/WitOracleRequestTemplateConsumer.sol @@ -12,40 +12,40 @@ abstract contract WitOracleRequestTemplateConsumer using WitnetCBOR for WitnetCBOR.CBOR; using WitnetCBOR for WitnetCBOR.CBOR[]; - /// @param _witnetRequestTemplate Address of the WitOracleRequestTemplate from which actual data requests will get built. + /// @param _witOracleRequestTemplate Address of the WitOracleRequestTemplate from which actual data requests will get built. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. /// @param _callbackGasLimit Maximum gas to be spent by the IWitOracleConsumer's callback methods. constructor( - WitOracleRequestTemplate _witnetRequestTemplate, + WitOracleRequestTemplate _witOracleRequestTemplate, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit ) - UsingWitOracleRequestTemplate(_witnetRequestTemplate, _baseFeeOverheadPercentage) + UsingWitOracleRequestTemplate(_witOracleRequestTemplate, _baseFeeOverheadPercentage) WitOracleConsumer(_callbackGasLimit) {} - function _witnetEstimateBaseFee() + function _witOracleEstimateBaseFee() virtual override(UsingWitOracle, WitOracleConsumer) internal view returns (uint256) { - return WitOracleConsumer._witnetEstimateBaseFee(); + return WitOracleConsumer._witOracleEstimateBaseFee(); } - function __witnetRequestData( - uint256 _witnetEvmReward, - string[][] memory _witnetRequestArgs, + function __witOracleRequestData( + uint256 _witOracleEvmReward, + string[][] memory _witOracleRequestArgs, Witnet.RadonSLA memory _witOracleQuerySLA ) virtual override internal returns (uint256) { - return __witnet.postRequestWithCallback{ - value: _witnetEvmReward + return __witOracle.postRequestWithCallback{ + value: _witOracleEvmReward }( - _witnetBuildRadHash(_witnetRequestArgs), + _witOracleBuildRadHash(_witOracleRequestArgs), _witOracleQuerySLA, - __witnetCallbackGasLimit + __witOracleCallbackGasLimit ); } diff --git a/contracts/mockups/WitRandomnessRequestConsumer.sol b/contracts/mockups/WitRandomnessRequestConsumer.sol index e3a001b9..194ad4ad 100644 --- a/contracts/mockups/WitRandomnessRequestConsumer.sol +++ b/contracts/mockups/WitRandomnessRequestConsumer.sol @@ -15,7 +15,7 @@ abstract contract WitRandomnessRequestConsumer using Witnet for Witnet.RadonSLA; using WitnetCBOR for WitnetCBOR.CBOR; - bytes32 internal immutable __witnetRandomnessRadHash; + bytes32 internal immutable __witOracleRandomnessRadHash; /// @param _wrb Address of the WitOracle contract. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. @@ -30,7 +30,7 @@ abstract contract WitRandomnessRequestConsumer { // On-chain building of the Witnet Randomness Request: { - WitOracleRadonRegistry _registry = witnet().registry(); + WitOracleRadonRegistry _registry = witOracle().registry(); // Build own Witnet Randomness Request: bytes32[] memory _retrievals = new bytes32[](1); _retrievals[0] = _registry.verifyRadonRetrieval( @@ -40,7 +40,7 @@ abstract contract WitRandomnessRequestConsumer new string[2][](0), // no headers hex"80" // no retrieval script ); - __witnetRandomnessRadHash = _registry.verifyRadonRequest( + __witOracleRandomnessRadHash = _registry.verifyRadonRequest( _retrievals, Witnet.RadonReducer({ opcode: Witnet.RadonReduceOpcodes.Mode, @@ -52,10 +52,10 @@ abstract contract WitRandomnessRequestConsumer }) ); } - __witnetBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; + __witOracleBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - function _witnetRandomUniformUint32(uint32 _range, uint256 _nonce, bytes32 _seed) internal pure returns (uint32) { + function _witOracleRandomUniformUint32(uint32 _range, uint256 _nonce, bytes32 _seed) internal pure returns (uint32) { uint256 _number = uint256( keccak256( abi.encode(_seed, _nonce) @@ -64,27 +64,27 @@ abstract contract WitRandomnessRequestConsumer return uint32((_number * _range) >> 224); } - function _witnetReadRandomizeFromResultValue(WitnetCBOR.CBOR calldata cborValue) internal pure returns (bytes32) { + function _witOracleReadRandomizeFromResultValue(WitnetCBOR.CBOR calldata cborValue) internal pure returns (bytes32) { return cborValue.readBytes().toBytes32(); } - function __witnetRandomize(uint256 _witnetEvmReward) virtual internal returns (uint256) { - return __witnetRandomize(_witnetEvmReward, __witnetDefaultSLA); + function __witOracleRandomize(uint256 _witOracleEvmReward) virtual internal returns (uint256) { + return __witOracleRandomize(_witOracleEvmReward, __witOracleDefaultSLA); } - function __witnetRandomize( - uint256 _witnetEvmReward, + function __witOracleRandomize( + uint256 _witOracleEvmReward, Witnet.RadonSLA memory _witOracleQuerySLA ) virtual internal returns (uint256 _randomizeId) { - return __witnet.postRequestWithCallback{ - value: _witnetEvmReward + return __witOracle.postRequestWithCallback{ + value: _witOracleEvmReward }( - __witnetRandomnessRadHash, + __witOracleRandomnessRadHash, _witOracleQuerySLA, - __witnetCallbackGasLimit + __witOracleCallbackGasLimit ); } } diff --git a/migrations/scripts/3_core.js b/migrations/scripts/3_core.js index 61853a25..1cce444e 100644 --- a/migrations/scripts/3_core.js +++ b/migrations/scripts/3_core.js @@ -45,7 +45,7 @@ module.exports = async function (_, network, [, from]) { intrinsics: { types: ["address", "address", "bool", "bytes32"], values: [ - /* _witnet */ await determineProxyAddr(from, specs.WitOracle?.vanity || 3), + /* _witOracle */ await determineProxyAddr(from, specs.WitOracle?.vanity || 3), /* _upgradable */ true, /* _versionTag */ utils.fromAscii(version), ], @@ -86,7 +86,7 @@ module.exports = async function (_, network, [, from]) { intrinsics: { types: ["address", "bool", "bytes32"], values: [ - /* _witnet */ await determineProxyAddr(from, specs.WitOracle?.vanity || 3), + /* _witOracle */ await determineProxyAddr(from, specs.WitOracle?.vanity || 3), /* _upgradable */ true, /* _versionTag */ utils.fromAscii(version), ], diff --git a/migrations/scripts/5_apps.js b/migrations/scripts/5_apps.js index 48bbd50b..17202997 100644 --- a/migrations/scripts/5_apps.js +++ b/migrations/scripts/5_apps.js @@ -26,7 +26,7 @@ module.exports = async function (_, network, [, from]) { types: ["address", "address"], values: [ /* _witOracle */ await determineProxyAddr(from, specs.WitOracle?.vanity || 3), - /* _witnetOperator */ utils.isDryRun(network) ? from : specs?.WitRandomness?.from || from, + /* _witOracleOperator */ utils.isDryRun(network) ? from : specs?.WitRandomness?.from || from, ], }, }) diff --git a/test/mocks/MyDapp.sol b/test/mocks/MyDapp.sol index d7ca9672..c387230a 100644 --- a/test/mocks/MyDapp.sol +++ b/test/mocks/MyDapp.sol @@ -39,9 +39,9 @@ contract MyDapp rubbish.slot1 = blockhash(block.number - 1); rubbish.slot2 = blockhash(block.number - 2); rubbish.slot3 = blockhash(block.number - 3); - witnetRandomnessRadHash = __witnetRandomnessRadHash; - witnetRandomnessBytecode = witnet().registry().bytecodeOf(__witnetRandomnessRadHash); - __randomizeValue = _witnetEstimateBaseFee(); + witnetRandomnessRadHash = __witOracleRandomnessRadHash; + witnetRandomnessBytecode = witOracle().registry().bytecodeOf(__witOracleRandomnessRadHash); + __randomizeValue = _witOracleEstimateBaseFee(); } function getRandomizeValue() external view returns (uint256) { @@ -49,7 +49,7 @@ contract MyDapp } function randomize() external payable returns (uint256 _randomizeId) { - _randomizeId = __witnetRandomize(__randomizeValue); + _randomizeId = __witOracleRandomize(__randomizeValue); if (__randomizeValue < msg.value) { payable(msg.sender).transfer(msg.value - __randomizeValue); } @@ -68,10 +68,10 @@ contract MyDapp override external onlyFromWitnet { - // randomness = _witnetReadRandomizeFromResultValue(witnetResultCborValue); + // randomness = _witOracleReadRandomizeFromResultValue(witnetResultCborValue); // delete rubbish; - // witnet.burnQuery(_queryId); - // emit Result(queryId, _witnetReadRandomizeFromResultValue(cborValue)); + // witOracle.burnQuery(_queryId); + // emit Result(queryId, _witOracleReadRandomizeFromResultValue(cborValue)); } function reportWitOracleResultError( From ca0833d1838e57b535e9c9e0cdbec593f4fde037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Mon, 5 Aug 2024 11:16:14 +0200 Subject: [PATCH 27/39] refactor: Witnet.QueryRequest.witnet* -> radon* --- .../core/trustable/WitOracleTrustableBase.sol | 14 +++++++------- .../core/trustable/WitOracleTrustableOvm2.sol | 8 ++++---- contracts/data/WitOracleDataLib.sol | 10 +++++----- contracts/libs/Witnet.sol | 16 ++++++++-------- test/TestWitnetV2.sol | 12 ++++++------ 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/contracts/core/trustable/WitOracleTrustableBase.sol b/contracts/core/trustable/WitOracleTrustableBase.sol index 203163c0..e0d8355f 100644 --- a/contracts/core/trustable/WitOracleTrustableBase.sol +++ b/contracts/core/trustable/WitOracleTrustableBase.sol @@ -465,7 +465,7 @@ abstract contract WitOracleTrustableBase _querySLA, _queryCallbackGasLimit ); - WitOracleDataLib.seekQueryRequest(_queryId).witnetBytecode = _queryUnverifiedBytecode; + WitOracleDataLib.seekQueryRequest(_queryId).radonBytecode = _queryUnverifiedBytecode; emit WitOracleQuery( _msgSender(), _getGasPrice(), @@ -608,8 +608,8 @@ abstract contract WitOracleTrustableBase _evmGasPrice, _evmWitPrice, Witnet.RadonSLA({ - witNumWitnesses: __request.witnetSLA.witNumWitnesses, - witUnitaryReward: __request.witnetSLA.witUnitaryReward, + witNumWitnesses: __request.radonSLA.witNumWitnesses, + witUnitaryReward: __request.radonSLA.witUnitaryReward, maxTallyResultSize: uint16(0) }) ) @@ -620,11 +620,11 @@ abstract contract WitOracleTrustableBase + estimateExtraFee( _evmGasPrice, _evmWitPrice, - __request.witnetSLA + __request.radonSLA ) ); } - _expenses += _evmWitPrice * __request.witnetSLA.witUnitaryReward; + _expenses += _evmWitPrice * __request.radonSLA.witUnitaryReward; _revenues += __request.evmReward; } } @@ -839,8 +839,8 @@ abstract contract WitOracleTrustableBase __request.requester = msg.sender; __request.gasCallback = _callbackGasLimit; __request.evmReward = uint72(_getMsgValue()); - __request.witnetRAD = _radHash; - __request.witnetSLA = _sla; + __request.radonRadHash = _radHash; + __request.radonSLA = _sla; } } diff --git a/contracts/core/trustable/WitOracleTrustableOvm2.sol b/contracts/core/trustable/WitOracleTrustableOvm2.sol index 4f04322d..670cdde4 100644 --- a/contracts/core/trustable/WitOracleTrustableOvm2.sol +++ b/contracts/core/trustable/WitOracleTrustableOvm2.sol @@ -155,8 +155,8 @@ contract WitOracleTrustableOvm2 _evmGasPrice, _evmWitPrice, Witnet.RadonSLA({ - witNumWitnesses: __request.witnetSLA.witNumWitnesses, - witUnitaryReward: __request.witnetSLA.witUnitaryReward, + witNumWitnesses: __request.radonSLA.witNumWitnesses, + witUnitaryReward: __request.radonSLA.witUnitaryReward, maxTallyResultSize: uint16(0) }) ) @@ -167,11 +167,11 @@ contract WitOracleTrustableOvm2 + WitOracleTrustableDefault.estimateExtraFee( _evmGasPrice, _evmWitPrice, - __request.witnetSLA + __request.radonSLA ) ); } - _expenses += __request.witnetSLA.witUnitaryReward * _evmWitPrice; + _expenses += __request.radonSLA.witUnitaryReward * _evmWitPrice; _revenues += __request.evmReward; } } diff --git a/contracts/data/WitOracleDataLib.sol b/contracts/data/WitOracleDataLib.sol index fe7a2776..184505f5 100644 --- a/contracts/data/WitOracleDataLib.sol +++ b/contracts/data/WitOracleDataLib.sol @@ -100,15 +100,15 @@ library WitOracleDataLib { for (uint _ix = 0; _ix < queryIds.length; _ix ++) { if (seekQueryStatus(queryIds[_ix]) != Witnet.QueryStatus.Unknown) { Witnet.QueryRequest storage __request = data().queries[queryIds[_ix]].request; - if (__request.witnetRAD != bytes32(0)) { + if (__request.radonRadHash != bytes32(0)) { bytecodes[_ix] = registry.bytecodeOf( - __request.witnetRAD, - __request.witnetSLA + __request.radonRadHash, + __request.radonSLA ); } else { bytecodes[_ix] = registry.bytecodeOf( - __request.witnetBytecode, - __request.witnetSLA + __request.radonBytecode, + __request.radonSLA ); } } diff --git a/contracts/libs/Witnet.sol b/contracts/libs/Witnet.sol index da27a719..68a6eb34 100644 --- a/contracts/libs/Witnet.sol +++ b/contracts/libs/Witnet.sol @@ -22,18 +22,18 @@ library Witnet { address requester; // EVM address from which the request was posted. uint24 gasCallback; // Max callback gas limit upon response, if a callback is required. uint72 evmReward; // EVM amount in wei eventually to be paid to the legit result reporter. - bytes witnetBytecode; // Optional: Witnet Data Request bytecode to be solved by the Witnet blockchain. - bytes32 witnetRAD; // Optional: Previously verified hash of the Witnet Data Request to be solved. - RadonSLA witnetSLA; // Minimum Service-Level parameters to be committed by the Witnet blockchain. + bytes radonBytecode; // Optional: Witnet Data Request bytecode to be solved by the Witnet blockchain. + bytes32 radonRadHash; // Optional: Previously verified hash of the Witnet Data Request to be solved. + RadonSLA radonSLA; // Minimum Service-Level parameters to be committed by the Witnet blockchain. } /// QueryResponse metadata and result as resolved by the Witnet blockchain. struct QueryResponse { - address reporter; // EVM address from which the Data Request result was reported. - uint64 finality; // EVM block number at which the reported data will be considered to be finalized. - uint32 resultTimestamp; // Unix timestamp (seconds) at which the data request was resolved in the Witnet blockchain. - bytes32 resultTallyHash; // Unique hash of the commit/reveal act in the Witnet blockchain that resolved the data request. - bytes resultCborBytes; // CBOR-encode result to the request, as resolved in the Witnet blockchain. + address reporter; // EVM address from which the Data Request result was reported. + uint64 finality; // EVM block number at which the reported data will be considered to be finalized. + uint32 resultTimestamp; // Unix timestamp (seconds) at which the data request was resolved in the Witnet blockchain. + bytes32 resultTallyHash; // Unique hash of the commit/reveal act in the Witnet blockchain that resolved the data request. + bytes resultCborBytes; // CBOR-encode result to the request, as resolved in the Witnet blockchain. } /// QueryResponse status from a requester's point of view. diff --git a/test/TestWitnetV2.sol b/test/TestWitnetV2.sol index 4458b56a..f4560d69 100644 --- a/test/TestWitnetV2.sol +++ b/test/TestWitnetV2.sol @@ -26,9 +26,9 @@ contract TestWitnetV2 { requester: msg.sender, gasCallback: 500000, evmReward: 10 ** 18, - witnetBytecode: hex"0aab0412520801123268747470733a2f2f6170692e62696e616e63652e55532f6170692f76332f7469636b65723f73796d626f6c3d4254435553441a1a841877821864696c61737450726963658218571a000f4240185b124d0801122c68747470733a2f2f6170692e62697466696e65782e636f6d2f76312f7075627469636b65722f6274637573641a1b8418778218646a6c6173745f70726963658218571a000f4240185b12480801122d68747470733a2f2f7777772e6269747374616d702e6e65742f6170692f76322f7469636b65722f6274637573641a15841877821864646c6173748218571a000f4240185b12550801123168747470733a2f2f6170692e626974747265782e636f6d2f76332f6d61726b6574732f4254432d5553442f7469636b65721a1e8418778218646d6c6173745472616465526174658218571a000f4240185b12620801123768747470733a2f2f6170692e636f696e626173652e636f6d2f76322f65786368616e67652d72617465733f63757272656e63793d4254431a258618778218666464617461821866657261746573821864635553448218571a000f4240185b12630801123268747470733a2f2f6170692e6b72616b656e2e636f6d2f302f7075626c69632f5469636b65723f706169723d4254435553441a2b87187782186666726573756c7482186668585842545a55534482186161618216008218571a000f4240185b1a0d0a0908051205fa3fc000001003220d0a0908051205fa4020000010031080a3c347180a2080ade20428333080acc7f037", - witnetRAD: bytes32(0), - witnetSLA: Witnet.RadonSLA({ + radonBytecode: hex"0aab0412520801123268747470733a2f2f6170692e62696e616e63652e55532f6170692f76332f7469636b65723f73796d626f6c3d4254435553441a1a841877821864696c61737450726963658218571a000f4240185b124d0801122c68747470733a2f2f6170692e62697466696e65782e636f6d2f76312f7075627469636b65722f6274637573641a1b8418778218646a6c6173745f70726963658218571a000f4240185b12480801122d68747470733a2f2f7777772e6269747374616d702e6e65742f6170692f76322f7469636b65722f6274637573641a15841877821864646c6173748218571a000f4240185b12550801123168747470733a2f2f6170692e626974747265782e636f6d2f76332f6d61726b6574732f4254432d5553442f7469636b65721a1e8418778218646d6c6173745472616465526174658218571a000f4240185b12620801123768747470733a2f2f6170692e636f696e626173652e636f6d2f76322f65786368616e67652d72617465733f63757272656e63793d4254431a258618778218666464617461821866657261746573821864635553448218571a000f4240185b12630801123268747470733a2f2f6170692e6b72616b656e2e636f6d2f302f7075626c69632f5469636b65723f706169723d4254435553441a2b87187782186666726573756c7482186668585842545a55534482186161618216008218571a000f4240185b1a0d0a0908051205fa3fc000001003220d0a0908051205fa4020000010031080a3c347180a2080ade20428333080acc7f037", + radonRadHash: bytes32(0), + radonSLA: Witnet.RadonSLA({ witNumWitnesses: 7, witUnitaryReward: 10 ** 9, maxTallyResultSize: 32 @@ -45,9 +45,9 @@ contract TestWitnetV2 { requester: msg.sender, gasCallback: 500000, evmReward: 10 ** 18, - witnetBytecode: hex"", - witnetRAD: bytes32(bytes2(0x1234)), - witnetSLA: Witnet.RadonSLA({ + radonBytecode: hex"", + radonRadHash: bytes32(bytes2(0x1234)), + radonSLA: Witnet.RadonSLA({ witNumWitnesses: 7, witUnitaryReward: 10 ** 9, maxTallyResultSize: 32 From e6ff2e6a83832ffc6bcc8838e55a0ddd70494b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Mon, 5 Aug 2024 13:19:49 +0200 Subject: [PATCH 28/39] refactor: mockups/* --- contracts/apps/WitRandomnessV21.sol | 22 ++-- contracts/interfaces/IWitRandomness.sol | 4 +- contracts/mockups/UsingWitOracle.sol | 81 ++++++------ .../mockups/UsingWitOracleRandomness.sol | 6 +- contracts/mockups/UsingWitOracleRequest.sol | 36 ++++-- .../mockups/UsingWitOracleRequestTemplate.sol | 116 ++++++++++++++---- contracts/mockups/WitOracleConsumer.sol | 25 ++-- .../mockups/WitOracleRequestConsumer.sol | 34 +++-- .../WitOracleRequestTemplateConsumer.sol | 57 +++++++-- .../mockups/WitRandomnessRequestConsumer.sol | 70 +++++++---- test/mocks/MyDapp.sol | 8 +- test/mocks/WitMockedPriceFeeds.sol | 4 +- test/mocks/WitMockedRandomness.sol | 4 +- test/mocks/WitMockedRequestFactory.sol | 4 +- 14 files changed, 320 insertions(+), 151 deletions(-) diff --git a/contracts/apps/WitRandomnessV21.sol b/contracts/apps/WitRandomnessV21.sol index d089fbc8..de6097b0 100644 --- a/contracts/apps/WitRandomnessV21.sol +++ b/contracts/apps/WitRandomnessV21.sol @@ -70,7 +70,7 @@ contract WitRandomnessV21 filters: new Witnet.RadonFilter[](0) }) ); - __witOracleDefaultSLA.maxTallyResultSize = 34; + __witOracleDefaultQuerySLA.maxTallyResultSize = 34; } receive() virtual external payable { @@ -367,12 +367,12 @@ contract WitRandomnessV21 virtual override returns (uint256) { - return __postRandomizeQuery(__witOracleDefaultSLA); + return __postRandomizeQuery(__witOracleDefaultQuerySLA); } /// @notice Requests the Witnet oracle to generate an EVM-agnostic and trustless source of randomness. /// @dev Only one randomness request per block will be actually posted to the Witnet Oracle. - /// @dev Reverts if given SLA security parameters are below witOracleQuerySLA(). + /// @dev Reverts if given SLA security parameters are below witOracleDefaultQuerySLA(). /// @return Funds actually paid as randomize fee. function randomize(Witnet.RadonSLA calldata _querySLA) external payable @@ -380,7 +380,7 @@ contract WitRandomnessV21 returns (uint256) { _require( - _querySLA.equalOrGreaterThan(__witOracleDefaultSLA), + _querySLA.equalOrGreaterThan(__witOracleDefaultQuerySLA), "unsecure randomize" ); return __postRandomizeQuery(_querySLA); @@ -390,12 +390,12 @@ contract WitRandomnessV21 /// @notice when solving randomness requests: /// @notice - number of witnessing nodes contributing to randomness generation /// @notice - reward in $nanoWIT received by every contributing node in the Witnet blockchain - function witOracleQuerySLA() - virtual override - external view + function witOracleDefaultQuerySLA() + virtual override (UsingWitOracle, IWitRandomness) + public view returns (Witnet.RadonSLA memory) { - return __witOracleDefaultSLA; + return __witOracleDefaultQuerySLA; } @@ -449,16 +449,16 @@ contract WitRandomnessV21 __witOracleBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - function settleDefaultQuerySLA(Witnet.RadonSLA calldata _witOracleQuerySLA) + function settleDefaultQuerySLA(Witnet.RadonSLA calldata _querySLA) virtual override external onlyOwner { _require( - _witOracleQuerySLA.isValid(), + _querySLA.isValid(), "invalid SLA" ); - __witOracleDefaultSLA = _witOracleQuerySLA; + __witOracleDefaultQuerySLA = _querySLA; } diff --git a/contracts/interfaces/IWitRandomness.sol b/contracts/interfaces/IWitRandomness.sol index 23ddadb9..8d60d870 100644 --- a/contracts/interfaces/IWitRandomness.sol +++ b/contracts/interfaces/IWitRandomness.sol @@ -98,7 +98,7 @@ interface IWitRandomness { /// @notice while fulfilling the given SLA data security parameters. /// @dev Only one randomness request per block will be actually posted to the Witnet Oracle. /// @dev Unused funds will be transferred back to the `msg.sender`. - /// @dev Passed SLA security parameters must be equal or greater than `witOracleQuerySLA()`. + /// @dev Passed SLA security parameters must be equal or greater than `witOracleDefaultQuerySLA()`. /// @return Funds actually paid as randomize fee. function randomize(Witnet.RadonSLA calldata) external payable returns (uint256); @@ -106,7 +106,7 @@ interface IWitRandomness { /// @notice when solving randomness requests: /// @notice - number of witnessing nodes contributing to randomness generation /// @notice - reward in $nanoWIT received per witnessing node in the Witnet blockchain - function witOracleQuerySLA() external view returns (Witnet.RadonSLA memory); + function witOracleDefaultQuerySLA() external view returns (Witnet.RadonSLA memory); /// @notice Returns the unique identifier of the Witnet-compliant data request being used for solving randomness. function witOracleQueryRadHash() external view returns (bytes32); diff --git a/contracts/mockups/UsingWitOracle.sol b/contracts/mockups/UsingWitOracle.sol index f1e86a3d..1122aef7 100644 --- a/contracts/mockups/UsingWitOracle.sol +++ b/contracts/mockups/UsingWitOracle.sol @@ -11,52 +11,51 @@ import "../WitOracle.sol"; abstract contract UsingWitOracle is IWitOracleEvents -{ - /// @dev Immutable reference to the Witnet Request Board contract. +{ + /// @notice Immutable reference to the WitOracle contract. + function witOracle() virtual public view returns (WitOracle) { + return __witOracle; + } WitOracle internal immutable __witOracle; - /// @dev Default Security-Level Agreement parameters to be fulfilled by the Witnet blockchain - /// @dev when solving a data request. - Witnet.RadonSLA internal __witOracleDefaultSLA; - /// @dev Percentage over base fee to pay on every data request, /// @dev as to deal with volatility of evmGasPrice and evmWitPrice during the live time of /// @dev a data request (since being posted until a result gets reported back), at both the EVM and /// @dev the Witnet blockchain levels, respectivelly. uint16 internal __witOracleBaseFeeOverheadPercentage; - /// @param _wrb Address of the WitOracle contract. - constructor(WitOracle _wrb) { + /// @notice Default SLA data security parameters to be fulfilled by the Wit/oracle blockchain + /// @notice when solving a data request. + function witOracleDefaultQuerySLA() virtual public view returns (Witnet.RadonSLA memory) { + return __witOracleDefaultQuerySLA; + } + Witnet.RadonSLA internal __witOracleDefaultQuerySLA; + + /// @dev Provides a convenient way for client contracts extending this to block the execution of the main logic of the + /// @dev contract until a particular request has been successfully solved and reported from the Wit/oracle blockchain, + /// @dev either with an error or successfully. + modifier witOracleQuerySolved(uint256 _queryId) { + require(_witOracleCheckQueryResultAvailability(_queryId), "UsingWitOracle: unsolved query"); + _; + } + + /// @param _witOracle Address of the WitOracle bridging contract. + constructor(WitOracle _witOracle) { require( - _wrb.specs() == type(WitOracle).interfaceId, + _witOracle.specs() == type(WitOracle).interfaceId, "UsingWitOracle: uncompliant WitOracle" ); - __witOracle = _wrb; - __witOracleDefaultSLA = Witnet.RadonSLA({ - // Number of nodes in the Witnet blockchain that will take part in solving the data request: + __witOracle = _witOracle; + __witOracleDefaultQuerySLA = Witnet.RadonSLA({ witNumWitnesses: 10, - // Reward in $nanoWIT to be paid to every node in the Witnet blockchain involved in solving some data query. witUnitaryReward: 2 * 10 ** 8, // defaults to 0.2 $WIT - // Maximum size accepted for the CBOR-encoded buffer containing successfull result values. maxTallyResultSize: 32 }); __witOracleBaseFeeOverheadPercentage = 33; // defaults to 33% } - /// @dev Provides a convenient way for client contracts extending this to block the execution of the main logic of the - /// @dev contract until a particular request has been successfully solved and reported by Witnet, - /// @dev either with an error or successfully. - modifier witnetQuerySolved(uint256 _queryId) { - require(_witOracleCheckQueryResultAvailability(_queryId), "UsingWitOracle: unsolved query"); - _; - } - - function witOracle() virtual public view returns (WitOracle) { - return __witOracle; - } - - /// @notice Check if given query was already reported back from the Witnet oracle. + /// @dev Check if given query was already reported back from the Wit/oracle blockchain. /// @param _id The unique identifier of a previously posted data request. function _witOracleCheckQueryResultAvailability(uint256 _id) internal view @@ -65,28 +64,30 @@ abstract contract UsingWitOracle return __witOracle.getQueryStatus(_id) == Witnet.QueryStatus.Reported; } - /// @notice Estimate the minimum reward required for posting a data request, using `tx.gasprice` as a reference. - function _witOracleEstimateBaseFee() - virtual internal view - returns (uint256) + /// @dev Returns a struct describing the resulting error from some given query id. + function _witOracleCheckQueryResultError(uint256 _queryId) + internal view + returns (Witnet.ResultError memory) { - return ( - (100 + __witOracleBaseFeeOverheadPercentage) - * __witOracle.estimateBaseFee(tx.gasprice) - ) / 100; + return __witOracle.getQueryResultError(_queryId); } - function _witOracleCheckQueryQueryResponseStatus(uint256 _queryId) + /// @dev Return current response status to some given gquery id. + function _witOracleCheckQueryResponseStatus(uint256 _queryId) internal view returns (Witnet.QueryResponseStatus) { return __witOracle.getQueryResponseStatus(_queryId); } - function _witOracleCheckQueryResultError(uint256 _queryId) - internal view - returns (Witnet.ResultError memory) + /// @dev Estimate the minimum reward required for posting a data request (based on `tx.gasprice`). + function _witOracleEstimateBaseFee() + virtual internal view + returns (uint256) { - return __witOracle.getQueryResultError(_queryId); + return ( + (100 + __witOracleBaseFeeOverheadPercentage) + * __witOracle.estimateBaseFee(tx.gasprice) + ) / 100; } } diff --git a/contracts/mockups/UsingWitOracleRandomness.sol b/contracts/mockups/UsingWitOracleRandomness.sol index 7c096cb3..42446008 100644 --- a/contracts/mockups/UsingWitOracleRandomness.sol +++ b/contracts/mockups/UsingWitOracleRandomness.sol @@ -13,8 +13,7 @@ abstract contract UsingWitOracleRandomness IWitOracleEvents, IWitRandomnessEvents { - WitOracle immutable public witnet; - WitRandomness immutable public __RNG; + WitRandomness immutable public witOracleRandomness; constructor(WitRandomness _witOracleRandomness) { require( @@ -22,8 +21,7 @@ abstract contract UsingWitOracleRandomness && _witOracleRandomness.specs() == type(WitRandomness).interfaceId, "UsingWitOracleRandomness: uncompliant WitRandomness appliance" ); - __RNG = _witOracleRandomness; - witnet = __RNG.witOracle(); + witOracleRandomness = _witOracleRandomness; } } diff --git a/contracts/mockups/UsingWitOracleRequest.sol b/contracts/mockups/UsingWitOracleRequest.sol index 7bbc80cf..05d76ceb 100644 --- a/contracts/mockups/UsingWitOracleRequest.sol +++ b/contracts/mockups/UsingWitOracleRequest.sol @@ -7,8 +7,12 @@ import "../WitOracleRequest.sol"; abstract contract UsingWitOracleRequest is UsingWitOracle { - WitOracleRequest immutable public dataRequest; + /// @notice Immutable address of the underlying WitOracleRequest used for every fresh data + /// @notice update pulled from this contract. + WitOracleRequest immutable public witOracleRequest; + /// @dev Immutable RAD hash of the underlying data request being solved on the Wit/oracle blockchain + /// @dev upon every fresh data update pulled from this contract. bytes32 immutable internal __witOracleRequestRadHash; /// @param _witOracleRequest Address of the WitOracleRequest contract containing the actual data request. @@ -23,26 +27,40 @@ abstract contract UsingWitOracleRequest _witOracleRequest.specs() == type(WitOracleRequest).interfaceId, "UsingWitOracleRequest: uncompliant WitOracleRequest" ); - dataRequest = _witOracleRequest; + witOracleRequest = _witOracleRequest; __witOracleRequestRadHash = _witOracleRequest.radHash(); __witOracleBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - function __witOracleRequestData(uint256 _witOracleEvmReward) + /// @dev Pulls a data update from the Wit/oracle blockchain based on the underlying `witOracleRequest`, + /// @dev and the default `__witOracleDefaultQuerySLA` data security parameters. + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle when pulling the data update. + function __witOraclePostQuery( + uint256 _queryEvmReward + ) virtual internal returns (uint256) { - return __witOracleRequestData(_witOracleEvmReward, __witOracleDefaultSLA); + return __witOraclePostQuery( + _queryEvmReward, + __witOracleDefaultQuerySLA + ); } - function __witOracleRequestData( - uint256 _witOracleEvmReward, - Witnet.RadonSLA memory _witOracleQuerySLA + /// @dev Pulls a data update from the Wit/oracle blockchain based on the underlying `witOracleRequest`, + /// @dev and the given `_querySLA` data security parameters. + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle when pulling the data update. + /// @param _querySLA The required SLA data security params for the Wit/oracle blockchain to accomplish. + function __witOraclePostQuery( + uint256 _queryEvmReward, + Witnet.RadonSLA memory _querySLA ) virtual internal returns (uint256) { - return __witOracle.postRequest{value: _witOracleEvmReward}( + return __witOracle.postRequest{ + value: _queryEvmReward + }( __witOracleRequestRadHash, - _witOracleQuerySLA + _querySLA ); } } diff --git a/contracts/mockups/UsingWitOracleRequestTemplate.sol b/contracts/mockups/UsingWitOracleRequestTemplate.sol index 46076e60..4c2774d0 100644 --- a/contracts/mockups/UsingWitOracleRequestTemplate.sol +++ b/contracts/mockups/UsingWitOracleRequestTemplate.sol @@ -9,7 +9,8 @@ import "../WitOracleRequestTemplate.sol"; abstract contract UsingWitOracleRequestTemplate is UsingWitOracle { - WitOracleRequestTemplate immutable public dataRequestTemplate; + /// @notice Immutable address of the inderlying WitOracleRequestTemplate contained within this contract. + WitOracleRequestTemplate immutable public witOracleRequestTemplate; /// @param _witOracleRequestTemplate Address of the WitOracleRequestTemplate from which actual data requests will get built. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. @@ -23,41 +24,114 @@ abstract contract UsingWitOracleRequestTemplate _witOracleRequestTemplate.specs() == type(WitOracleRequestTemplate).interfaceId, "UsingWitOracleRequestTemplate: uncompliant WitOracleRequestTemplate" ); - dataRequestTemplate = _witOracleRequestTemplate; + witOracleRequestTemplate = _witOracleRequestTemplate; __witOracleBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - - function _witOracleBuildRadHash(string[][] memory _witOracleRequestArgs) - internal returns (bytes32) - { - return dataRequestTemplate.verifyRadonRequest(_witOracleRequestArgs); - } - function _witOracleBuildRequest(string[][] memory _witOracleRequestArgs) - internal returns (WitOracleRequest) + /// @dev Build a new WitOracleRequest instance out of the given parameters. + /// @dev Reverts if the number of given parameters don't match as required by the underlying + /// @dev template's parameterized data sources (i.e. Radon Retrievals). + function __witOracleBuildRequest( + string[][] memory _witOracleRequestArgs + ) + virtual internal returns (WitOracleRequest) { - return WitOracleRequest(dataRequestTemplate.buildWitOracleRequest(_witOracleRequestArgs)); + return WitOracleRequest(witOracleRequestTemplate.buildWitOracleRequest(_witOracleRequestArgs)); } - function __witOracleRequestData( - uint256 _witOracleEvmReward, + /// @dev Verify and register into the witOracle() registry a Wit/oracle compliant data request based + /// @dev on the underlying `witOracleRequestTemplate`. Returns the RAD hash of the successfully verifed + /// @dev data request. Reverts if the number of given parameters don't match as required by the underlying + /// @dev template's parameterized data sources (i.e. Radon Retrievals). + function __witOracleVerifyRadHash( string[][] memory _witOracleRequestArgs ) + virtual internal returns (bytes32) + { + return witOracleRequestTemplate.verifyRadonRequest(_witOracleRequestArgs); + } + + /// @dev Pulls a fresh update from the Wit/oracle blockchain of some pre-verified Wit/oracle compliant + /// @dev data request, and the default `__witOracleDefaultQuerySLA` data security parameters. + /// @dev Returns some unique query id. + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle bridge when pulling the data update. + /// @param _queryRadHash RAD hash of some pre-verified data request in the witOracle()'s registry. + function __witOraclePostQuery( + uint256 _queryEvmReward, + bytes32 _queryRadHash + ) virtual internal returns (uint256) { - return __witOracleRequestData(_witOracleEvmReward, _witOracleRequestArgs, __witOracleDefaultSLA); + return __witOraclePostQuery( + _queryEvmReward, + _queryRadHash, + __witOracleDefaultQuerySLA + ); } - function __witOracleRequestData( - uint256 _witOracleEvmReward, - string[][] memory _witOracleRequestArgs, - Witnet.RadonSLA memory _witOracleQuerySLA + /// @dev Pulls a fresh update from the Wit/oracle blockchain of some pre-verified Wit/oracle compliant + /// @dev data request, and the given `_querSLA` data security parameters. Returns some unique query id. + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle bridge when pulling the data update. + /// @param _queryRadHash RAD hash of some pre-verified data request in the witOracle()'s registry. + /// @param _querySLA The required SLA data security params for the Wit/oracle blockchain to accomplish. + function __witOraclePostQuery( + uint256 _queryEvmReward, + bytes32 _queryRadHash, + Witnet.RadonSLA memory _querySLA ) virtual internal returns (uint256) { - return __witOracle.postRequest{value: _witOracleEvmReward}( - _witOracleBuildRadHash(_witOracleRequestArgs), - _witOracleQuerySLA + return __witOracle.postRequest{ + value: _queryEvmReward + }( + _queryRadHash, + _querySLA + ); + } + + /// @dev Pulls a fresh update from the Wit/oracle blockchain based on some data request built out + /// @dev of the underlying `witOracleRequestTemplate`, and the default `__witOracleDefaultQuerySLA` + /// @dev data security parameters. Returns the unique RAD hash of the just-built data request, and some + /// @dev unique query id. Reverts if the number of given parameters don't match as required by the + /// @dev underlying template's parameterized data sources (i.e. Radon Retrievals). + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle bridge when pulling the data update. + /// @param _witOracleRequestArgs Parameters passed to the `witOracleRequestTemplate` for building a new data request. + function __witOraclePostQuery( + uint256 _queryEvmReward, + string[][] memory _witOracleRequestArgs + ) + virtual internal returns (bytes32, uint256) + { + return __witOraclePostQuery( + _queryEvmReward, + __witOracleDefaultQuerySLA, + _witOracleRequestArgs + ); + } + + /// @dev Pulls a fresh update from the Wit/oracle blockchain based on some data request built out + /// @dev of the underlying `witOracleRequestTemplate`, and the given `_querSLA` data security parameters. + /// @dev Returns the unique RAD hash of the just-built data request, and some unique query id. + /// @dev Reverts if the number of given parameters don't match as required by the underlying template's + /// @dev parameterized data sources (i.e. Radon Retrievals). + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle bridge when pulling the data update. + /// @param _querySLA The required SLA data security params for the Wit/oracle blockchain to accomplish. + /// @param _witOracleRequestArgs Parameters passed to the `witOracleRequestTemplate` for building a new data request. + function __witOraclePostQuery( + uint256 _queryEvmReward, + Witnet.RadonSLA memory _querySLA, + string[][] memory _witOracleRequestArgs + ) + virtual internal returns ( + bytes32 _queryRadHash, + uint256 _queryId + ) + { + _queryRadHash = __witOracleVerifyRadHash(_witOracleRequestArgs); + _queryId = __witOraclePostQuery( + _queryEvmReward, + _queryRadHash, + _querySLA ); } } diff --git a/contracts/mockups/WitOracleConsumer.sol b/contracts/mockups/WitOracleConsumer.sol index a1a8edcb..6abced5c 100644 --- a/contracts/mockups/WitOracleConsumer.sol +++ b/contracts/mockups/WitOracleConsumer.sol @@ -34,29 +34,26 @@ abstract contract WitOracleConsumer /// =============================================================================================================== /// --- WitOracleConsumer virtual methods ---------------------------------------------------------------------------- + /// @dev Estimate the minimum reward required for posting a data request (based on `tx.gasprice` and + /// @dev `__witOracleCallbackGasLimit`). function _witOracleEstimateBaseFee() virtual override internal view returns (uint256) { - return ( - (100 + __witOracleBaseFeeOverheadPercentage) - * __witOracle.estimateBaseFeeWithCallback( - tx.gasprice, - __witOracleCallbackGasLimit - ) - ) / 100; + return _witOracleEstimateBaseFeeWithCallback(__witOracleCallbackGasLimit); } - /// @notice Estimate the minimum reward required for posting a data request, using `tx.gasprice` as a reference. - /// @dev Underestimates if the size of returned data is greater than `_resultMaxSize`. - /// @param _callbackGasLimit Maximum gas to be spent when reporting the data request result. - function _witOracleEstimateBaseFeeWithCallback(uint24 _callbackGasLimit) - virtual internal view - returns (uint256) + /// @dev Estimate the minimum reward required for posting a data request, based on `tx.gasprice` and + /// @dev the given `_witOracleCallbackGasLimit` value. + /// @param _witOracleCallbackGasLimit Maximum gas to be spent when reporting the data request result. + function _witOracleEstimateBaseFeeWithCallback( + uint24 _witOracleCallbackGasLimit + ) + virtual internal view returns (uint256) { return ( (100 + __witOracleBaseFeeOverheadPercentage) * __witOracle.estimateBaseFeeWithCallback( tx.gasprice, - _callbackGasLimit + _witOracleCallbackGasLimit ) ) / 100; } diff --git a/contracts/mockups/WitOracleRequestConsumer.sol b/contracts/mockups/WitOracleRequestConsumer.sol index 943daee4..b4ffb8df 100644 --- a/contracts/mockups/WitOracleRequestConsumer.sol +++ b/contracts/mockups/WitOracleRequestConsumer.sol @@ -24,6 +24,8 @@ abstract contract WitOracleRequestConsumer WitOracleConsumer(_callbackGasLimit) {} + /// @dev Estimate the minimum reward required for posting a data request (based on `tx.gasprice` and + /// @dev `__witOracleCallbackGasLimit`). function _witOracleEstimateBaseFee() virtual override(UsingWitOracle, WitOracleConsumer) internal view @@ -32,18 +34,36 @@ abstract contract WitOracleRequestConsumer return WitOracleConsumer._witOracleEstimateBaseFee(); } - function __witOracleRequestData( - uint256 _witOracleEvmReward, - Witnet.RadonSLA memory _witOracleQuerySLA + /// @dev Pulls a data update from the Wit/oracle blockchain based on the underlying `witOracleRequest`, + /// @dev the default `__witOracleDefaultQuerySLA` data security parameters and the immutable value of + /// @dev `__witOracleCalbackGasLimit`. + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle when pulling the data update. + function __witOraclePostQuery( + uint256 _queryEvmReward ) - virtual override - internal returns (uint256) + virtual override internal returns (uint256) + { + return __witOraclePostQuery( + _queryEvmReward, + __witOracleDefaultQuerySLA + ); + } + + /// @dev Pulls a data update from the Wit/oracle blockchain based on the underlying `witOracleRequest`, + /// @dev the given `_querySLA` data security parameters and the immutable value of `__witOracleCallbackGasLimit`. + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle when pulling the data update. + /// @param _querySLA The required SLA data security params for the Wit/oracle blockchain to accomplish. + function __witOraclePostQuery( + uint256 _queryEvmReward, + Witnet.RadonSLA memory _querySLA + ) + virtual override internal returns (uint256) { return __witOracle.postRequestWithCallback{ - value: _witOracleEvmReward + value: _queryEvmReward }( __witOracleRequestRadHash, - _witOracleQuerySLA, + _querySLA, __witOracleCallbackGasLimit ); } diff --git a/contracts/mockups/WitOracleRequestTemplateConsumer.sol b/contracts/mockups/WitOracleRequestTemplateConsumer.sol index 213094ff..9fdc7f3e 100644 --- a/contracts/mockups/WitOracleRequestTemplateConsumer.sol +++ b/contracts/mockups/WitOracleRequestTemplateConsumer.sol @@ -24,6 +24,8 @@ abstract contract WitOracleRequestTemplateConsumer WitOracleConsumer(_callbackGasLimit) {} + /// @dev Estimate the minimum reward required for posting a data request (based on `tx.gasprice` and + /// @dev `__witOracleCallbackGasLimit`). function _witOracleEstimateBaseFee() virtual override(UsingWitOracle, WitOracleConsumer) internal view @@ -32,21 +34,54 @@ abstract contract WitOracleRequestTemplateConsumer return WitOracleConsumer._witOracleEstimateBaseFee(); } - function __witOracleRequestData( - uint256 _witOracleEvmReward, - string[][] memory _witOracleRequestArgs, - Witnet.RadonSLA memory _witOracleQuerySLA + /// @dev Pulls a fresh update from the Wit/oracle blockchain based on some data request built out + /// @dev of the underlying `witOracleRequestTemplate`, the default `__witOracleDefaultQuerySLA` data + /// @dev security parameters and the immutable value of `__witOracleCallbackGasLimit`. + /// @dev Returns the unique RAD hash of the just-built data request, and some unique query id. + /// @dev Reverts if the number of given parameters don't match as required by the underlying template's + /// @dev parameterized data sources (i.e. Radon Retrievals). + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle bridge when pulling the data update. + /// @param _witOracleRequestArgs Parameters passed to the `witOracleRequestTemplate` for building a new data request. + function __witOraclePostQuery( + uint256 _queryEvmReward, + string[][] memory _witOracleRequestArgs ) - virtual override - internal returns (uint256) + virtual override internal returns (bytes32, uint256) { - return __witOracle.postRequestWithCallback{ - value: _witOracleEvmReward + return __witOraclePostQuery( + _queryEvmReward, + __witOracleDefaultQuerySLA, + _witOracleRequestArgs + ); + } + + /// @dev Pulls a fresh update from the Wit/oracle blockchain based on some data request built out + /// @dev of the underlying `witOracleRequestTemplate`, and the given `_querSLA` data security parameters, + /// @dev and the immutable value of `__witOracleCallbackGasLimit`. + /// @dev Returns the unique RAD hash of the just-built data request, and some unique query id. + /// @dev Reverts if the number of given parameters don't match as required by the underlying template's + /// @dev parameterized data sources (i.e. Radon Retrievals). + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle bridge when pulling the data update. + /// @param _querySLA The required SLA data security params for the Wit/oracle blockchain to accomplish. + /// @param _witOracleRequestArgs Parameters passed to the `witOracleRequestTemplate` for building a new data request. + function __witOraclePostQuery( + uint256 _queryEvmReward, + Witnet.RadonSLA memory _querySLA, + string[][] memory _witOracleRequestArgs + ) + virtual override internal + returns ( + bytes32 _queryRadHash, + uint256 _queryId + ) + { + _queryRadHash = __witOracleVerifyRadHash(_witOracleRequestArgs); + _queryId = __witOracle.postRequestWithCallback{ + value: _queryEvmReward }( - _witOracleBuildRadHash(_witOracleRequestArgs), - _witOracleQuerySLA, + _queryRadHash, + _querySLA, __witOracleCallbackGasLimit ); } - } diff --git a/contracts/mockups/WitRandomnessRequestConsumer.sol b/contracts/mockups/WitRandomnessRequestConsumer.sol index 194ad4ad..edbd1d51 100644 --- a/contracts/mockups/WitRandomnessRequestConsumer.sol +++ b/contracts/mockups/WitRandomnessRequestConsumer.sol @@ -17,31 +17,33 @@ abstract contract WitRandomnessRequestConsumer bytes32 internal immutable __witOracleRandomnessRadHash; - /// @param _wrb Address of the WitOracle contract. + /// @param _witOracle Address of the WitOracle contract. /// @param _baseFeeOverheadPercentage Percentage over base fee to pay as on every data request. /// @param _callbackGasLimit Maximum gas to be spent by the IWitOracleConsumer's callback methods. constructor( - WitOracle _wrb, + WitOracle _witOracle, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit ) - UsingWitOracle(_wrb) + UsingWitOracle(_witOracle) WitOracleConsumer(_callbackGasLimit) { // On-chain building of the Witnet Randomness Request: { WitOracleRadonRegistry _registry = witOracle().registry(); // Build own Witnet Randomness Request: - bytes32[] memory _retrievals = new bytes32[](1); - _retrievals[0] = _registry.verifyRadonRetrieval( - Witnet.RadonRetrievalMethods.RNG, - "", // no url - "", // no body - new string[2][](0), // no headers - hex"80" // no retrieval script - ); __witOracleRandomnessRadHash = _registry.verifyRadonRequest( - _retrievals, + abi.decode( + abi.encode([ + _registry.verifyRadonRetrieval( + Witnet.RadonRetrievalMethods.RNG, + "", // no url + "", // no body + new string[2][](0), // no headers + hex"80" // no retrieval script + ) + ]), (bytes32[]) + ), Witnet.RadonReducer({ opcode: Witnet.RadonReduceOpcodes.Mode, filters: new Witnet.RadonFilter[](0) @@ -53,9 +55,19 @@ abstract contract WitRandomnessRequestConsumer ); } __witOracleBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; + __witOracleDefaultQuerySLA.maxTallyResultSize = 34; + } - function _witOracleRandomUniformUint32(uint32 _range, uint256 _nonce, bytes32 _seed) internal pure returns (uint32) { + /// @dev Pure P-RNG generator returning uniformly distributed `_range` values based on + /// @dev given `_nonce` and `_seed` values. + function _witOracleRandomUniformUint32( + uint32 _range, + uint256 _nonce, + bytes32 _seed + ) + internal pure returns (uint32) + { uint256 _number = uint256( keccak256( abi.encode(_seed, _nonce) @@ -64,26 +76,40 @@ abstract contract WitRandomnessRequestConsumer return uint32((_number * _range) >> 224); } - function _witOracleReadRandomizeFromResultValue(WitnetCBOR.CBOR calldata cborValue) internal pure returns (bytes32) { + /// @dev Helper function for decoding randomness seed embedded within a CBOR-encoded result + /// @dev as provided from the Wit/oracle blockchain. + function _witOracleRandomizeSeedFromResultValue(WitnetCBOR.CBOR calldata cborValue) internal pure returns (bytes32) { return cborValue.readBytes().toBytes32(); } - function __witOracleRandomize(uint256 _witOracleEvmReward) virtual internal returns (uint256) { - return __witOracleRandomize(_witOracleEvmReward, __witOracleDefaultSLA); + /// @dev Trigger some randomness request to be solved by the Wit/oracle blockchain, by paying the + /// @dev exact amount of `_queryEvmReward` of the underlying WitOracle bridge contract, and based + /// @dev on the `__witOracleDefaultQuerySLA` data security parameters. + function __witOracleRandomize( + uint256 _queryEvmReward + ) + virtual internal returns (uint256) + { + return __witOracleRandomize( + _queryEvmReward, + __witOracleDefaultQuerySLA + ); } + /// @dev Trigger some randomness request to be solved by the Wit/oracle blockchain, by paying the + /// @dev exact amount of `_queryEvmReward` of the underlying WitOracle bridge contract, and based + /// @dev on the given `_querySLA` data security parameters. function __witOracleRandomize( - uint256 _witOracleEvmReward, - Witnet.RadonSLA memory _witOracleQuerySLA + uint256 _queryEvmReward, + Witnet.RadonSLA memory _querySLA ) - virtual internal - returns (uint256 _randomizeId) + virtual internal returns (uint256) { return __witOracle.postRequestWithCallback{ - value: _witOracleEvmReward + value: _queryEvmReward }( __witOracleRandomnessRadHash, - _witOracleQuerySLA, + _querySLA, __witOracleCallbackGasLimit ); } diff --git a/test/mocks/MyDapp.sol b/test/mocks/MyDapp.sol index c387230a..d60b3ff1 100644 --- a/test/mocks/MyDapp.sol +++ b/test/mocks/MyDapp.sol @@ -28,9 +28,9 @@ contract MyDapp uint256 private immutable __randomizeValue; - constructor(WitOracle _wrb, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit) + constructor(WitOracle _witOracle, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit) WitRandomnessRequestConsumer( - _wrb, + _witOracle, _baseFeeOverheadPercentage, _callbackGasLimit ) @@ -68,10 +68,10 @@ contract MyDapp override external onlyFromWitnet { - // randomness = _witOracleReadRandomizeFromResultValue(witnetResultCborValue); + // randomness = _witOracleRandomizeSeedFromResultValue(witnetResultCborValue); // delete rubbish; // witOracle.burnQuery(_queryId); - // emit Result(queryId, _witOracleReadRandomizeFromResultValue(cborValue)); + // emit Result(queryId, _witOracleRandomizeSeedFromResultValue(cborValue)); } function reportWitOracleResultError( diff --git a/test/mocks/WitMockedPriceFeeds.sol b/test/mocks/WitMockedPriceFeeds.sol index 002e6869..416feb13 100644 --- a/test/mocks/WitMockedPriceFeeds.sol +++ b/test/mocks/WitMockedPriceFeeds.sol @@ -12,9 +12,9 @@ import "../../contracts/apps/WitPriceFeedsV21.sol"; /// @dev THE `WitPriceFeeds` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. contract WitMockedPriceFeeds is WitPriceFeedsV21 { - constructor(WitMockedOracle _wrb) + constructor(WitMockedOracle _witOracle) WitPriceFeedsV21( - _wrb, + _witOracle, false, bytes32("mocked") ) diff --git a/test/mocks/WitMockedRandomness.sol b/test/mocks/WitMockedRandomness.sol index 90c3371a..d9dace25 100644 --- a/test/mocks/WitMockedRandomness.sol +++ b/test/mocks/WitMockedRandomness.sol @@ -12,7 +12,7 @@ import "../../contracts/apps/WitRandomnessV21.sol"; /// @dev THE `WitRandomness` CONTRACT ADDRESS PROVIDED /// @dev BY THE WITNET FOUNDATION. contract WitMockedRandomness is WitRandomnessV21 { - constructor(WitMockedOracle _wrb) - WitRandomnessV21(_wrb, msg.sender) + constructor(WitMockedOracle _witOracle) + WitRandomnessV21(_witOracle, msg.sender) {} } diff --git a/test/mocks/WitMockedRequestFactory.sol b/test/mocks/WitMockedRequestFactory.sol index 8e070688..67d23258 100644 --- a/test/mocks/WitMockedRequestFactory.sol +++ b/test/mocks/WitMockedRequestFactory.sol @@ -15,9 +15,9 @@ contract WitMockedRequestFactory is WitOracleRequestFactoryDefault { - constructor (WitMockedOracle _wrb) + constructor (WitMockedOracle _witOracle) WitOracleRequestFactoryDefault( - WitOracle(address(_wrb)), + WitOracle(address(_witOracle)), false, bytes32("mocked") ) From 54d9f7adc2724d52f806603d55a22880e2260e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Mon, 5 Aug 2024 13:40:54 +0200 Subject: [PATCH 29/39] feat: IWitOracle.postRequestWithCallback(IWitOracleConsumer, ...) --- .../core/trustable/WitOracleTrustableBase.sol | 64 +++++++++++++++---- contracts/interfaces/IWitOracle.sol | 35 +++++----- 2 files changed, 69 insertions(+), 30 deletions(-) diff --git a/contracts/core/trustable/WitOracleTrustableBase.sol b/contracts/core/trustable/WitOracleTrustableBase.sol index e0d8355f..74160ab8 100644 --- a/contracts/core/trustable/WitOracleTrustableBase.sol +++ b/contracts/core/trustable/WitOracleTrustableBase.sol @@ -51,9 +51,11 @@ abstract contract WitOracleTrustableBase return type(WitOracleTrustableBase).name; } - modifier checkCallbackRecipient(address _addr, uint24 _callbackGasLimit) { + modifier checkCallbackRecipient(IWitOracleConsumer _consumer, uint24 _callbackGasLimit) { _require( - _addr.code.length > 0 && IWitOracleConsumer(_addr).reportableFrom(address(this)) && _callbackGasLimit > 0, + address(_consumer).code.length > 0 + && _consumer.reportableFrom(address(this)) + && _callbackGasLimit > 0, "invalid callback" ); _; } @@ -379,7 +381,12 @@ abstract contract WitOracleTrustableBase checkSLA(_querySLA) returns (uint256 _queryId) { - _queryId = __postRequest(_queryRAD, _querySLA, 0); + _queryId = __postRequest( + _msgSender(), + _queryRAD, + _querySLA, + 0 + ); // Let Web3 observers know that a new request has been posted emit WitOracleQuery( _msgSender(), @@ -405,20 +412,36 @@ abstract contract WitOracleTrustableBase /// @param _queryRAD The RAD hash of the data request to be solved by Witnet. /// @param _querySLA The data query SLA to be fulfilled on the Witnet blockchain. /// @param _queryCallbackGasLimit Maximum gas to be spent when reporting the data request result. - /// @return _queryId Unique query identifier. function postRequestWithCallback( bytes32 _queryRAD, Witnet.RadonSLA memory _querySLA, uint24 _queryCallbackGasLimit ) - virtual override - public payable - checkCallbackRecipient(msg.sender, _queryCallbackGasLimit) + virtual override public payable + returns (uint256) + { + return postRequestWithCallback( + IWitOracleConsumer(_msgSender()), + _queryRAD, + _querySLA, + _queryCallbackGasLimit + ); + } + + function postRequestWithCallback( + IWitOracleConsumer _consumer, + bytes32 _queryRAD, + Witnet.RadonSLA memory _querySLA, + uint24 _queryCallbackGasLimit + ) + virtual override public payable + checkCallbackRecipient(_consumer, _queryCallbackGasLimit) checkReward(estimateBaseFeeWithCallback(_getGasPrice(), _queryCallbackGasLimit)) checkSLA(_querySLA) returns (uint256 _queryId) { _queryId = __postRequest( + address(_consumer), _queryRAD, _querySLA, _queryCallbackGasLimit @@ -447,20 +470,36 @@ abstract contract WitOracleTrustableBase /// @param _queryUnverifiedBytecode The (unverified) bytecode containing the actual data request to be solved by the Witnet blockchain. /// @param _querySLA The data query SLA to be fulfilled on the Witnet blockchain. /// @param _queryCallbackGasLimit Maximum gas to be spent when reporting the data request result. - /// @return _queryId Unique query identifier. function postRequestWithCallback( + bytes calldata _queryUnverifiedBytecode, + Witnet.RadonSLA memory _querySLA, + uint24 _queryCallbackGasLimit + ) + virtual override public payable + returns (uint256) + { + return postRequestWithCallback( + IWitOracleConsumer(_msgSender()), + _queryUnverifiedBytecode, + _querySLA, + _queryCallbackGasLimit + ); + } + + function postRequestWithCallback( + IWitOracleConsumer _consumer, bytes calldata _queryUnverifiedBytecode, Witnet.RadonSLA memory _querySLA, uint24 _queryCallbackGasLimit ) - virtual override - public payable - checkCallbackRecipient(msg.sender, _queryCallbackGasLimit) + virtual override public payable + checkCallbackRecipient(_consumer, _queryCallbackGasLimit) checkReward(estimateBaseFeeWithCallback(_getGasPrice(), _queryCallbackGasLimit)) checkSLA(_querySLA) returns (uint256 _queryId) { _queryId = __postRequest( + address(_consumer), bytes32(0), _querySLA, _queryCallbackGasLimit @@ -825,6 +864,7 @@ abstract contract WitOracleTrustableBase } function __postRequest( + address _requester, bytes32 _radHash, Witnet.RadonSLA memory _sla, uint24 _callbackGasLimit @@ -836,7 +876,7 @@ abstract contract WitOracleTrustableBase Witnet.QueryRequest storage __request = WitOracleDataLib.seekQueryRequest(_queryId); _require(__request.requester == address(0), "already posted"); { - __request.requester = msg.sender; + __request.requester = _requester; __request.gasCallback = _callbackGasLimit; __request.evmReward = uint72(_getMsgValue()); __request.radonRadHash = _radHash; diff --git a/contracts/interfaces/IWitOracle.sol b/contracts/interfaces/IWitOracle.sol index afd11bac..34bd4114 100644 --- a/contracts/interfaces/IWitOracle.sol +++ b/contracts/interfaces/IWitOracle.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; -import "../libs/Witnet.sol"; +import "./IWitOracleConsumer.sol"; import "../WitOracleRadonRegistry.sol"; import "../WitOracleRequestFactory.sol"; @@ -111,17 +111,17 @@ interface IWitOracle { /// @param queryCallbackGasLimit Maximum gas to be spent when reporting the data request result. /// @return queryId Unique query identifier. function postRequestWithCallback( - bytes32 queryRAD, - Witnet.RadonSLA calldata querySLA, + bytes32 queryRAD, + Witnet.RadonSLA calldata querySLA, uint24 queryCallbackGasLimit ) external payable returns (uint256 queryId); - // function postRequestWithCallbackFrom( - // address consumer, - // bytes32 queryRAD, - // Witnet.RadonSLA calldata querySLA, - // uint24 queryCallbackGasLimit - // ) external payable returns (uint256 queryId); + function postRequestWithCallback( + IWitOracleConsumer consumer, + bytes32 queryRAD, + Witnet.RadonSLA calldata querySLA, + uint24 queryCallbackGasLimit + ) external payable returns (uint256 queryId); /// @notice Requests the execution of the given Witnet Data Request, in expectation that it will be relayed and solved by /// @notice the Witnet blockchain. A reward amount is escrowed by the Witnet Request Board that will be transferred to the @@ -139,17 +139,16 @@ interface IWitOracle { /// @return queryId Unique query identifier. function postRequestWithCallback( bytes calldata queryUnverifiedBytecode, - Witnet.RadonSLA calldata querySLA, + Witnet.RadonSLA calldata querySLA, uint24 queryCallbackGasLimit - ) external payable returns (uint256 queryId); - + ) external payable returns (uint256 queryId); - // function postRequestWithCallbackFrom( - // address consumer, - // bytes calldata queryUnverifiedBytecode, - // Witnet.RadonSLA calldata querySLA, - // uint24 queryCallbackGasLimit - // ) external payable returns (uint256 queryId); + function postRequestWithCallback( + IWitOracleConsumer consumer, + bytes calldata queryUnverifiedBytecode, + Witnet.RadonSLA calldata querySLA, + uint24 queryCallbackGasLimit + ) external payable returns (uint256 queryId); /// @notice Returns the singleton WitOracleRadonRegistry in which all Witnet-compliant data requests /// @notice and templates must be previously verified so they can be passed as reference when From 7a70235f02aae38589423039c0d1c1bfc185f915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Mon, 5 Aug 2024 18:07:51 +0200 Subject: [PATCH 30/39] fix: migrations and tests --- .../core/trustable/WitOracleTrustableBase.sol | 2 - .../WitOracleRadonRegistryDefault.sol | 4 +- migrations/scripts/3_core.js | 2 +- migrations/scripts/4_proxies.js | 2 +- test/TestWitOracleRadonEncodingLib.sol | 4 +- test/{TestWitnetV2.sol => TestWitnet.sol} | 0 test/mocks/WitMockedRandomness.sol | 2 +- ...test.js => witOracleRadonRegistry.spec.js} | 394 +++++------------- 8 files changed, 102 insertions(+), 308 deletions(-) rename test/{TestWitnetV2.sol => TestWitnet.sol} (100%) rename test/{witnet_bytecodes.test.js => witOracleRadonRegistry.spec.js} (57%) diff --git a/contracts/core/trustable/WitOracleTrustableBase.sol b/contracts/core/trustable/WitOracleTrustableBase.sol index 74160ab8..b596dc44 100644 --- a/contracts/core/trustable/WitOracleTrustableBase.sol +++ b/contracts/core/trustable/WitOracleTrustableBase.sol @@ -206,8 +206,6 @@ abstract contract WitOracleTrustableBase _require(address(registry).code.length > 0, "inexistent registry"); _require(registry.specs() == type(WitOracleRadonRegistry).interfaceId, "uncompliant registry"); - _require(address(factory).code.length > 0, "inexistent factory"); - _require(address(factory.witOracle()) == address(this), "discordant factory"); // Set reporters, if any __setReporters(_newReporters); diff --git a/contracts/core/trustless/WitOracleRadonRegistryDefault.sol b/contracts/core/trustless/WitOracleRadonRegistryDefault.sol index ae867184..9acb9c15 100644 --- a/contracts/core/trustless/WitOracleRadonRegistryDefault.sol +++ b/contracts/core/trustless/WitOracleRadonRegistryDefault.sol @@ -164,8 +164,8 @@ contract WitOracleRadonRegistryDefault // --- Implementation of 'IWitOracleRadonRegistry' ----------------------------------------------------------------------- function bytecodeOf(bytes32 _radHash) - public view - override + public view override + radonRequestExists(_radHash) returns (bytes memory) { return __database().radsBytecode[_radHash]; diff --git a/migrations/scripts/3_core.js b/migrations/scripts/3_core.js index 1cce444e..e28a36bb 100644 --- a/migrations/scripts/3_core.js +++ b/migrations/scripts/3_core.js @@ -43,7 +43,7 @@ module.exports = async function (_, network, [, from]) { libs: specs.WitOracleRequestFactory.libs, immutables: specs.WitOracleRequestFactory.immutables, intrinsics: { - types: ["address", "address", "bool", "bytes32"], + types: ["address", "bool", "bytes32"], values: [ /* _witOracle */ await determineProxyAddr(from, specs.WitOracle?.vanity || 3), /* _upgradable */ true, diff --git a/migrations/scripts/4_proxies.js b/migrations/scripts/4_proxies.js index d3266029..96ff0e0c 100644 --- a/migrations/scripts/4_proxies.js +++ b/migrations/scripts/4_proxies.js @@ -18,8 +18,8 @@ module.exports = async function (_, network, [, from, reporter]) { const singletons = [ "WitOracleRadonRegistry", - "WitOracleRequestFactory", "WitOracle", + "WitOracleRequestFactory", "WitPriceFeeds", ] diff --git a/test/TestWitOracleRadonEncodingLib.sol b/test/TestWitOracleRadonEncodingLib.sol index b7e8cecf..6741fb72 100644 --- a/test/TestWitOracleRadonEncodingLib.sol +++ b/test/TestWitOracleRadonEncodingLib.sol @@ -88,7 +88,7 @@ contract TestWitOracleRadonEncodingLib { Witnet.RadonRetrieval memory source; source.method = Witnet.RadonRetrievalMethods.HttpGet; source.url = "https://data.messar.io/api/v1/assets/\\0\\/metrics/market-data?fields=market_data/price_\\1\\"; - source.script = hex"861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b"; + source.radonScript = hex"861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b"; bytes memory bytecode = WitOracleRadonEncodingLib.encode(source); // emit Log(bytecode); Assert.equal( @@ -106,7 +106,7 @@ contract TestWitOracleRadonEncodingLib { source.headers = new string[2][](2); source.headers[0] = [ "user-agent", "witnet-rust" ]; source.headers[1] = [ "content-type", "text/html; charset=utf-8" ]; - source.script = hex"861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b"; + source.radonScript = hex"861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b"; bytes memory bytecode = WitOracleRadonEncodingLib.encode(source); // emit Log(bytecode); Assert.equal( diff --git a/test/TestWitnetV2.sol b/test/TestWitnet.sol similarity index 100% rename from test/TestWitnetV2.sol rename to test/TestWitnet.sol diff --git a/test/mocks/WitMockedRandomness.sol b/test/mocks/WitMockedRandomness.sol index d9dace25..bac876a6 100644 --- a/test/mocks/WitMockedRandomness.sol +++ b/test/mocks/WitMockedRandomness.sol @@ -1,4 +1,4 @@ -ยบ// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; diff --git a/test/witnet_bytecodes.test.js b/test/witOracleRadonRegistry.spec.js similarity index 57% rename from test/witnet_bytecodes.test.js rename to test/witOracleRadonRegistry.spec.js index ffc22c51..cb4fc8f9 100644 --- a/test/witnet_bytecodes.test.js +++ b/test/witOracleRadonRegistry.spec.js @@ -1,6 +1,7 @@ +import("chai") + const utils = require("../src/utils") const { expectEvent, expectRevert } = require("@openzeppelin/test-helpers") -const { assert } = require("chai") const { expectRevertCustomError } = require("custom-error-test-helper") const WitOracleRadonRegistry = artifacts.require("WitOracleRadonRegistryDefault") @@ -12,11 +13,11 @@ contract("WitOracleRadonRegistry", (accounts) => { const firstOwnerAddress = accounts[1] const unprivilegedAddress = accounts[4] - let bytecodes + let radonRegistry before(async () => { await WitOracleRadonRegistry.link(WitOracleRadonEncodingLib, WitOracleRadonEncodingLib.address) - bytecodes = await WitOracleRadonRegistry.new( + radonRegistry = await WitOracleRadonRegistry.new( true, utils.fromAscii("testing") ) @@ -28,13 +29,12 @@ contract("WitOracleRadonRegistry", (accounts) => { context("Ownable2Step", async () => { it("should revert if transferring ownership from stranger", async () => { - await expectRevert( - bytecodes.transferOwnership(unprivilegedAddress, { from: unprivilegedAddress }), - "not the owner" + await expectRevert.unspecified( + radonRegistry.transferOwnership(unprivilegedAddress, { from: unprivilegedAddress }), ) }) it("owner can start transferring ownership", async () => { - const tx = await bytecodes.transferOwnership(firstOwnerAddress, { from: creatorAddress }) + const tx = await radonRegistry.transferOwnership(firstOwnerAddress, { from: creatorAddress }) expectEvent( tx.receipt, "OwnershipTransferStarted", @@ -43,12 +43,12 @@ contract("WitOracleRadonRegistry", (accounts) => { }) it("stranger cannot accept transferring ownership", async () => { await expectRevert( - bytecodes.acceptOwnership({ from: unprivilegedAddress }), + radonRegistry.acceptOwnership({ from: unprivilegedAddress }), "not the new owner" ) }) it("ownership is fully transferred upon acceptance", async () => { - const tx = await bytecodes.acceptOwnership({ from: firstOwnerAddress }) + const tx = await radonRegistry.acceptOwnership({ from: firstOwnerAddress }) expectEvent( tx.receipt, "OwnershipTransferred", @@ -57,33 +57,31 @@ contract("WitOracleRadonRegistry", (accounts) => { newOwner: firstOwnerAddress, } ) - assert.equal(firstOwnerAddress, await bytecodes.owner()) + assert.equal(firstOwnerAddress, await radonRegistry.owner()) }) }) context("Upgradeable", async () => { it("should manifest to be upgradable from actual owner", async () => { assert.equal( - await bytecodes.isUpgradableFrom(firstOwnerAddress), + await radonRegistry.isUpgradableFrom(firstOwnerAddress), true ) }) it("should manifest to not be upgradable from anybody else", async () => { assert.equal( - await bytecodes.isUpgradableFrom(unprivilegedAddress), + await radonRegistry.isUpgradableFrom(unprivilegedAddress), false ) }) it("cannot be initialized more than once", async () => { - await expectRevertCustomError( - WitOracleRadonRegistry, - bytecodes.initialize("0x", { from: firstOwnerAddress }), - "AlreadyUpgraded" + await expectRevert( + radonRegistry.initialize("0x", { from: firstOwnerAddress }), + "already initialized" ) - await expectRevertCustomError( - WitOracleRadonRegistry, - bytecodes.initialize("0x", { from: unprivilegedAddress }), - "OnlyOwner" + await expectRevert( + radonRegistry.initialize("0x", { from: unprivilegedAddress }), + "not the owner" ) }) }) @@ -108,29 +106,23 @@ contract("WitOracleRadonRegistry", (accounts) => { context("verifyRadonRetrieval(..)", async () => { context("Witnet.RadonRetrievalMethods.RNG", async () => { it("emits appropiate single event when verifying randomness data source for the first time", async () => { - const tx = await bytecodes.verifyRadonRetrieval( + const tx = await radonRegistry.verifyRadonRetrieval( 2, // requestMethod - "", // requestSchema - "", // requestFQDN - "", // requestPath - "", // requestQuery + "", // requestURL "", // requestBody [], // requestHeaders "0x80", // requestRadonScript ) expectEvent( tx.receipt, - "NewRadonRetrievalHash" + "NewRadonRetrieval" ) rngSourceHash = tx.logs[0].args.hash }) it("emits no event when verifying already existing randomness data source", async () => { - const tx = await bytecodes.verifyRadonRetrieval( + const tx = await radonRegistry.verifyRadonRetrieval( 2, // requestMethod - "", // requestSchema - "", // requestFQDN - "", // requestPath - "", // requestQuery + "", // requestURL "", // requestBody [], // requestHeaders "0x80", // requestRadonScript @@ -138,12 +130,9 @@ contract("WitOracleRadonRegistry", (accounts) => { assert.equal(tx.logs.length, 0, "some unexpected event was emitted") }) it("generates proper hash upon offchain verification of already existing randmoness source", async () => { - const hash = await bytecodes.verifyRadonRetrieval.call( + const hash = await radonRegistry.verifyRadonRetrieval.call( 2, // requestMethod - "", // requestSchema - "", // requestFQDN - "", // requestPath - "", // requestQuery + "", // requestURL "", // requestBody [], // requestHeaders "0x80", // requestRadonScript @@ -155,43 +144,37 @@ contract("WitOracleRadonRegistry", (accounts) => { context("Witnet.RadonRetrievalMethods.HttpGet", async () => { it( "emits new data provider and source events when verifying a new http-get source for the first time", async () => { - const tx = await bytecodes.verifyRadonRetrieval( + const tx = await radonRegistry.verifyRadonRetrieval( 1, // requestMethod - "HTTPs://", // requestSchema - "api.binance.US", // requestFQDN - "api/v3/ticker/price", // requestPath - "symbol=\\0\\\\1\\", // requestQuery + "https://api.binance.us/api/v3/ticker/price?symbol=\\0\\\\1\\", "", // requestBody [], // requestHeaders "0x841877821864696c61737450726963658218571a000f4240185b", // requestRadonScript ) + // expectEvent( + // tx.receipt, + // "NewDataProvider" + // ) + // assert.equal(tx.logs[0].args.index, 1) expectEvent( tx.receipt, - "NewDataProvider" - ) - assert.equal(tx.logs[0].args.index, 1) - expectEvent( - tx.receipt, - "NewRadonRetrievalHash" + "NewRadonRetrieval" ) - binanceTickerHash = tx.logs[1].args.hash + binanceTickerHash = tx.logs[0].args.hash }) it("data source metadata gets stored as expected", async () => { - const ds = await bytecodes.lookupRadonRetrieval(binanceTickerHash) + const ds = await radonRegistry.lookupRadonRetrieval(binanceTickerHash) assert.equal(ds.method, 1) // HTTP-GET - assert.equal(ds.resultDataType, 4) // Integer + assert.equal(ds.dataType, 4) // Integer assert.equal(ds.url, "https://api.binance.us/api/v3/ticker/price?symbol=\\0\\\\1\\") assert.equal(ds.body, "") assert(ds.headers.length === 0) - assert.equal(ds.script, "0x841877821864696c61737450726963658218571a000f4240185b") + assert.equal(ds.radonScript, "0x841877821864696c61737450726963658218571a000f4240185b") }) it("emits one single event when verifying new http-get endpoint to already existing provider", async () => { - const tx = await bytecodes.verifyRadonRetrieval( + const tx = await radonRegistry.verifyRadonRetrieval( 1, // requestMethod - "http://", // requestSchema - "api.binance.us", // requestFQDN - "api/v3/ticker/24hr", // requestPath - "symbol=\\0\\\\1\\", // requestQuery + "http://api.binance.us/api/v3/ticker/24hr?symbol=\\0\\\\1\\", // requestQuery "", // requestBody [], // requestHeaders "0x841877821864696c61737450726963658218571a000f4240185b", // requestRadonScript @@ -199,19 +182,16 @@ contract("WitOracleRadonRegistry", (accounts) => { assert.equal(tx.logs.length, 1) expectEvent( tx.receipt, - "NewRadonRetrievalHash" + "NewRadonRetrieval" ) }) }) context("Witnet.RadonRetrievalMethods.HttpPost", async () => { it( "emits new data provider and source events when verifying a new http-post source for the first time", async () => { - const tx = await bytecodes.verifyRadonRetrieval( + const tx = await radonRegistry.verifyRadonRetrieval( 3, // requestMethod - "HTTPs://", // requestSchema - "api.thegraph.com", // requestFQDN - "subgraphs/name/uniswap/uniswap-v3", // requestPath - "", // requestQuery + "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3", "{\"query\":\"{pool(id:\"\\0\\\"){token1Price}}\"}", // requestBody [ ["user-agent", "witnet-rust"], @@ -219,21 +199,21 @@ contract("WitOracleRadonRegistry", (accounts) => { ], // requestHeaders "0x861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b", // requestRadonScript ) + // expectEvent( + // tx.receipt, + // "NewDataProvider" + // ) + // assert.equal(tx.logs[0].args.index, 2) expectEvent( tx.receipt, - "NewDataProvider" - ) - assert.equal(tx.logs[0].args.index, 2) - expectEvent( - tx.receipt, - "NewRadonRetrievalHash" + "NewRadonRetrieval" ) - uniswapToken1PriceHash = tx.logs[1].args.hash + uniswapToken1PriceHash = tx.logs[0].args.hash }) it("data source metadata gets stored as expected", async () => { - const ds = await bytecodes.lookupRadonRetrieval(uniswapToken1PriceHash) + const ds = await radonRegistry.lookupRadonRetrieval(uniswapToken1PriceHash) assert.equal(ds.method, 3) // HTTP-GET - assert.equal(ds.resultDataType, 4) // Integer + assert.equal(ds.dataType, 4) // Integer assert.equal(ds.url, "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3") assert.equal(ds.body, "{\"query\":\"{pool(id:\"\\0\\\"){token1Price}}\"}") assert(ds.headers.length === 2) @@ -241,30 +221,28 @@ contract("WitOracleRadonRegistry", (accounts) => { assert.equal(ds.headers[0][1], "witnet-rust") assert.equal(ds.headers[1][0], "content-type") assert.equal(ds.headers[1][1], "text/html; charset=utf-8") - assert.equal(ds.script, "0x861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b") + assert.equal(ds.radonScript, "0x861877821866646461746182186664706f6f6c8218646b746f6b656e3150726963658218571a000f4240185b") }) }) }) context("verifyRadonReducer(..)", async () => { it("emits event when verifying new radon reducer with no filter", async () => { - const tx = await bytecodes.verifyRadonReducer([ + const tx = await radonRegistry.verifyRadonReducer([ 11, // opcode: ConcatenateAndHash [], // filters - "0x", // script ]) expectEvent( tx.receipt, - "NewRadonReducerHash" + "NewRadonReducer" ) concathashReducerHash = tx.logs[0].args.hash // concathashReducerBytecode = tx.logs[0].args.bytecode }) it("emits no event when verifying an already verified radon sla with no filter", async () => { - const tx = await bytecodes.verifyRadonReducer([ + const tx = await radonRegistry.verifyRadonReducer([ 11, // ConcatenateAndHash [], // filters - "0x", // script ]) assert.equal( tx.logs.length, @@ -273,70 +251,58 @@ contract("WitOracleRadonRegistry", (accounts) => { ) }) it("generates proper hash upon offchain call", async () => { - const hash = await bytecodes.verifyRadonReducer.call([ + const hash = await radonRegistry.verifyRadonReducer.call([ 11, // ConcatenateAndHash [], // filters - "0x", // script ]) assert.equal(hash, concathashReducerHash) }) - it("reverts custom error if verifying radon reducer with unsupported opcode", async () => { - await expectRevertCustomError( - Witnet, - bytecodes.verifyRadonReducer([ + it("reverts if verifying radon reducer with unsupported opcode", async () => { + await expectRevert.unspecified( + radonRegistry.verifyRadonReducer([ 0, // Minimum [], // filters - "0x", // script ]), - "UnsupportedRadonReducerOpcode" ) }) - it("reverts custom error if verifying radon reducer with at least one unsupported filter", async () => { - await expectRevertCustomError( - Witnet, - bytecodes.verifyRadonReducer([ + it("reverts if verifying radon reducer with at least one unsupported filter", async () => { + await expectRevert.unspecified( + radonRegistry.verifyRadonReducer([ 5, // AverageMedian [ [8, "0x"], // Mode: supported [0, "0x"], // Greater than: not yet supported ], - "0x", // script ]), - "UnsupportedRadonFilterOpcode" ) }) - it("reverts custom error if verifying radon reducer with stdev filter but no args", async () => { - await expectRevertCustomError( - Witnet, - bytecodes.verifyRadonReducer([ + it("reverts if verifying radon reducer with stdev filter but no args", async () => { + await expectRevert.unspecified( + radonRegistry.verifyRadonReducer([ 2, // Mode [ [5, "0x"], // Standard deviation filter ], - "0x", // script ]), - "RadonFilterMissingArgs" ) }) it("verifying radon reducer with stdev filter and args works", async () => { - let tx = await bytecodes.verifyRadonReducer([ + let tx = await radonRegistry.verifyRadonReducer([ 3, // AverageMean [ [5, "0xF93E00"], // StdDev(1.5) filter ], - "0x", // script ]) expectEvent( tx.receipt, - "NewRadonReducerHash" + "NewRadonReducer" ) stdev15ReducerHash = tx.logs[0].args.hash - tx = await bytecodes.verifyRadonReducer([ + tx = await radonRegistry.verifyRadonReducer([ 2, // Mode [ [5, "0xF94100"], // StdDev(2.5) filter ], - "0x", // script ]) stdev25ReducerHash = tx.logs[0].args.hash }) @@ -345,18 +311,17 @@ contract("WitOracleRadonRegistry", (accounts) => { context("verifyRadonRequest(..)", async () => { context("Use case: Randomness", async () => { it("emits single event when verifying new radomness request", async () => { - let tx = await bytecodes.verifyRadonReducer([ + let tx = await radonRegistry.verifyRadonReducer([ 2, // Mode [], // no filters - "0x", // script ]) expectEvent( tx.receipt, - "NewRadonReducerHash" + "NewRadonReducer" ) modeNoFiltersReducerHash = tx.logs[0].args.hash // modeNoFiltersReducerBytecode = tx.logs[0].args.bytecode - tx = await bytecodes.verifyRadonRequest( + tx = await radonRegistry.verifyRadonRequest( [ // sources rngSourceHash, ], @@ -367,12 +332,12 @@ contract("WitOracleRadonRegistry", (accounts) => { assert(tx.logs.length === 1) expectEvent( tx.receipt, - "NewRadHash" + "NewRadonRequest" ) - rngHash = tx.logs[0].args.hash + rngHash = tx.logs[0].args.radHash }) it("emits no event when verifying same randomness request", async () => { - const tx = await bytecodes.verifyRadonRequest( + const tx = await radonRegistry.verifyRadonRequest( [ // sources rngSourceHash, ], @@ -383,7 +348,7 @@ contract("WitOracleRadonRegistry", (accounts) => { assert(tx.logs.length === 0) }) it("generates same hash when verifying same randomness request offchain", async () => { - const hash = await bytecodes.verifyRadonRequest.call( + const hash = await radonRegistry.methods['verifyRadonRequest(bytes32[],bytes32,bytes32,uint16,string[][])'].call( [ // sources rngSourceHash, ], @@ -398,7 +363,7 @@ contract("WitOracleRadonRegistry", (accounts) => { context("Use case: Price feeds", async () => { it("reverts custom error if trying to verify request w/ templated source and 0 args out of 2", async () => { await expectRevert.unspecified( - bytecodes.verifyRadonRequest( + radonRegistry.verifyRadonRequest( [ // sources binanceTickerHash, ], @@ -411,7 +376,7 @@ contract("WitOracleRadonRegistry", (accounts) => { }) it("reverts custom error if trying to verify request w/ templated source and 1 args out of 2", async () => { await expectRevert.unspecified( - bytecodes.verifyRadonRequest( + radonRegistry.verifyRadonRequest( [ // sources binanceTickerHash, ], @@ -425,7 +390,7 @@ contract("WitOracleRadonRegistry", (accounts) => { ) }) it("emits single event when verifying new price feed request for the first time", async () => { - const tx = await bytecodes.verifyRadonRequest( + const tx = await radonRegistry.verifyRadonRequest( [ // source binanceTickerHash, ], @@ -439,13 +404,13 @@ contract("WitOracleRadonRegistry", (accounts) => { assert(tx.logs.length === 1) expectEvent( tx.receipt, - "NewRadHash" + "NewRadonRequest" ) - btcUsdPriceFeedHash = tx.logs[0].args.hash + btcUsdPriceFeedHash = tx.logs[0].args.radHash // btcUsdPriceFeedBytecode = tx.logs[0].args.bytecode }) it("verifying radon request with repeated sources works", async () => { - const tx = await bytecodes.verifyRadonRequest( + const tx = await radonRegistry.verifyRadonRequest( [ // sources binanceTickerHash, binanceTickerHash, @@ -461,13 +426,12 @@ contract("WitOracleRadonRegistry", (accounts) => { assert(tx.logs.length === 1) expectEvent( tx.receipt, - "NewRadHash" + "NewRadonRequest" ) }) it("reverts if trying to verify radon request w/ incompatible sources", async () => { - await expectRevertCustomError( - Witnet, - bytecodes.verifyRadonRequest( + await expectRevert( + radonRegistry.verifyRadonRequest( [ // sources binanceTickerHash, rngSourceHash, @@ -480,15 +444,11 @@ contract("WitOracleRadonRegistry", (accounts) => { [], ], ), - "RadonRequestResultsMismatch", [ - 1, // index - 0, // read - 4, // expected - ] + "mismatching retrievals" ) }) it("emits single event when verifying new radon request w/ http-post source", async () => { - const tx = await bytecodes.verifyRadonRequest( + const tx = await radonRegistry.verifyRadonRequest( [ // sources uniswapToken1PriceHash, ], @@ -502,11 +462,11 @@ contract("WitOracleRadonRegistry", (accounts) => { assert(tx.logs.length === 1) expectEvent( tx.receipt, - "NewRadHash" + "NewRadonRequest" ) }) it("emits single event when verifying new radon request w/ repeated http-post sources", async () => { - const tx = await bytecodes.verifyRadonRequest( + const tx = await radonRegistry.verifyRadonRequest( [ // sources uniswapToken1PriceHash, uniswapToken1PriceHash, @@ -530,192 +490,28 @@ contract("WitOracleRadonRegistry", (accounts) => { assert(tx.logs.length === 1) expectEvent( tx.receipt, - "NewRadHash" + "NewRadonRequest" ) - heavyRetrievalHash = tx.logs[0].args.hash + heavyRetrievalHash = tx.logs[0].args.radHash }) }) }) - context("verifyRadonSLA(..)", async () => { - it("emits event when verifying new radon sla", async () => { - const tx = await bytecodes.verifyRadonSLA([ - 10, - 51, - 10 ** 9, - 5 * 10 ** 9, - 10 ** 6, - ]) - expectEvent( - tx.receipt, - "NewSlaHash" - ) - slaHash = tx.logs[0].args.hash - }) - it("emits no event when verifying an already verified radon sla", async () => { - const tx = await bytecodes.verifyRadonSLA([ - 10, - 51, - 10 ** 9, - 5 * 10 ** 9, - 10 ** 6, - ]) - assert.equal( - tx.logs.length, - 0, - "some unexpected event was emitted" - ) - }) - it("generates proper hash upon offchain call", async () => { - const hash = await bytecodes.verifyRadonSLA.call([ - 10, - 51, - 10 ** 9, - 5 * 10 ** 9, - 10 ** 6, - ]) - assert.equal(hash, slaHash) - }) - it("reverts custom error if verifying radon sla with no reward", async () => { - await expectRevertCustomError( - Witnet, - bytecodes.verifyRadonSLA([ - 10, - 51, - 0, - 5 * 10 ** 9, - 10 ** 6, - ]), - "RadonSlaNoReward" - ) - }) - it("reverts custom error if verifying radon sla with no witnesses", async () => { - await expectRevertCustomError( - Witnet, - bytecodes.verifyRadonSLA([ - 0, - 51, - 10 ** 9, - 5 * 10 ** 9, - 10 ** 6, - ]), - "RadonSlaNoWitnesses" - ) - }) - it("reverts custom error if verifying radon sla with too many witnesses", async () => { - await expectRevertCustomError( - Witnet, - bytecodes.verifyRadonSLA([ - 500, - 51, - 10 ** 9, - 15 * 10 ** 9, - 10 ** 6, - ]), - "RadonSlaTooManyWitnesses" - ) - }) - it("reverts custom error if verifying radon sla with quorum out of range", async () => { - await expectRevertCustomError( - Witnet, - bytecodes.verifyRadonSLA([ - 10, - 50, - 10 ** 9, - 15 * 10 ** 9, - 10 ** 6, - ]), - "RadonSlaConsensusOutOfRange" - ) - await expectRevertCustomError( - Witnet, - bytecodes.verifyRadonSLA([ - 10, - 100, - 10 ** 9, - 5 * 10 ** 9, - 10 ** 6, - ]), - "RadonSlaConsensusOutOfRange" - ) - }) - it("reverts custom error if verifying radon sla with too low collateral", async () => { - await expectRevertCustomError( - Witnet, - bytecodes.verifyRadonSLA([ - 10, - 51, - 10 ** 6, - 10 ** 6, - 10 ** 6, - ]), - "RadonSlaLowCollateral" - ) - }) - }) - context("bytecodeOf(..)", async () => { context("radon requests", async () => { it("reverts if trying to get bytecode from unknown radon request", async () => { - await expectRevertCustomError( - WitOracleRadonRegistry, - bytecodes.bytecodeOf("0x0"), - "UnknownRadonRequest" + await expectRevert( + radonRegistry.bytecodeOf("0x0"), + "unverified" ) }) it("works if trying to get bytecode onchain from known radon request", async () => { - await bytecodes.bytecodeOf(btcUsdPriceFeedHash) + await radonRegistry.bytecodeOf(btcUsdPriceFeedHash) }) it("returns bytecode if getting it offchain from known radon request", async () => { - await bytecodes.bytecodeOf(btcUsdPriceFeedHash) + await radonRegistry.bytecodeOf(btcUsdPriceFeedHash) }) }) - context("radon slas", async () => { - it("reverts if trying to get bytecode from unknown radon sla", async () => { - await expectRevertCustomError( - WitOracleRadonRegistry, - bytecodes.bytecodeOf(btcUsdPriceFeedHash, "0x0"), - "UnknownRadonSLA" - ) - }) - it("works if trying to get bytecode onchain from known radon request and sla", async () => { - await bytecodes.bytecodeOf(btcUsdPriceFeedHash, slaHash) - }) - }) - }) - - context("hashOf(..)", async () => { - it("hashing unknown radon request doesn't revert", async () => { - await bytecodes.hashOf("0x", slaHash) - }) - it("hashing unknown radon sla doesn't revert", async () => { - await bytecodes.hashOf(btcUsdPriceFeedHash, "0x0") - }) - it("hashing of known radon request and sla works", async () => { - await bytecodes.hashOf(btcUsdPriceFeedHash, slaHash) - }) - }) - - context("hashWeightRewardOf(..)", async () => { - it("hashing unknown radon request reverts", async () => { - await expectRevertCustomError( - WitOracleRadonRegistry, - bytecodes.hashWeightWitsOf("0x0", slaHash), - "UnknownRadonRequest" - ) - }) - it("hashing unknown radon sla reverts", async () => { - await expectRevertCustomError( - WitOracleRadonRegistry, - bytecodes.hashWeightWitsOf(btcUsdPriceFeedHash, "0x0"), - "UnknownRadonSLA" - ) - }) - it("hashing of known radon request and sla works", async () => { - await bytecodes.hashWeightWitsOf( - heavyRetrievalHash, slaHash - ) - }) }) }) }) From 1c717fbabb5245436b759518853cc7ed5ead8203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Tue, 6 Aug 2024 10:30:29 +0200 Subject: [PATCH 31/39] chore: bump package version to 2.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a49c3d8d..100b4863 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "witnet-solidity-bridge", - "version": "2.0.15", + "version": "2.1.0", "description": "Witnet Solidity Bridge contracts for EVM-compatible chains", "author": "Witnet Foundation ", "license": "MIT", From b680dc4ed14d3361df197019981496889fe7952a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Fri, 9 Aug 2024 12:13:19 +0200 Subject: [PATCH 32/39] fix: Witnet.RadonSLA.equalOrGreater operator --- contracts/libs/Witnet.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/libs/Witnet.sol b/contracts/libs/Witnet.sol index 68a6eb34..c5ec28c5 100644 --- a/contracts/libs/Witnet.sol +++ b/contracts/libs/Witnet.sol @@ -406,7 +406,7 @@ library Witnet { return ( a.witNumWitnesses >= b.witNumWitnesses && a.witUnitaryReward >= b.witUnitaryReward - && a.maxTallyResultSize >= b.maxTallyResultSize + && a.maxTallyResultSize <= b.maxTallyResultSize ); } From 865993b800b289041c25adfacc85d76b66398ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Fri, 9 Aug 2024 12:14:36 +0200 Subject: [PATCH 33/39] chore: revisit default query sla on mockups --- contracts/mockups/UsingWitOracle.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/mockups/UsingWitOracle.sol b/contracts/mockups/UsingWitOracle.sol index 1122aef7..09e0e786 100644 --- a/contracts/mockups/UsingWitOracle.sol +++ b/contracts/mockups/UsingWitOracle.sol @@ -47,9 +47,9 @@ abstract contract UsingWitOracle ); __witOracle = _witOracle; __witOracleDefaultQuerySLA = Witnet.RadonSLA({ - witNumWitnesses: 10, - witUnitaryReward: 2 * 10 ** 8, // defaults to 0.2 $WIT - maxTallyResultSize: 32 + witNumWitnesses: 10, // defaults to 10 witnesses + witUnitaryReward: 2 * 10 ** 8, // defaults to 0.2 witcoins + maxTallyResultSize: 32 // defaults to 32 bytes }); __witOracleBaseFeeOverheadPercentage = 33; // defaults to 33% From 5c07d7b58f99cf04b3966634528f77908bc599bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Fri, 9 Aug 2024 12:15:56 +0200 Subject: [PATCH 34/39] feat: receive() external payable virtual on wit appliance mockups --- contracts/mockups/UsingWitOracleRandomness.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contracts/mockups/UsingWitOracleRandomness.sol b/contracts/mockups/UsingWitOracleRandomness.sol index 42446008..a3300e2b 100644 --- a/contracts/mockups/UsingWitOracleRandomness.sol +++ b/contracts/mockups/UsingWitOracleRandomness.sol @@ -24,5 +24,7 @@ abstract contract UsingWitOracleRandomness witOracleRandomness = _witOracleRandomness; } + receive() external payable virtual {} + } From 57676c86fe9abe83238e7025cd77e1c3a3a48322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Fri, 9 Aug 2024 12:16:14 +0200 Subject: [PATCH 35/39] refactor: UsingWitOracleRequestTemplate --- .../mockups/UsingWitOracleRequestTemplate.sol | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/contracts/mockups/UsingWitOracleRequestTemplate.sol b/contracts/mockups/UsingWitOracleRequestTemplate.sol index 4c2774d0..d88387d9 100644 --- a/contracts/mockups/UsingWitOracleRequestTemplate.sol +++ b/contracts/mockups/UsingWitOracleRequestTemplate.sol @@ -27,23 +27,12 @@ abstract contract UsingWitOracleRequestTemplate witOracleRequestTemplate = _witOracleRequestTemplate; __witOracleBaseFeeOverheadPercentage = _baseFeeOverheadPercentage; } - - /// @dev Build a new WitOracleRequest instance out of the given parameters. - /// @dev Reverts if the number of given parameters don't match as required by the underlying - /// @dev template's parameterized data sources (i.e. Radon Retrievals). - function __witOracleBuildRequest( - string[][] memory _witOracleRequestArgs - ) - virtual internal returns (WitOracleRequest) - { - return WitOracleRequest(witOracleRequestTemplate.buildWitOracleRequest(_witOracleRequestArgs)); - } /// @dev Verify and register into the witOracle() registry a Wit/oracle compliant data request based /// @dev on the underlying `witOracleRequestTemplate`. Returns the RAD hash of the successfully verifed /// @dev data request. Reverts if the number of given parameters don't match as required by the underlying /// @dev template's parameterized data sources (i.e. Radon Retrievals). - function __witOracleVerifyRadHash( + function __witOracleVerifyRadonRequest( string[][] memory _witOracleRequestArgs ) virtual internal returns (bytes32) @@ -94,18 +83,18 @@ abstract contract UsingWitOracleRequestTemplate /// @dev data security parameters. Returns the unique RAD hash of the just-built data request, and some /// @dev unique query id. Reverts if the number of given parameters don't match as required by the /// @dev underlying template's parameterized data sources (i.e. Radon Retrievals). - /// @param _queryEvmReward The exact EVM reward passed to the WitOracle bridge when pulling the data update. /// @param _witOracleRequestArgs Parameters passed to the `witOracleRequestTemplate` for building a new data request. + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle bridge when pulling the data update. function __witOraclePostQuery( - uint256 _queryEvmReward, - string[][] memory _witOracleRequestArgs + string[][] memory _witOracleRequestArgs, + uint256 _queryEvmReward ) virtual internal returns (bytes32, uint256) { return __witOraclePostQuery( + _witOracleRequestArgs, _queryEvmReward, - __witOracleDefaultQuerySLA, - _witOracleRequestArgs + __witOracleDefaultQuerySLA ); } @@ -118,16 +107,16 @@ abstract contract UsingWitOracleRequestTemplate /// @param _querySLA The required SLA data security params for the Wit/oracle blockchain to accomplish. /// @param _witOracleRequestArgs Parameters passed to the `witOracleRequestTemplate` for building a new data request. function __witOraclePostQuery( + string[][] memory _witOracleRequestArgs, uint256 _queryEvmReward, - Witnet.RadonSLA memory _querySLA, - string[][] memory _witOracleRequestArgs + Witnet.RadonSLA memory _querySLA ) virtual internal returns ( bytes32 _queryRadHash, uint256 _queryId ) { - _queryRadHash = __witOracleVerifyRadHash(_witOracleRequestArgs); + _queryRadHash = __witOracleVerifyRadonRequest(_witOracleRequestArgs); _queryId = __witOraclePostQuery( _queryEvmReward, _queryRadHash, From 0a63ad00b24f9be94b58e0747099b4ea40687021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Fri, 9 Aug 2024 12:16:34 +0200 Subject: [PATCH 36/39] refactor: WitOracleRequestTemplateConsumer --- .../WitOracleRequestTemplateConsumer.sol | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/contracts/mockups/WitOracleRequestTemplateConsumer.sol b/contracts/mockups/WitOracleRequestTemplateConsumer.sol index 9fdc7f3e..d809fe03 100644 --- a/contracts/mockups/WitOracleRequestTemplateConsumer.sol +++ b/contracts/mockups/WitOracleRequestTemplateConsumer.sol @@ -40,18 +40,18 @@ abstract contract WitOracleRequestTemplateConsumer /// @dev Returns the unique RAD hash of the just-built data request, and some unique query id. /// @dev Reverts if the number of given parameters don't match as required by the underlying template's /// @dev parameterized data sources (i.e. Radon Retrievals). - /// @param _queryEvmReward The exact EVM reward passed to the WitOracle bridge when pulling the data update. /// @param _witOracleRequestArgs Parameters passed to the `witOracleRequestTemplate` for building a new data request. + /// @param _queryEvmReward The exact EVM reward passed to the WitOracle bridge when pulling the data update. function __witOraclePostQuery( - uint256 _queryEvmReward, - string[][] memory _witOracleRequestArgs + string[][] memory _witOracleRequestArgs, + uint256 _queryEvmReward ) virtual override internal returns (bytes32, uint256) { return __witOraclePostQuery( + _witOracleRequestArgs, _queryEvmReward, - __witOracleDefaultQuerySLA, - _witOracleRequestArgs + __witOracleDefaultQuerySLA ); } @@ -61,13 +61,13 @@ abstract contract WitOracleRequestTemplateConsumer /// @dev Returns the unique RAD hash of the just-built data request, and some unique query id. /// @dev Reverts if the number of given parameters don't match as required by the underlying template's /// @dev parameterized data sources (i.e. Radon Retrievals). + /// @param _witOracleRequestArgs Parameters passed to the `witOracleRequestTemplate` for building a new data request. /// @param _queryEvmReward The exact EVM reward passed to the WitOracle bridge when pulling the data update. /// @param _querySLA The required SLA data security params for the Wit/oracle blockchain to accomplish. - /// @param _witOracleRequestArgs Parameters passed to the `witOracleRequestTemplate` for building a new data request. function __witOraclePostQuery( + string[][] memory _witOracleRequestArgs, uint256 _queryEvmReward, - Witnet.RadonSLA memory _querySLA, - string[][] memory _witOracleRequestArgs + Witnet.RadonSLA memory _querySLA ) virtual override internal returns ( @@ -75,7 +75,7 @@ abstract contract WitOracleRequestTemplateConsumer uint256 _queryId ) { - _queryRadHash = __witOracleVerifyRadHash(_witOracleRequestArgs); + _queryRadHash = __witOracleVerifyRadonRequest(_witOracleRequestArgs); _queryId = __witOracle.postRequestWithCallback{ value: _queryEvmReward }( From 2b35d0b32ffb15bd08eb0ccd80822e4178730366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Fri, 9 Aug 2024 12:18:20 +0200 Subject: [PATCH 37/39] refactor: UsingWitOracleRandomness -> UsingWitOracle --- ...{UsingWitOracleRandomness.sol => UsingWitRandomness.sol} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename contracts/mockups/{UsingWitOracleRandomness.sol => UsingWitRandomness.sol} (81%) diff --git a/contracts/mockups/UsingWitOracleRandomness.sol b/contracts/mockups/UsingWitRandomness.sol similarity index 81% rename from contracts/mockups/UsingWitOracleRandomness.sol rename to contracts/mockups/UsingWitRandomness.sol index a3300e2b..7acbf6dc 100644 --- a/contracts/mockups/UsingWitOracleRandomness.sol +++ b/contracts/mockups/UsingWitRandomness.sol @@ -5,10 +5,10 @@ pragma experimental ABIEncoderV2; import "../WitRandomness.sol"; -/// @title The UsingWitOracleRandomness contract +/// @title The UsingWitRandomness contract /// @dev Contracts willing to interact with WitRandomness appliance should just inherit from this contract. /// @author The Witnet Foundation. -abstract contract UsingWitOracleRandomness +abstract contract UsingWitRandomness is IWitOracleEvents, IWitRandomnessEvents @@ -19,7 +19,7 @@ abstract contract UsingWitOracleRandomness require( address(_witOracleRandomness).code.length > 0 && _witOracleRandomness.specs() == type(WitRandomness).interfaceId, - "UsingWitOracleRandomness: uncompliant WitRandomness appliance" + "UsingWitRandomness: uncompliant WitRandomness appliance" ); witOracleRandomness = _witOracleRandomness; } From af252c307f1715f2187f73a5c0fc7162324c5038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Fri, 9 Aug 2024 12:20:39 +0200 Subject: [PATCH 38/39] refactor: WitRandomnessRequestConsumer -> WitOracleRandomnessConsumer --- ...sRequestConsumer.sol => WitOracleRandomnessConsumer.sol} | 2 +- test/mocks/MyDapp.sol | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename contracts/mockups/{WitRandomnessRequestConsumer.sol => WitOracleRandomnessConsumer.sol} (98%) diff --git a/contracts/mockups/WitRandomnessRequestConsumer.sol b/contracts/mockups/WitOracleRandomnessConsumer.sol similarity index 98% rename from contracts/mockups/WitRandomnessRequestConsumer.sol rename to contracts/mockups/WitOracleRandomnessConsumer.sol index edbd1d51..7374ff3a 100644 --- a/contracts/mockups/WitRandomnessRequestConsumer.sol +++ b/contracts/mockups/WitOracleRandomnessConsumer.sol @@ -6,7 +6,7 @@ pragma experimental ABIEncoderV2; import "./WitOracleConsumer.sol"; import "../WitOracleRequest.sol"; -abstract contract WitRandomnessRequestConsumer +abstract contract WitOracleRandomnessConsumer is WitOracleConsumer { diff --git a/test/mocks/MyDapp.sol b/test/mocks/MyDapp.sol index d60b3ff1..589fcc84 100644 --- a/test/mocks/MyDapp.sol +++ b/test/mocks/MyDapp.sol @@ -3,11 +3,11 @@ pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; -import "../../contracts/mockups/WitRandomnessRequestConsumer.sol"; +import "../../contracts/mockups/WitOracleRandomnessConsumer.sol"; contract MyDapp is - WitRandomnessRequestConsumer + WitOracleRandomnessConsumer { using WitnetCBOR for WitnetCBOR.CBOR; @@ -29,7 +29,7 @@ contract MyDapp uint256 private immutable __randomizeValue; constructor(WitOracle _witOracle, uint16 _baseFeeOverheadPercentage, uint24 _callbackGasLimit) - WitRandomnessRequestConsumer( + WitOracleRandomnessConsumer( _witOracle, _baseFeeOverheadPercentage, _callbackGasLimit From 380d3ebb3262cd9723cd85c94cff18b601669843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Fri, 9 Aug 2024 12:30:58 +0200 Subject: [PATCH 39/39] feat: mockups/UsingWitPriceFeeds --- contracts/mockups/UsingWitPriceFeeds.sol | 28 ++++++++++++++++++++++++ contracts/mockups/UsingWitRandomness.sol | 10 ++++----- 2 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 contracts/mockups/UsingWitPriceFeeds.sol diff --git a/contracts/mockups/UsingWitPriceFeeds.sol b/contracts/mockups/UsingWitPriceFeeds.sol new file mode 100644 index 00000000..5fbc438c --- /dev/null +++ b/contracts/mockups/UsingWitPriceFeeds.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.7.0 <0.9.0; +pragma experimental ABIEncoderV2; + +import "../WitPriceFeeds.sol"; + +/// @title The UsingWitPriceFeeds contract +/// @dev Contracts willing to interact with a WitPriceFeeds appliance, freshly updated by a third-party. +/// @author The Witnet Foundation. +abstract contract UsingWitPriceFeeds + is + IWitFeedsEvents, + IWitOracleEvents +{ + WitPriceFeeds immutable public witPriceFeeds; + + constructor(WitPriceFeeds _witPriceFeeds) { + require( + address(_witPriceFeeds).code.length > 0 + && _witPriceFeeds.specs() == type(WitPriceFeeds).interfaceId, + "UsingWitPriceFeeds: uncompliant WitPriceFeeds appliance" + ); + witPriceFeeds = _witPriceFeeds; + } + + receive() external payable virtual {} +} diff --git a/contracts/mockups/UsingWitRandomness.sol b/contracts/mockups/UsingWitRandomness.sol index 7acbf6dc..11e98fc5 100644 --- a/contracts/mockups/UsingWitRandomness.sol +++ b/contracts/mockups/UsingWitRandomness.sol @@ -13,15 +13,15 @@ abstract contract UsingWitRandomness IWitOracleEvents, IWitRandomnessEvents { - WitRandomness immutable public witOracleRandomness; + WitRandomness immutable public witRandomness; - constructor(WitRandomness _witOracleRandomness) { + constructor(WitRandomness _witRandomness) { require( - address(_witOracleRandomness).code.length > 0 - && _witOracleRandomness.specs() == type(WitRandomness).interfaceId, + address(_witRandomness).code.length > 0 + && _witRandomness.specs() == type(WitRandomness).interfaceId, "UsingWitRandomness: uncompliant WitRandomness appliance" ); - witOracleRandomness = _witOracleRandomness; + witRandomness = _witRandomness; } receive() external payable virtual {}