From 44f7de11790e3a85e62a03b3a2f90f3413eca43d Mon Sep 17 00:00:00 2001 From: Michalina Date: Thu, 18 Jan 2024 15:27:13 +0100 Subject: [PATCH] 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` constants for the the right network we're deploying to. --- .../12_update_self_in_wormhole_gateway_mapping.ts | 10 +++++----- ...update_with_arbitrum_in_wormhole_gateway_mapping.ts | 8 +++++--- ..._update_with_polygon_in_wormhole_gateway_mapping.ts | 4 +++- ...update_with_optimism_in_wormhole_gateway_mapping.ts | 8 +++++--- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/cross-chain/base/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts b/cross-chain/base/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts index b0c7d3dc7..1c6667178 100644 --- a/cross-chain/base/deploy_l2/12_update_self_in_wormhole_gateway_mapping.ts +++ b/cross-chain/base/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://docs.wormhole.com/wormhole/blockchain-environments/evm#base - // This ID is valid for both Base Goerli and Base Mainnet - // TODO: check if id is correct for Base Sepolia as well (once Wormhole - // supports that testnet) - const wormholeChainID = 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 Arbitrum Sepolia is `10004`. + const wormholeChainID = hre.network.name === "sepolia" ? 10004 : 30 const baseWormholeGateway = await deployments.get("BaseWormholeGateway") diff --git a/cross-chain/base/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts b/cross-chain/base/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts index e80738989..f3d912910 100644 --- a/cross-chain/base/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts +++ b/cross-chain/base/deploy_l2/13_update_with_arbitrum_in_wormhole_gateway_mapping.ts @@ -10,9 +10,11 @@ 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 - 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 === "sepolia" ? 10003 : 23 const arbitrumWormholeGateway = await deployments.getOrNull( "ArbitrumWormholeGateway" diff --git a/cross-chain/base/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts b/cross-chain/base/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts index 7d4f38a70..439e7ffce 100644 --- a/cross-chain/base/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts +++ b/cross-chain/base/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts @@ -11,7 +11,9 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { "0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9" // See https://book.wormhole.com/reference/contracts.html - // This ID is valid for both Polygon Testnet (Mumbai) and Mainnet + // 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/base/deploy_l2/15_update_with_optimism_in_wormhole_gateway_mapping.ts b/cross-chain/base/deploy_l2/15_update_with_optimism_in_wormhole_gateway_mapping.ts index 09dd489ff..8aae0c272 100644 --- a/cross-chain/base/deploy_l2/15_update_with_optimism_in_wormhole_gateway_mapping.ts +++ b/cross-chain/base/deploy_l2/15_update_with_optimism_in_wormhole_gateway_mapping.ts @@ -10,9 +10,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const fakeOptimismWormholeGateway = "0x2af5DC16568EFF2d480a43A77E6C409e497FcFb9" - // See https://book.wormhole.com/reference/contracts.html - // This ID is valid for both Optimism Goerli and Mainnet - const optimismWormholeChainID = 24 + // See https://docs.wormhole.com/wormhole/blockchain-environments/evm#arbitrum + // 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 optimismWormholeChainID = hre.network.name === "sepolia" ? 10005 : 24 const optimismWormholeGateway = await deployments.getOrNull( "OptimismWormholeGateway"