Skip to content

Commit

Permalink
Make ...WormholeChainID values dependable on the environment
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michalinacienciala committed Jan 18, 2024
1 parent 19cbc8e commit 0ffaaf6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 Base Sepolia is `10004`.
const wormholeChainID = hre.network.name === "baseSepolia" ? 10004 : 30

const baseWormholeGateway = await deployments.get("BaseWormholeGateway")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +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
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 === "baseSepolia" ? 10003 : 23

const arbitrumWormholeGateway = await deployments.getOrNull(
"ArbitrumWormholeGateway"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ 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#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 === "baseSepolia" ? 10005 : 24

const optimismWormholeGateway = await deployments.getOrNull(
"OptimismWormholeGateway"
Expand Down

0 comments on commit 0ffaaf6

Please sign in to comment.