From f8d59a3c74d1284265832c0afa39fcbb3e41cd47 Mon Sep 17 00:00:00 2001 From: Michalina Date: Thu, 18 Jan 2024 16:57:26 +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` constant for the the right network we're deploying to. --- .../deploy_l2/12_update_wormhole_gateway_mapping.ts | 10 +++++----- ...pdate_with_optimism_in_wormhole_gateway_mapping.ts | 11 ++++++----- ...update_with_polygon_in_wormhole_gateway_mapping.ts | 7 +++---- ...15_update_with_base_in_wormhole_gateway_mapping.ts | 11 ++++++----- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/cross-chain/arbitrum/deploy_l2/12_update_wormhole_gateway_mapping.ts b/cross-chain/arbitrum/deploy_l2/12_update_wormhole_gateway_mapping.ts index c5401d158..8d5ebadb9 100644 --- a/cross-chain/arbitrum/deploy_l2/12_update_wormhole_gateway_mapping.ts +++ b/cross-chain/arbitrum/deploy_l2/12_update_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 Arbitrum Goerli and Mainnet - // TODO: check if id is correct for Arbitrum Sepolia as well (once Wormhole - // supports that testnet) - const wormholeChainID = 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 wormholeChainID = hre.network.name === "arbitrumSepolia" ? 10003 : 23 const ArbitrumWormholeGateway = await deployments.get( "ArbitrumWormholeGateway" diff --git a/cross-chain/arbitrum/deploy_l2/13_update_with_optimism_in_wormhole_gateway_mapping.ts b/cross-chain/arbitrum/deploy_l2/13_update_with_optimism_in_wormhole_gateway_mapping.ts index 54d523689..5e84cd3c5 100644 --- a/cross-chain/arbitrum/deploy_l2/13_update_with_optimism_in_wormhole_gateway_mapping.ts +++ b/cross-chain/arbitrum/deploy_l2/13_update_with_optimism_in_wormhole_gateway_mapping.ts @@ -10,11 +10,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const fakeOptimismWormholeGateway = "0x1af5DC16568EFF2d480a43A77E6C409e497FcFb9" - // 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 optimismWormholeChainID = 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 optimismWormholeChainID = + hre.network.name === "arbitrumSepolia" ? 10005 : 24 const optimismWormholeGateway = await deployments.getOrNull( "OptimismWormholeGateway" diff --git a/cross-chain/arbitrum/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts b/cross-chain/arbitrum/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts index 8197708ce..b9e38ad77 100644 --- a/cross-chain/arbitrum/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts +++ b/cross-chain/arbitrum/deploy_l2/14_update_with_polygon_in_wormhole_gateway_mapping.ts @@ -10,10 +10,9 @@ 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 + // 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/arbitrum/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts b/cross-chain/arbitrum/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts index 02d693c55..4d74abf02 100644 --- a/cross-chain/arbitrum/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts +++ b/cross-chain/arbitrum/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 Base 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")