From c2a4f138fe46974f62db8101419d4ee1425fabe2 Mon Sep 17 00:00:00 2001 From: Michalina Date: Wed, 22 Nov 2023 10:57:39 +0100 Subject: [PATCH 01/12] Add Sepolia / Optimism Sepolia support for Optimism cross-chain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Goerli testnet currently used by Threshold/Keep for development purposes is planned to become deprecated with the end of year 2023. The testnet that was created to replace it is called [Holešky](https://github.com/eth-clients/holesky), however it will take some time until it gets integrated with by some of the projects we rely on. As a solution, we decided to switch first to another testnet that is currently live - Sepolia. This testnet's EOL is planned for 2026, which gives us plenty of time to move to Holešky before Sepolia gets deprecated. Until Görli is not dead we want to support both testnets. The Goerli -> Sepolia migration means that also L2 testnet basing on Goerli (Optimism Goerli) needs to be migrated to Sepolia-based chain (Optimism Sepolia). At the moment Optimism Sepolia is not supported by Wormhole, so deployment of our contracts on that testnet is yet not possible. But we're already adding changes that prepare us for the moment when it will be supported. Once support is confirmed, we'll need to verify if `wormholeChainID` we use in the config is correct for the testnet. --- cross-chain/optimism/.gitignore | 1 + cross-chain/optimism/README.adoc | 6 ++-- ...update_self_in_wormhole_gateway_mapping.ts | 2 ++ ...th_arbitrum_in_wormhole_gateway_mapping.ts | 2 ++ ...ith_polygon_in_wormhole_gateway_mapping.ts | 2 ++ ...e_with_base_in_wormhole_gateway_mapping.ts | 2 ++ cross-chain/optimism/hardhat.config.ts | 33 +++++++++++++++++++ cross-chain/optimism/package.json | 1 + 8 files changed, 46 insertions(+), 3 deletions(-) diff --git a/cross-chain/optimism/.gitignore b/cross-chain/optimism/.gitignore index 64240eb35..9ed245ce0 100644 --- a/cross-chain/optimism/.gitignore +++ b/cross-chain/optimism/.gitignore @@ -10,6 +10,7 @@ !/deployments/mainnet/ !/deployments/optimism/ !/deployments/optimismGoerli/ +!/deployments/optimismSepolia/ # OZ /.openzeppelin/unknown-*.json diff --git a/cross-chain/optimism/README.adoc b/cross-chain/optimism/README.adoc index 0970bd560..29884e230 100644 --- a/cross-chain/optimism/README.adoc +++ b/cross-chain/optimism/README.adoc @@ -27,7 +27,7 @@ Wormhole-specific tBTC representation into the canonical `OptimismTBTC` token. The deployment scripts are responsible for managing updates of the tBTC gateway addresses across various chains. These addresses are stored in the `external/` -directory for a specific network, such as `optimismGoerli/ArbitrumWormholeGateway.json.` +directory for a specific network, such as `optimismSepolia/ArbitrumWormholeGateway.json.` It is important to note that these addresses should remain constant for the mainnet network. However, there may be instances where a new version of a cross-chain module is deployed to the testing network, which would require a @@ -42,7 +42,7 @@ yarn deploy --network Supported networks: - `hardhat` - for local development -- `optimismGoerli` - L2 testing network +- `optimismSepolia` - L2 testing network - `optimism` - L2 mainnet Currently, this module does not deploy any contracts on L1. All the existing @@ -54,6 +54,6 @@ the contracts before running the deployment script. This command produces an `export.json` file containing contract deployment info. Note that for the chains other than `hardhat` the following environment variables are needed: -- `L2_CHAIN_API_URL` - URL to access blockchain services, e.g. `https://opt-goerli.g.alchemy.com/v2/` +- `L2_CHAIN_API_URL` - URL to access blockchain services, e.g. `https://optimism-sepolia.infura.io/v3/` - `L2_ACCOUNTS_PRIVATE_KEYS` - Private keys for the deployer and council `<0xOwnerPrivKey,0xCouncilPrivKey>` - `OPTIMISM_ETHERSCAN_API_KEY` - Optimism Etherscan API key diff --git a/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts index 320dd6c9b..bce2aebe5 100644 --- a/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts @@ -8,6 +8,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // See https://book.wormhole.com/reference/contracts.html // This ID is valid for both Optimism Goerli and Mainnet + // TODO: check if id is correct for Optimism Sepolia as well (once Wormhole + // supports that testnet) const wormholeChainID = 24 const optimismWormholeGateway = await deployments.get( diff --git a/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts index 32767e21e..225821daa 100644 --- a/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts @@ -12,6 +12,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // See https://book.wormhole.com/reference/contracts.html // This ID is valid for both Arbitrum Goerli and Mainnet + // TODO: check if id is correct for Arbitrum Sepolia as well (once Wormhole + // supports that testnet) const arbitrumWormholeChainID = 23 const arbitrumWormholeGateway = await deployments.getOrNull( diff --git a/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts index c266425f1..47c16310f 100644 --- a/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts @@ -12,6 +12,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // See https://book.wormhole.com/reference/contracts.html // This ID is valid for both Polygon Testnet (Mumbai) and Mainnet + // TODO: check ID for the new L2 Polygon testnet once it's annunced and + // supported by Wormhole const polygonWormholeChainID = 5 const polygonWormholeGateway = await deployments.getOrNull( diff --git a/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts index 8c69bec2a..533ce0010 100644 --- a/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts @@ -11,6 +11,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // See https://docs.wormhole.com/wormhole/blockchain-environments/evm#base // This ID is valid for both Base Testnet and Mainnet + // TODO: check if id is correct for Arbitrum Sepolia as well (once Wormhole + // supports that testnet) const baseWormholeChainID = 30 const baseWormholeGateway = await deployments.getOrNull("BaseWormholeGateway") diff --git a/cross-chain/optimism/hardhat.config.ts b/cross-chain/optimism/hardhat.config.ts index 62fd7f58f..7ab960a83 100644 --- a/cross-chain/optimism/hardhat.config.ts +++ b/cross-chain/optimism/hardhat.config.ts @@ -44,6 +44,15 @@ const config: HardhatUserConfig = { : undefined, tags: ["etherscan"], }, + sepolia: { + url: process.env.L1_CHAIN_API_URL || "", + chainId: 11155111, + deploy: ["deploy_l1"], + accounts: process.env.L1_ACCOUNTS_PRIVATE_KEYS + ? process.env.L1_ACCOUNTS_PRIVATE_KEYS.split(",") + : undefined, + tags: ["etherscan"], + }, mainnet: { url: process.env.L1_CHAIN_API_URL || "", chainId: 1, @@ -65,6 +74,20 @@ const config: HardhatUserConfig = { // l1: "goerli", // }, }, + optimismSepolia: { + url: process.env.L2_CHAIN_API_URL || "", + chainId: 11155420, + deploy: ["deploy_l2"], + accounts: process.env.L2_ACCOUNTS_PRIVATE_KEYS + ? process.env.L2_ACCOUNTS_PRIVATE_KEYS.split(",") + : undefined, + // TODO: uncomment below line once `hardhat-verify` supports OP Sepolia + // (tracked in https://github.com/NomicFoundation/hardhat/issues/4607) + // tags: ["optimism_etherscan"], + // companionNetworks: { + // l1: "sepolia", + // }, + }, optimism: { url: process.env.L2_CHAIN_API_URL || "", chainId: 10, @@ -82,24 +105,30 @@ const config: HardhatUserConfig = { external: { deployments: { goerli: ["./external/goerli"], + sepolia: ["./external/sepolia"], mainnet: ["./external/mainnet"], optimismGoerli: ["./external/optimismGoerli"], + optimismSepolia: ["./external/optimismSepolia"], optimism: ["./external/optimism"], }, }, deploymentArtifactsExport: { goerli: "artifacts/l1", + sepolia: "artifacts/l1", mainnet: "artifacts/l1", optimismGoerli: "artifacts/l2", + optimismSepolia: "artifacts/l2", optimism: "artifacts/l2", }, etherscan: { apiKey: { goerli: process.env.ETHERSCAN_API_KEY, + sepolia: process.env.ETHERSCAN_API_KEY, mainnet: process.env.ETHERSCAN_API_KEY, optimisticGoerli: process.env.OPTIMISM_ETHERSCAN_API_KEY, + optimisticSepolia: process.env.OPTIMISM_ETHERSCAN_API_KEY, optimisticEthereum: process.env.OPTIMISM_ETHERSCAN_API_KEY, }, }, @@ -108,14 +137,18 @@ const config: HardhatUserConfig = { deployer: { default: 1, goerli: 0, + sepolia: 0, optimismGoerli: 0, + optimismSepolia: 0, mainnet: "0x123694886DBf5Ac94DDA07135349534536D14cAf", optimism: "0x123694886DBf5Ac94DDA07135349534536D14cAf", }, governance: { default: 2, goerli: 0, + sepolia: 0, optimismGoerli: 0, + optimismSepolia: 0, mainnet: "0x9f6e831c8f8939dc0c830c6e492e7cef4f9c2f5f", optimism: "0x7fB50BBabeDEE52b8760Ba15c0c199aF33Fc2EfA", }, diff --git a/cross-chain/optimism/package.json b/cross-chain/optimism/package.json index 6d1c8e009..017ecca40 100644 --- a/cross-chain/optimism/package.json +++ b/cross-chain/optimism/package.json @@ -31,6 +31,7 @@ "lint:config:fix": "prettier --write '**/*.@(json|yaml)'", "prepack": "tsc -p tsconfig.export.json && hardhat export-artifacts export/artifacts", "export-artifacts:goerli": "yarn hardhat export-deployment-artifacts --network optimismGoerli", + "export-artifacts:sepolia": "yarn hardhat export-deployment-artifacts --network optimismSepolia", "export-artifacts:mainnet": "yarn hardhat export-deployment-artifacts --network optimism", "prepublishOnly": "npm run export-artifacts:$npm_config_network", "test": "hardhat test" From ff436e33962447d377608d88433228bda170adfd Mon Sep 17 00:00:00 2001 From: Michalina Date: Wed, 3 Jan 2024 11:46:33 +0100 Subject: [PATCH 02/12] Add custom `hardhat-verify` config for Optimism Sepolia The Optimism Sepolia testnet is not on the list of chains supported by the `hardhat-verify` plugin (https://github.com/NomicFoundation/hardhat/blob/main/packages/hardhat-verify/src/internal/chain-config.ts). We're adding a custom configuration that will make the contracts verification possible on that testnet (following the https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify#adding-support-for-other-networks docs). --- cross-chain/optimism/hardhat.config.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cross-chain/optimism/hardhat.config.ts b/cross-chain/optimism/hardhat.config.ts index 7ab960a83..0f641137b 100644 --- a/cross-chain/optimism/hardhat.config.ts +++ b/cross-chain/optimism/hardhat.config.ts @@ -81,9 +81,7 @@ const config: HardhatUserConfig = { accounts: process.env.L2_ACCOUNTS_PRIVATE_KEYS ? process.env.L2_ACCOUNTS_PRIVATE_KEYS.split(",") : undefined, - // TODO: uncomment below line once `hardhat-verify` supports OP Sepolia - // (tracked in https://github.com/NomicFoundation/hardhat/issues/4607) - // tags: ["optimism_etherscan"], + tags: ["optimism_etherscan"], // companionNetworks: { // l1: "sepolia", // }, @@ -131,6 +129,16 @@ const config: HardhatUserConfig = { optimisticSepolia: process.env.OPTIMISM_ETHERSCAN_API_KEY, optimisticEthereum: process.env.OPTIMISM_ETHERSCAN_API_KEY, }, + customChains: [ + { + network: "optimisticGoerli", + chainId: 11155420, + urls: { + apiURL: "https://api-sepolia-optimistic.etherscan.io/api", + browserURL: "https://sepolia-optimism.etherscan.io/", + }, + }, + ], }, namedAccounts: { From 4985147e629a7beb9d04ae8d301ab0651a911489 Mon Sep 17 00:00:00 2001 From: Michalina Date: Thu, 18 Jan 2024 17:36:01 +0100 Subject: [PATCH 03/12] Make `...WormholeChainID` values dependable on the environment Wormhole has added support for Arbitrum Sepolia, Base Sepolia and Optimism Sepolia testnets. We want to modify the config of our deployment scripts so that deployment on Sepolia-based L2s would be possible. As the Chain IDs for Wormhole Sepolia-based networks differ from from IDs for Mainnet and Goerli-based testnets, we need to set the right value of `...WormholeChainID` constant for the the right network we're deploying to. --- .../12_update_self_in_wormhole_gateway_mapping.ts | 10 +++++----- ...pdate_with_arbitrum_in_wormhole_gateway_mapping.ts | 11 ++++++----- ...update_with_polygon_in_wormhole_gateway_mapping.ts | 8 ++++---- ...15_update_with_base_in_wormhole_gateway_mapping.ts | 11 ++++++----- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts index bce2aebe5..66bf4dabf 100644 --- a/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts @@ -6,11 +6,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const { execute } = deployments const { deployer } = await getNamedAccounts() - // See https://book.wormhole.com/reference/contracts.html - // This ID is valid for both Optimism Goerli and Mainnet - // TODO: check if id is correct for Optimism Sepolia as well (once Wormhole - // supports that testnet) - const wormholeChainID = 24 + // See https://docs.wormhole.com/wormhole/blockchain-environments/evm#optimism + // and https://docs.wormhole.com/wormhole/blockchain-environments/evm#optimism-sepolia + // The value `24` is valid for both Optimism Goerli and Optimism Mainnet. The + // value for Optimism Sepolia is `10005`. + const wormholeChainID = hre.network.name === "arbitrumSepolia" ? 10005 : 24 const optimismWormholeGateway = await deployments.get( "OptimismWormholeGateway" diff --git a/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts index 225821daa..472ecf1da 100644 --- a/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts @@ -10,11 +10,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const fakeArbitrumWormholeGateway = "0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9" - // See https://book.wormhole.com/reference/contracts.html - // This ID is valid for both Arbitrum Goerli and Mainnet - // TODO: check if id is correct for Arbitrum Sepolia as well (once Wormhole - // supports that testnet) - const arbitrumWormholeChainID = 23 + // See https://docs.wormhole.com/wormhole/blockchain-environments/evm#arbitrum + // and https://docs.wormhole.com/wormhole/blockchain-environments/evm#arbitrum-sepolia + // The value `23` is valid for both Arbitrum Goerli and Arbitrum Mainnet. The + // value for Arbitrum Sepolia is `10003`. + const arbitrumWormholeChainID = + hre.network.name === "arbitrumSepolia" ? 10003 : 23 const arbitrumWormholeGateway = await deployments.getOrNull( "ArbitrumWormholeGateway" diff --git a/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts index 47c16310f..67af323d7 100644 --- a/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts @@ -10,10 +10,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const fakePolygonWormholeGateway = "0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9" - // See https://book.wormhole.com/reference/contracts.html - // This ID is valid for both Polygon Testnet (Mumbai) and Mainnet - // TODO: check ID for the new L2 Polygon testnet once it's annunced and - // supported by Wormhole + // See https://docs.wormhole.com/wormhole/blockchain-environments/evm#polygon + // This ID is valid for both Polygonn Goerli-based Testnet (Mumbai) and + // Mainnet. Wormhole does not support the Sepolia-based Amoy Testnet yet. + // TODO: Update the ID once the support is added. const polygonWormholeChainID = 5 const polygonWormholeGateway = await deployments.getOrNull( diff --git a/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts index 533ce0010..678f47192 100644 --- a/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts @@ -9,11 +9,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // Fake BaseWormholeGateway for local development purposes only. const fakeBaseWormholeGateway = "0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9" - // See https://docs.wormhole.com/wormhole/blockchain-environments/evm#base - // This ID is valid for both Base Testnet and Mainnet - // TODO: check if id is correct for Arbitrum Sepolia as well (once Wormhole - // supports that testnet) - const baseWormholeChainID = 30 + // See https://docs.wormhole.com/wormhole/blockchain-environments/evm#base and + // https://docs.wormhole.com/wormhole/blockchain-environments/evm#base-sepolia + // The value `30` is valid for both Base Goerli and Base Mainnet. The value + // for Base Sepolia is `10004`. + const baseWormholeChainID = + hre.network.name === "arbitrumSepolia" ? 10004 : 30 const baseWormholeGateway = await deployments.getOrNull("BaseWormholeGateway") From cb1330208957445f8808d5580beb1740357ba468 Mon Sep 17 00:00:00 2001 From: Michalina Date: Fri, 26 Jan 2024 12:04:24 +0100 Subject: [PATCH 04/12] Add Sepolia-related external contracts Adding Sepolia-related contracts needed for deployment on `optimismSepolia` network: * `external/optimismSepolia/OptimismTokenBridge.json` - address taken from https://docs.wormhole.com/wormhole/blockchain-environments/evm#testnet-contracts-optimism-sepolia-11155420 * `external/optimismSepolia/SolanaWormholeGateway.json` - used the same value as in `optimismGoreli` * `external/sepolia/TokenBridge.json` - address taken from https://docs.wormhole.com/wormhole/blockchain-environments/evm#testnet-contracts-sepolia-11155111 NOT included in this commit (but needed for the deployment): * `external/optimismSepolia/OptimismWormholeTBTC.json` - in order to get the address we need to perform attestation of the Ethereum Sepolia TBTC token on Optimism Sepolia (but atm Optimism Sepolia is not available on the list of target networks on https://wormhole-foundation.github.io/example-token-bridge-ui/#/register) --- .../optimism/external/optimismSepolia/OptimismTokenBridge.json | 3 +++ .../external/optimismSepolia/SolanaWormholeGateway.json | 3 +++ cross-chain/optimism/external/sepolia/TokenBridge.json | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 cross-chain/optimism/external/optimismSepolia/OptimismTokenBridge.json create mode 100644 cross-chain/optimism/external/optimismSepolia/SolanaWormholeGateway.json create mode 100644 cross-chain/optimism/external/sepolia/TokenBridge.json diff --git a/cross-chain/optimism/external/optimismSepolia/OptimismTokenBridge.json b/cross-chain/optimism/external/optimismSepolia/OptimismTokenBridge.json new file mode 100644 index 000000000..4e0c8c45a --- /dev/null +++ b/cross-chain/optimism/external/optimismSepolia/OptimismTokenBridge.json @@ -0,0 +1,3 @@ +{ + "address": "0x99737Ec4B815d816c49A385943baf0380e75c0Ac" +} diff --git a/cross-chain/optimism/external/optimismSepolia/SolanaWormholeGateway.json b/cross-chain/optimism/external/optimismSepolia/SolanaWormholeGateway.json new file mode 100644 index 000000000..dee25fa3e --- /dev/null +++ b/cross-chain/optimism/external/optimismSepolia/SolanaWormholeGateway.json @@ -0,0 +1,3 @@ +{ + "address": "0x69a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b" +} diff --git a/cross-chain/optimism/external/sepolia/TokenBridge.json b/cross-chain/optimism/external/sepolia/TokenBridge.json new file mode 100644 index 000000000..c09d6e7c2 --- /dev/null +++ b/cross-chain/optimism/external/sepolia/TokenBridge.json @@ -0,0 +1,3 @@ +{ + "address": "0xDB5492265f6038831E89f495670FF909aDe94bd9" +} From b891a0594eec9ec26ac5e3c2c68dce398972058b Mon Sep 17 00:00:00 2001 From: Michalina Date: Wed, 14 Feb 2024 14:27:34 +0100 Subject: [PATCH 05/12] Add tip for handling underpriced transactions --- cross-chain/optimism/hardhat.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cross-chain/optimism/hardhat.config.ts b/cross-chain/optimism/hardhat.config.ts index 0f641137b..2c051fa8d 100644 --- a/cross-chain/optimism/hardhat.config.ts +++ b/cross-chain/optimism/hardhat.config.ts @@ -82,6 +82,9 @@ const config: HardhatUserConfig = { ? process.env.L2_ACCOUNTS_PRIVATE_KEYS.split(",") : undefined, tags: ["optimism_etherscan"], + // In case of deployment failing with underpriced transaction error set + // the `gasPrice` parameter. + // gasPrice: 1000000000, // companionNetworks: { // l1: "sepolia", // }, From ee226c509ef426f0bcf148e2d3ff765a75067a6f Mon Sep 17 00:00:00 2001 From: Michalina Date: Wed, 14 Feb 2024 14:29:56 +0100 Subject: [PATCH 06/12] Fix typo in the name of custom chain --- cross-chain/optimism/hardhat.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cross-chain/optimism/hardhat.config.ts b/cross-chain/optimism/hardhat.config.ts index 2c051fa8d..3ef366742 100644 --- a/cross-chain/optimism/hardhat.config.ts +++ b/cross-chain/optimism/hardhat.config.ts @@ -134,7 +134,7 @@ const config: HardhatUserConfig = { }, customChains: [ { - network: "optimisticGoerli", + network: "optimisticSepolia", chainId: 11155420, urls: { apiURL: "https://api-sepolia-optimistic.etherscan.io/api", From 9611b0f5866bd28f8d9178d552638866c0576003 Mon Sep 17 00:00:00 2001 From: Michalina Date: Wed, 14 Feb 2024 14:42:30 +0100 Subject: [PATCH 07/12] Add `OptimismWormholeTBTC.json` after registration in Wormhole Portal Locally deployed portal was used to register TBTC. --- .../external/optimismSepolia/OptimismWormholeTBTC.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 cross-chain/optimism/external/optimismSepolia/OptimismWormholeTBTC.json diff --git a/cross-chain/optimism/external/optimismSepolia/OptimismWormholeTBTC.json b/cross-chain/optimism/external/optimismSepolia/OptimismWormholeTBTC.json new file mode 100644 index 000000000..2236412bb --- /dev/null +++ b/cross-chain/optimism/external/optimismSepolia/OptimismWormholeTBTC.json @@ -0,0 +1,3 @@ +{ + "address": "0x2133a5132c962f11f1ed6ca709132eef146d1b1c" +} From 2a594d3cbedaed432aa4a1c45a2cbdce3a24d6cd Mon Sep 17 00:00:00 2001 From: Michalina Date: Wed, 14 Feb 2024 14:44:07 +0100 Subject: [PATCH 08/12] Add contract artifacts for Optimism Sepolia We're adding artifacts for contracts deployed to Optimism Sepolia network. --- .../deployments/optimismSepolia/.chainId | 1 + .../optimismSepolia/OptimismTBTC.json | 863 ++++++++++++++++++ .../OptimismWormholeGateway.json | 482 ++++++++++ 3 files changed, 1346 insertions(+) create mode 100644 cross-chain/optimism/deployments/optimismSepolia/.chainId create mode 100644 cross-chain/optimism/deployments/optimismSepolia/OptimismTBTC.json create mode 100644 cross-chain/optimism/deployments/optimismSepolia/OptimismWormholeGateway.json diff --git a/cross-chain/optimism/deployments/optimismSepolia/.chainId b/cross-chain/optimism/deployments/optimismSepolia/.chainId new file mode 100644 index 000000000..03f37de82 --- /dev/null +++ b/cross-chain/optimism/deployments/optimismSepolia/.chainId @@ -0,0 +1 @@ +11155420 \ No newline at end of file diff --git a/cross-chain/optimism/deployments/optimismSepolia/OptimismTBTC.json b/cross-chain/optimism/deployments/optimismSepolia/OptimismTBTC.json new file mode 100644 index 000000000..4780a231c --- /dev/null +++ b/cross-chain/optimism/deployments/optimismSepolia/OptimismTBTC.json @@ -0,0 +1,863 @@ +{ + "address": "0x9A82bE743f0120fA24893b1631B6b2817fD94b1D", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "guardian", + "type": "address" + } + ], + "name": "GuardianAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "guardian", + "type": "address" + } + ], + "name": "GuardianRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minter", + "type": "address" + } + ], + "name": "MinterAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "minter", + "type": "address" + } + ], + "name": "MinterRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "guardian", + "type": "address" + } + ], + "name": "addGuardian", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "minter", + "type": "address" + } + ], + "name": "addMinter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getGuardians", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinters", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "guardians", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isGuardian", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isMinter", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "minters", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "recoverERC20", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC721Upgradeable", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "recoverERC721", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "guardian", + "type": "address" + } + ], + "name": "removeGuardian", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "minter", + "type": "address" + } + ], + "name": "removeMinter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x9c6bd19d5c93dd63b491ee4cdc0eefd147c97eea649763af05c8757171d5eb31", + "receipt": { + "to": null, + "from": "0x68ad60CC5e8f3B7cC53beaB321cf0e6036962dBc", + "contractAddress": "0x9A82bE743f0120fA24893b1631B6b2817fD94b1D", + "transactionIndex": 1, + "gasUsed": "732402", + "logsBloom": "0x00000000000000000000000000000000400000000000000000800000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000202000001000000000000000000000000000000000000020000000000000000000800000000800000000000000001000000400000000200000000000000000002000000000000000080000000000000800000000000000008000000000000000400000000000000000000000000000000040000000020000000000000200020040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7ab0329724066b1d9cfa167ca892f07e51183c6bd4c32c5c6375f7fba6b4df5f", + "transactionHash": "0x9c6bd19d5c93dd63b491ee4cdc0eefd147c97eea649763af05c8757171d5eb31", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 8057689, + "transactionHash": "0x9c6bd19d5c93dd63b491ee4cdc0eefd147c97eea649763af05c8757171d5eb31", + "address": "0x9A82bE743f0120fA24893b1631B6b2817fD94b1D", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000001e9e56acdb2987dce23eb6e751c22d4f89296a06" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x7ab0329724066b1d9cfa167ca892f07e51183c6bd4c32c5c6375f7fba6b4df5f" + }, + { + "transactionIndex": 1, + "blockNumber": 8057689, + "transactionHash": "0x9c6bd19d5c93dd63b491ee4cdc0eefd147c97eea649763af05c8757171d5eb31", + "address": "0x9A82bE743f0120fA24893b1631B6b2817fD94b1D", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000068ad60cc5e8f3b7cc53beab321cf0e6036962dbc" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0x7ab0329724066b1d9cfa167ca892f07e51183c6bd4c32c5c6375f7fba6b4df5f" + }, + { + "transactionIndex": 1, + "blockNumber": 8057689, + "transactionHash": "0x9c6bd19d5c93dd63b491ee4cdc0eefd147c97eea649763af05c8757171d5eb31", + "address": "0x9A82bE743f0120fA24893b1631B6b2817fD94b1D", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 2, + "blockHash": "0x7ab0329724066b1d9cfa167ca892f07e51183c6bd4c32c5c6375f7fba6b4df5f" + }, + { + "transactionIndex": 1, + "blockNumber": 8057689, + "transactionHash": "0x9c6bd19d5c93dd63b491ee4cdc0eefd147c97eea649763af05c8757171d5eb31", + "address": "0x9A82bE743f0120fA24893b1631B6b2817fD94b1D", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b2f6c5b73239c39360ee0ea95047565dab13e3c7", + "logIndex": 3, + "blockHash": "0x7ab0329724066b1d9cfa167ca892f07e51183c6bd4c32c5c6375f7fba6b4df5f" + } + ], + "blockNumber": 8057689, + "cumulativeGasUsed": "779291", + "status": 1, + "byzantium": true + }, + "numDeployments": 1, + "implementation": "0x1e9E56Acdb2987DCe23Eb6E751C22d4f89296a06", + "devdoc": "Contract deployed as upgradable proxy" +} \ No newline at end of file diff --git a/cross-chain/optimism/deployments/optimismSepolia/OptimismWormholeGateway.json b/cross-chain/optimism/deployments/optimismSepolia/OptimismWormholeGateway.json new file mode 100644 index 000000000..63ac1f8fe --- /dev/null +++ b/cross-chain/optimism/deployments/optimismSepolia/OptimismWormholeGateway.json @@ -0,0 +1,482 @@ +{ + "address": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "chainId", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "gateway", + "type": "bytes32" + } + ], + "name": "GatewayAddressUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "mintingLimit", + "type": "uint256" + } + ], + "name": "MintingLimitUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "depositor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WormholeTbtcDeposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WormholeTbtcReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "recipientChain", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "gateway", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "recipient", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "arbiterFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "nonce", + "type": "uint32" + } + ], + "name": "WormholeTbtcSent", + "type": "event" + }, + { + "inputs": [], + "name": "bridge", + "outputs": [ + { + "internalType": "contract IWormholeTokenBridge", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bridgeToken", + "outputs": [ + { + "internalType": "contract IERC20Upgradeable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_address", + "type": "bytes32" + } + ], + "name": "fromWormholeAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "gateways", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IWormholeTokenBridge", + "name": "_bridge", + "type": "address" + }, + { + "internalType": "contract IERC20Upgradeable", + "name": "_bridgeToken", + "type": "address" + }, + { + "internalType": "contract L2TBTC", + "name": "_tbtc", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "mintedAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mintingLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "encodedVm", + "type": "bytes" + } + ], + "name": "receiveTbtc", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "recipientChain", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "recipient", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "arbiterFee", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "nonce", + "type": "uint32" + } + ], + "name": "sendTbtc", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "tbtc", + "outputs": [ + { + "internalType": "contract L2TBTC", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "toWormholeAddress", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "chainId", + "type": "uint16" + }, + { + "internalType": "bytes32", + "name": "gateway", + "type": "bytes32" + } + ], + "name": "updateGatewayAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_mintingLimit", + "type": "uint256" + } + ], + "name": "updateMintingLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", + "receipt": { + "to": null, + "from": "0x68ad60CC5e8f3B7cC53beaB321cf0e6036962dBc", + "contractAddress": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "transactionIndex": 1, + "gasUsed": "749851", + "logsBloom": "0x00000000000000010000000000000000400000000000000000800000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000800202000001000000000000000000000000000000000000020000000008000000000800000000800000000000000000000000400000000240000800000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000020040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x810dfcea4a815caab65309e55afd4ca1421fc143f6fa42fd33be26e420c8e0a4", + "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 8057752, + "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", + "address": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x000000000000000000000000c3d46e0266d95215589de639cc4e93b79f88fc6c" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x810dfcea4a815caab65309e55afd4ca1421fc143f6fa42fd33be26e420c8e0a4" + }, + { + "transactionIndex": 1, + "blockNumber": 8057752, + "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", + "address": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000068ad60cc5e8f3b7cc53beab321cf0e6036962dbc" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0x810dfcea4a815caab65309e55afd4ca1421fc143f6fa42fd33be26e420c8e0a4" + }, + { + "transactionIndex": 1, + "blockNumber": 8057752, + "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", + "address": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 2, + "blockHash": "0x810dfcea4a815caab65309e55afd4ca1421fc143f6fa42fd33be26e420c8e0a4" + }, + { + "transactionIndex": 1, + "blockNumber": 8057752, + "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", + "address": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b2f6c5b73239c39360ee0ea95047565dab13e3c7", + "logIndex": 3, + "blockHash": "0x810dfcea4a815caab65309e55afd4ca1421fc143f6fa42fd33be26e420c8e0a4" + } + ], + "blockNumber": 8057752, + "cumulativeGasUsed": "796740", + "status": 1, + "byzantium": true + }, + "numDeployments": 1, + "implementation": "0xc3D46e0266d95215589DE639cC4E93b79f88fc6C", + "devdoc": "Contract deployed as upgradable proxy" +} \ No newline at end of file From cabf44a23073135e9d8dc49f7e58b174a883ebf5 Mon Sep 17 00:00:00 2001 From: Michalina Date: Thu, 15 Feb 2024 11:39:14 +0100 Subject: [PATCH 09/12] Fix wrong computation of `wormholeChainID` We were using wrong condition for computation of wormholeChainID. As a result, we've been associating Gateway Address with wrong chain. We've run the `12_update_self_in_wormhole_gateway_mapping.ts` script once more and got new deployment artifact. --- ...update_self_in_wormhole_gateway_mapping.ts | 2 +- .../OptimismWormholeGateway.json | 48 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts index 66bf4dabf..4c0225f5f 100644 --- a/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts @@ -10,7 +10,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // and https://docs.wormhole.com/wormhole/blockchain-environments/evm#optimism-sepolia // The value `24` is valid for both Optimism Goerli and Optimism Mainnet. The // value for Optimism Sepolia is `10005`. - const wormholeChainID = hre.network.name === "arbitrumSepolia" ? 10005 : 24 + const wormholeChainID = hre.network.name === "optimismSepolia" ? 10005 : 24 const optimismWormholeGateway = await deployments.get( "OptimismWormholeGateway" diff --git a/cross-chain/optimism/deployments/optimismSepolia/OptimismWormholeGateway.json b/cross-chain/optimism/deployments/optimismSepolia/OptimismWormholeGateway.json index 63ac1f8fe..91d725a29 100644 --- a/cross-chain/optimism/deployments/optimismSepolia/OptimismWormholeGateway.json +++ b/cross-chain/optimism/deployments/optimismSepolia/OptimismWormholeGateway.json @@ -1,5 +1,5 @@ { - "address": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "address": "0x5FB63D9e076a314023F2D1aB5dBFd7045C281EbA", "abi": [ { "anonymous": false, @@ -408,35 +408,35 @@ "type": "function" } ], - "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", + "transactionHash": "0x6cf0ac49e6f7f299c837f74a3b039cfba103b2df0669b114f4d77874e850366e", "receipt": { "to": null, "from": "0x68ad60CC5e8f3B7cC53beaB321cf0e6036962dBc", - "contractAddress": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "contractAddress": "0x5FB63D9e076a314023F2D1aB5dBFd7045C281EbA", "transactionIndex": 1, "gasUsed": "749851", - "logsBloom": "0x00000000000000010000000000000000400000000000000000800000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000800202000001000000000000000000000000000000000000020000000008000000000800000000800000000000000000000000400000000240000800000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000020040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x810dfcea4a815caab65309e55afd4ca1421fc143f6fa42fd33be26e420c8e0a4", - "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", + "logsBloom": "0x00000000000000010000000000000000400000000000000000800000000000000000000000000000000000000000000000000080000000000000000000000000000004000000000000000000000202000001000000000000000000000000000000000000020000000000000000000800000000800000800000000000000000400000000200000800000000000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000020040000000000000400000000000000000020000000000000000000000000000000000000000000000000000000001000000000", + "blockHash": "0x81aa7082bad1bbac4f694ea9f0572cf7a73056de5827296e7c54fbfd971a6b6a", + "transactionHash": "0x6cf0ac49e6f7f299c837f74a3b039cfba103b2df0669b114f4d77874e850366e", "logs": [ { "transactionIndex": 1, - "blockNumber": 8057752, - "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", - "address": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "blockNumber": 8095333, + "transactionHash": "0x6cf0ac49e6f7f299c837f74a3b039cfba103b2df0669b114f4d77874e850366e", + "address": "0x5FB63D9e076a314023F2D1aB5dBFd7045C281EbA", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", "0x000000000000000000000000c3d46e0266d95215589de639cc4e93b79f88fc6c" ], "data": "0x", "logIndex": 0, - "blockHash": "0x810dfcea4a815caab65309e55afd4ca1421fc143f6fa42fd33be26e420c8e0a4" + "blockHash": "0x81aa7082bad1bbac4f694ea9f0572cf7a73056de5827296e7c54fbfd971a6b6a" }, { "transactionIndex": 1, - "blockNumber": 8057752, - "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", - "address": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "blockNumber": 8095333, + "transactionHash": "0x6cf0ac49e6f7f299c837f74a3b039cfba103b2df0669b114f4d77874e850366e", + "address": "0x5FB63D9e076a314023F2D1aB5dBFd7045C281EbA", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", @@ -444,35 +444,35 @@ ], "data": "0x", "logIndex": 1, - "blockHash": "0x810dfcea4a815caab65309e55afd4ca1421fc143f6fa42fd33be26e420c8e0a4" + "blockHash": "0x81aa7082bad1bbac4f694ea9f0572cf7a73056de5827296e7c54fbfd971a6b6a" }, { "transactionIndex": 1, - "blockNumber": 8057752, - "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", - "address": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "blockNumber": 8095333, + "transactionHash": "0x6cf0ac49e6f7f299c837f74a3b039cfba103b2df0669b114f4d77874e850366e", + "address": "0x5FB63D9e076a314023F2D1aB5dBFd7045C281EbA", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", "logIndex": 2, - "blockHash": "0x810dfcea4a815caab65309e55afd4ca1421fc143f6fa42fd33be26e420c8e0a4" + "blockHash": "0x81aa7082bad1bbac4f694ea9f0572cf7a73056de5827296e7c54fbfd971a6b6a" }, { "transactionIndex": 1, - "blockNumber": 8057752, - "transactionHash": "0x761ac4263ce161901f4527b9ce738b7d55b6db5f361ed1427a054c7fc4dd211e", - "address": "0xa07f4E37C2E7089Ea3AFffbe51A6A281833a4D14", + "blockNumber": 8095333, + "transactionHash": "0x6cf0ac49e6f7f299c837f74a3b039cfba103b2df0669b114f4d77874e850366e", + "address": "0x5FB63D9e076a314023F2D1aB5dBFd7045C281EbA", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b2f6c5b73239c39360ee0ea95047565dab13e3c7", "logIndex": 3, - "blockHash": "0x810dfcea4a815caab65309e55afd4ca1421fc143f6fa42fd33be26e420c8e0a4" + "blockHash": "0x81aa7082bad1bbac4f694ea9f0572cf7a73056de5827296e7c54fbfd971a6b6a" } ], - "blockNumber": 8057752, - "cumulativeGasUsed": "796740", + "blockNumber": 8095333, + "cumulativeGasUsed": "813840", "status": 1, "byzantium": true }, From 9bf2548e071814670bad003c374ae0b0a040e756 Mon Sep 17 00:00:00 2001 From: Michalina Date: Thu, 15 Feb 2024 12:29:27 +0100 Subject: [PATCH 10/12] Fix deployment script dependencies Some dependencies were missing. --- .../13_update_with_arbitrum_in_wormhole_gateway_mapping.ts | 2 +- .../14_update_with_polygon_in_wormhole_gateway_mapping.ts | 2 +- .../15_update_with_base_in_wormhole_gateway_mapping.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts index 472ecf1da..634d44cc2 100644 --- a/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts @@ -41,4 +41,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { export default func func.tags = ["SetArbitrumGatewayAddress"] -func.dependencies = ["OptimismWormholeGateway"] +func.dependencies = ["OptimismWormholeGateway", "ArbitrumWormholeGateway"] diff --git a/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts index 67af323d7..c05ea63e4 100644 --- a/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts @@ -38,4 +38,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { export default func func.tags = ["SetPolygonGatewayAddress"] -func.dependencies = ["OptimismWormholeGateway"] +func.dependencies = ["OptimismWormholeGateway", "PolygonWormholeGateway"] diff --git a/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts index 678f47192..e6e268b68 100644 --- a/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts @@ -36,4 +36,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { export default func func.tags = ["SetBaseGatewayAddress"] -func.dependencies = ["BaseWormholeGateway"] +func.dependencies = ["BaseWormholeGateway", "OptimismWormholeGateway"] From c021d46417d9b2dd1d16a343307196253818b955 Mon Sep 17 00:00:00 2001 From: Michalina Date: Thu, 15 Feb 2024 15:14:58 +0100 Subject: [PATCH 11/12] Fix wrong computation of `wormholeChainID` We were using wrong condition for computation of wormholeChainID. As a result, we've been associating Gateway Address with wrong chains. --- .../13_update_with_arbitrum_in_wormhole_gateway_mapping.ts | 2 +- .../15_update_with_base_in_wormhole_gateway_mapping.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts index 634d44cc2..23787727e 100644 --- a/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts @@ -15,7 +15,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // The value `23` is valid for both Arbitrum Goerli and Arbitrum Mainnet. The // value for Arbitrum Sepolia is `10003`. const arbitrumWormholeChainID = - hre.network.name === "arbitrumSepolia" ? 10003 : 23 + hre.network.name === "optimismSepolia" ? 10003 : 23 const arbitrumWormholeGateway = await deployments.getOrNull( "ArbitrumWormholeGateway" diff --git a/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts b/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts index e6e268b68..d02ca6872 100644 --- a/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts +++ b/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts @@ -14,7 +14,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // The value `30` is valid for both Base Goerli and Base Mainnet. The value // for Base Sepolia is `10004`. const baseWormholeChainID = - hre.network.name === "arbitrumSepolia" ? 10004 : 30 + hre.network.name === "optimismSepolia" ? 10004 : 30 const baseWormholeGateway = await deployments.getOrNull("BaseWormholeGateway") From a778d6a91e36cd847dbc03c1c66bbd940c6b59b8 Mon Sep 17 00:00:00 2001 From: Michalina Date: Thu, 15 Feb 2024 16:31:37 +0100 Subject: [PATCH 12/12] Update Optimism Sepolia with Arbitrum and Base gateways --- .../external/optimismSepolia/ArbitrumWormholeGateway.json | 3 +++ .../optimism/external/optimismSepolia/BaseWormholeGateway.json | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 cross-chain/optimism/external/optimismSepolia/ArbitrumWormholeGateway.json create mode 100644 cross-chain/optimism/external/optimismSepolia/BaseWormholeGateway.json diff --git a/cross-chain/optimism/external/optimismSepolia/ArbitrumWormholeGateway.json b/cross-chain/optimism/external/optimismSepolia/ArbitrumWormholeGateway.json new file mode 100644 index 000000000..3378b040e --- /dev/null +++ b/cross-chain/optimism/external/optimismSepolia/ArbitrumWormholeGateway.json @@ -0,0 +1,3 @@ +{ + "address": "0xc3d46e0266d95215589de639cc4e93b79f88fc6c" +} diff --git a/cross-chain/optimism/external/optimismSepolia/BaseWormholeGateway.json b/cross-chain/optimism/external/optimismSepolia/BaseWormholeGateway.json new file mode 100644 index 000000000..3378b040e --- /dev/null +++ b/cross-chain/optimism/external/optimismSepolia/BaseWormholeGateway.json @@ -0,0 +1,3 @@ +{ + "address": "0xc3d46e0266d95215589de639cc4e93b79f88fc6c" +}