From 05cf754cfac1223e2cfa171f2715605d7e46549f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Wed, 2 Oct 2024 12:38:58 +0200 Subject: [PATCH 1/4] feat(wrb): implement deprecated but missing `asString(Witnet.Result)` method --- .../customs/WitnetRequestBoardTrustableBase.sol | 14 ++++++++++++++ .../interfaces/IWitnetRequestBoardDeprecating.sol | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/contracts/impls/core/customs/WitnetRequestBoardTrustableBase.sol b/contracts/impls/core/customs/WitnetRequestBoardTrustableBase.sol index 389251a5d..d02be4221 100644 --- a/contracts/impls/core/customs/WitnetRequestBoardTrustableBase.sol +++ b/contracts/impls/core/customs/WitnetRequestBoardTrustableBase.sol @@ -64,6 +64,9 @@ abstract contract WitnetRequestBoardTrustableBase } else if (msg.sig == 0xD74803BE) { // IWitnetRequestParser.asErrorMessage({bool,CBOR}) --> IWitnetRequestBoardDeprecating.asErrorMessage({bool,WitnetCBOR.CBOR}) _newSig = IWitnetRequestBoardDeprecating.asErrorMessage.selector; + } else if (msg.sig == 0x109A0E3C) { + // IWitnetRequestParser.asString({bool,CBOR}) --> IWitnetRequestBoardDeprectating.asString({bool,WitnetCBOR.CBOR}) + _newSig = IWitnetRequestBoardDeprecating.asString.selector; } if (_newSig != msg.sig) { address _self = address(this); @@ -782,6 +785,17 @@ abstract contract WitnetRequestBoardTrustableBase _resultError.reason ); } + + /// Decode a string value from a Witnet.Result as a `string` value. + /// @param _result An instance of Witnet.Result. + /// @return The decoded `string` from the Witnet.Result. + function asString(Witnet.Result memory _result) + external pure + override + returns (string memory) + { + return _result.asText(); + } /// Decode a natural numeric value from a Witnet.Result as a `uint` value. /// @param _result An instance of Witnet.Result. diff --git a/contracts/interfaces/IWitnetRequestBoardDeprecating.sol b/contracts/interfaces/IWitnetRequestBoardDeprecating.sol index 7e9a6cd09..1c3bc0937 100644 --- a/contracts/interfaces/IWitnetRequestBoardDeprecating.sol +++ b/contracts/interfaces/IWitnetRequestBoardDeprecating.sol @@ -28,6 +28,11 @@ interface IWitnetRequestBoardDeprecating { /// @return A tuple containing the `CBORValue.Error memory` decoded from the `Witnet.Result`, plus a loggable error message. function asErrorMessage(Witnet.Result memory _result) external pure returns (Witnet.ResultErrorCodes, string memory); + /// Decode a string value from a Witnet.Result as a `string` value. + /// @param _result An instance of Witnet.Result. + /// @return The decoded `string` decoded from the given Witnet.Result. + function asString(Witnet.Result memory _result) external pure returns (string memory); + /// Decode a natural numeric value from a Witnet.Result as a `uint` value. /// @param _result An instance of Witnet.Result. /// @return The `uint` decoded from the Witnet.Result. From 2cd3feb0a1b23fcc79c31320254bab2dc6159b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Wed, 2 Oct 2024 12:49:02 +0200 Subject: [PATCH 2/4] chore: bump package version to 0.7.19 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 20abb857c..513177bbc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "witnet-solidity-bridge", - "version": "0.7.18", + "version": "0.7.19", "description": "Witnet Solidity Bridge contracts for EVM-compatible chains", "main": "", "scripts": { From ce3ec1dcf8f822bdc7b7c7114723f1128e966adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Wed, 2 Oct 2024 12:50:59 +0200 Subject: [PATCH 3/4] chore: upgrade legacy implementation on polygon:mainnet to 0.7.19 --- migrations/witnet.addresses.json | 3 ++- migrations/witnet.settings.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/migrations/witnet.addresses.json b/migrations/witnet.addresses.json index e9474d2ce..4c1b314c1 100644 --- a/migrations/witnet.addresses.json +++ b/migrations/witnet.addresses.json @@ -790,7 +790,8 @@ "WitnetPriceFeedsImplementation": "0x2159610a10B4922616e9ACa66D2922AA50ea548B", "WitnetRandomnessImplementation": "0xF1Aba51c5097487a62DA9c72fb9Aa7B0c98676C1", "WitnetRandomnessImplementationv061": "0xc8c0d4dB2D7801D6E2A863934597cFD31689f7D5", - "WitnetRequestBoardImplementation": "0xb62C9FAd26D35D160ADC486863Ba9AFeEAab11f9", + "WitnetRequestBoardImplementation": "0x11C156079B1F6585333c5aDA8856e5C56953ff3d", + "WitnetRequestBoardBypassV20": "0xb62C9FAd26D35D160ADC486863Ba9AFeEAab11f9", "WitnetRequestBoardTrustableDefault": "0xF395CEeb77cE9cDc44Fd276bE5Ff307B1902D3f7", "WitnetRequestFactoryImplementation": "0xc42656C501623859565C6d080a7Feb1f2B72b55a" }, diff --git a/migrations/witnet.settings.js b/migrations/witnet.settings.js index c14902035..324db680d 100644 --- a/migrations/witnet.settings.js +++ b/migrations/witnet.settings.js @@ -4,7 +4,7 @@ module.exports = { WitnetBytecodes: "WitnetBytecodesDefault", WitnetPriceFeeds: "WitnetPriceFeedsBypassV20:", WitnetRandomness: "WitnetRandomnessProxiable", - WitnetRequestBoard: "WitnetRequestBoardBypassV20:WitnetRequestBoardTrustableDefault", + WitnetRequestBoard: "WitnetRequestBoardTrustableDefault", WitnetRequestFactory: "WitnetRequestFactoryDefault", }, boba: { From 5e6128adfde08202f6122fd259ac72e849b2a26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20D=C3=ADaz?= Date: Wed, 2 Oct 2024 15:56:12 +0200 Subject: [PATCH 4/4] chore: re-bypass polygon:mainnet --- migrations/witnet.addresses.json | 5 ++--- migrations/witnet.settings.js | 3 +-- truffle-config.js | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/migrations/witnet.addresses.json b/migrations/witnet.addresses.json index 4c1b314c1..1fb45a552 100644 --- a/migrations/witnet.addresses.json +++ b/migrations/witnet.addresses.json @@ -790,9 +790,8 @@ "WitnetPriceFeedsImplementation": "0x2159610a10B4922616e9ACa66D2922AA50ea548B", "WitnetRandomnessImplementation": "0xF1Aba51c5097487a62DA9c72fb9Aa7B0c98676C1", "WitnetRandomnessImplementationv061": "0xc8c0d4dB2D7801D6E2A863934597cFD31689f7D5", - "WitnetRequestBoardImplementation": "0x11C156079B1F6585333c5aDA8856e5C56953ff3d", - "WitnetRequestBoardBypassV20": "0xb62C9FAd26D35D160ADC486863Ba9AFeEAab11f9", - "WitnetRequestBoardTrustableDefault": "0xF395CEeb77cE9cDc44Fd276bE5Ff307B1902D3f7", + "WitnetRequestBoardImplementation": "0xFCEA14D05e2aB69125d024A4B2fC5B15DF54E4b2", + "WitnetRequestBoardTrustableDefault": "0x11C156079B1F6585333c5aDA8856e5C56953ff3d", "WitnetRequestFactoryImplementation": "0xc42656C501623859565C6d080a7Feb1f2B72b55a" }, "polygon.zkevm.goerli": { diff --git a/migrations/witnet.settings.js b/migrations/witnet.settings.js index 324db680d..ce7a38fa7 100644 --- a/migrations/witnet.settings.js +++ b/migrations/witnet.settings.js @@ -4,7 +4,7 @@ module.exports = { WitnetBytecodes: "WitnetBytecodesDefault", WitnetPriceFeeds: "WitnetPriceFeedsBypassV20:", WitnetRandomness: "WitnetRandomnessProxiable", - WitnetRequestBoard: "WitnetRequestBoardTrustableDefault", + WitnetRequestBoard: "WitnetRequestBoardBypassV20:WitnetRequestBoardTrustableDefault", WitnetRequestFactory: "WitnetRequestFactoryDefault", }, boba: { @@ -705,7 +705,6 @@ module.exports = { network_id: 137, skipDryRun: true, verify: { - apiKey: process.env.ETHERSCAN_POLYGON_API_KEY, apiUrl: "https://api.polygonscan.com/api", explorerUrl: "https://polygonscan.com/", }, diff --git a/truffle-config.js b/truffle-config.js index 13f9bcbed..dfe5ae41e 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -46,7 +46,7 @@ module.exports = { etherscan: process.env.ETHERSCAN_API_KEY, moonscan: process.env.MOONSCAN_API_KEY, optimistic_etherscan: process.env.ETHERSCAN_OPTIMISM_API_KEY, - polygonscan: process.env.POLYGONSCAN_API_KEY, + polygonscan: process.env.ETHERSCAN_POLYGON_API_KEY, routescan: process.env.ROUTESCAN_API_KEY, scrollscan: process.env.SCROLLSCAN_API_KEY, },