From 7e2ca3e61ec11e45612a139934afaa2f17612200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Vi=C3=A9not?= Date: Fri, 28 Apr 2023 14:57:30 +0200 Subject: [PATCH 1/3] Add chain details for 296 (Hedera Testnet) --- src/sourcify-chains.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sourcify-chains.ts b/src/sourcify-chains.ts index 708c099aa..b1e2fe724 100644 --- a/src/sourcify-chains.ts +++ b/src/sourcify-chains.ts @@ -196,6 +196,12 @@ const sourcifyChainsExtensions: SourcifyChainsExtensionsObject = { "https://blockscout.com/xdai/mainnet/" + BLOCKSCOUT_SUFFIX, txRegex: getBlockscoutRegex("/xdai/mainnet"), }, + "296": { + // Hedera Testnet + supported: true, + monitored: false, + contractFetchAddress: "https://hashscan.io/testnet/" + ETHERSCAN_SUFFIX, + }, "300": { supported: true, monitored: false, From 090dcbae048ecc4aaafbbc1a2f301f8ad869a47b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Vi=C3=A9not?= Date: Tue, 2 May 2023 10:18:19 +0200 Subject: [PATCH 2/3] Add test contracts for chain 296 (Hedera Testnet) --- test/chains/chain-tests.js | 20 ++++++++++++- .../sources/296/1_Storage.metadata.json | 1 + test/chains/sources/296/1_Storage.sol | 28 +++++++++++++++++++ .../sources/296/WithImmutables.metadata.json | 1 + test/chains/sources/296/WithImmutables.sol | 19 +++++++++++++ 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 test/chains/sources/296/1_Storage.metadata.json create mode 100644 test/chains/sources/296/1_Storage.sol create mode 100644 test/chains/sources/296/WithImmutables.metadata.json create mode 100644 test/chains/sources/296/WithImmutables.sol diff --git a/test/chains/chain-tests.js b/test/chains/chain-tests.js index 755fa0835..7220479c8 100644 --- a/test/chains/chain-tests.js +++ b/test/chains/chain-tests.js @@ -1407,7 +1407,7 @@ describe("Test Supported Chains", function () { ["shared/WithImmutables.sol"], "shared/withImmutables.metadata.json" ); - + // The Root Network Porcini (Testnet) verifyContract( "0x225F2cD344c61152F8E7200E62e03dEfD683f2c4", @@ -1426,6 +1426,24 @@ describe("Test Supported Chains", function () { "shared/withImmutables.metadata.json" ); + // Hedera Testnet + verifyContract( + "0x000000000000000000000000000000000044fE74", + "296", + "Hedera Testnet", + ["296/1_Storage.sol"], + "296/1_Storage.metadata.json" + ); + verifyContractWithImmutables( + "0x000000000000000000000000000000000044ff8E", + "296", + "Hedera Testnet", + ["uint256"], + [296], + ["296/WithImmutables.sol"], + "296/WithImmutables.metadata.json" + ); + ////////////////////// // Helper functions // ////////////////////// diff --git a/test/chains/sources/296/1_Storage.metadata.json b/test/chains/sources/296/1_Storage.metadata.json new file mode 100644 index 000000000..c73be25f4 --- /dev/null +++ b/test/chains/sources/296/1_Storage.metadata.json @@ -0,0 +1 @@ +{"compiler":{"version":"0.8.17+commit.8df45f5f"},"language":"Solidity","output":{"abi":[{"inputs":[],"name":"retrieve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"store","outputs":[],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"details":"Store & retrieve value in a variable","kind":"dev","methods":{"retrieve()":{"details":"Return value ","returns":{"_0":"value of 'number'"}},"store(uint256)":{"details":"Store value in variable","params":{"num":"value to store"}}},"title":"Storage","version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"1_Storage.sol":"Storage"},"evmVersion":"london","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"1_Storage.sol":{"keccak256":"0x88c47206b5ec3d60ab820e9d126c4ac54cb17fa7396ff49ebe27db2862982ad8","license":"GPL-3.0","urls":["bzz-raw://5d1eeb01c8c10bed9e290f4a80a8d4081422a7b298a13049d72867022522cf6b","dweb:/ipfs/QmaFRC9ZtT7y3t9XNWCbDuMTEwKkyaQJzYFzw3NbeohSn5"]}},"version":1} diff --git a/test/chains/sources/296/1_Storage.sol b/test/chains/sources/296/1_Storage.sol new file mode 100644 index 000000000..d292c7e52 --- /dev/null +++ b/test/chains/sources/296/1_Storage.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-3.0 + +pragma solidity >=0.7.0 <0.9.0; + +/** + * @title Storage + * @dev Store & retrieve value in a variable + */ +contract Storage { + + uint256 number; + + /** + * @dev Store value in variable + * @param num value to store + */ + function store(uint256 num) public { + number = num; + } + + /** + * @dev Return value + * @return value of 'number' + */ + function retrieve() public view returns (uint256){ + return number; + } +} diff --git a/test/chains/sources/296/WithImmutables.metadata.json b/test/chains/sources/296/WithImmutables.metadata.json new file mode 100644 index 000000000..140cdf1d0 --- /dev/null +++ b/test/chains/sources/296/WithImmutables.metadata.json @@ -0,0 +1 @@ +{"compiler":{"version":"0.8.17+commit.8df45f5f"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"_a","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"read","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"sign","outputs":[],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"WithImmutables.sol":"WithImmutables"},"evmVersion":"london","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"WithImmutables.sol":{"keccak256":"0xbee62e4af99b4199c5b0982f5da15fc58215a4d547724bc574d516df07f66dc2","urls":["bzz-raw://6d83c127e075a149ec14c6af579bc7b24955cdb7578ae7da2f253b7142d267cc","dweb:/ipfs/QmW6tdCTV7X5dd5LCKDWedbMmkurQTMi4ePx7LY3DNuLn7"]}},"version":1} diff --git a/test/chains/sources/296/WithImmutables.sol b/test/chains/sources/296/WithImmutables.sol new file mode 100644 index 000000000..d920e6cdd --- /dev/null +++ b/test/chains/sources/296/WithImmutables.sol @@ -0,0 +1,19 @@ +pragma solidity >=0.7.0; + +contract WithImmutables { + uint256 public immutable _a; + + string _name; + + constructor (uint256 a) { + _a = a; + } + + function sign(string memory name) public { + _name = name; + } + + function read() public view returns(string memory) { + return _name; + } +} \ No newline at end of file From b061673853bf5117aff0db2ac9f6710422b0b69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Vi=C3=A9not?= Date: Tue, 2 May 2023 19:32:27 +0200 Subject: [PATCH 3/3] Change constructor argument to avoid any confusion with chainId. --- test/chains/chain-tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/chains/chain-tests.js b/test/chains/chain-tests.js index 7220479c8..1a5d25f0a 100644 --- a/test/chains/chain-tests.js +++ b/test/chains/chain-tests.js @@ -1439,7 +1439,7 @@ describe("Test Supported Chains", function () { "296", "Hedera Testnet", ["uint256"], - [296], + [42], ["296/WithImmutables.sol"], "296/WithImmutables.metadata.json" );