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` constant for
the the right network we're deploying to.
  • Loading branch information
michalinacienciala committed Jan 18, 2024
1 parent a19169c commit 77f5a8b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 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://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 === "sepolia" ? 10003 : 23

const ArbitrumWormholeGateway = await deployments.get(
"ArbitrumWormholeGateway"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ 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 === "sepolia" ? 10005 : 24

const optimismWormholeGateway = await deployments.getOrNull(
"OptimismWormholeGateway"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ 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 === "sepolia" ? 10004 : 30

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

Expand Down

0 comments on commit 77f5a8b

Please sign in to comment.