diff --git a/cross-chain/arbitrum/deploy_l2/00_resolve_base_wormhole_gateway.ts b/cross-chain/arbitrum/deploy_l2/00_resolve_base_wormhole_gateway.ts new file mode 100644 index 000000000..598d1c494 --- /dev/null +++ b/cross-chain/arbitrum/deploy_l2/00_resolve_base_wormhole_gateway.ts @@ -0,0 +1,28 @@ +import type { HardhatRuntimeEnvironment } from "hardhat/types" +import type { DeployFunction } from "hardhat-deploy/types" + +const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const { helpers, deployments } = hre + const { log } = deployments + + const BaseWormholeGateway = await deployments.getOrNull( + "BaseWormholeGateway" + ) + + if ( + BaseWormholeGateway && + helpers.address.isValid(BaseWormholeGateway.address) + ) { + log( + `using existing BaseWormholeGateway at ${BaseWormholeGateway.address}` + ) + } else if (hre.network.name === "hardhat") { + log("using fake BaseWormholeGateway for hardhat network") + } else { + throw new Error("deployed BaseWormholeGateway contract not found") + } +} + +export default func + +func.tags = ["BaseWormholeGateway"] 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 new file mode 100644 index 000000000..fbdfa25d2 --- /dev/null +++ b/cross-chain/arbitrum/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts @@ -0,0 +1,39 @@ +import type { HardhatRuntimeEnvironment } from "hardhat/types" +import type { DeployFunction } from "hardhat-deploy/types" + +const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const { deployments, getNamedAccounts, ethers } = hre + const { execute, log } = deployments + const { deployer } = await getNamedAccounts() + + // 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 + const baseWormholeChainID = 30 + + const baseWormholeGateway = await deployments.getOrNull( + "BaseWormholeGateway" + ) + + let baseWormholeGatewayAddress = baseWormholeGateway?.address + if (!baseWormholeGatewayAddress && hre.network.name === "hardhat") { + baseWormholeGatewayAddress = fakeBaseWormholeGateway + log(`fake BaseWormholeGateway address ${baseWormholeGatewayAddress}`) + } + + await execute( + "ArbitrumWormholeGateway", + { from: deployer, log: true, waitConfirmations: 1 }, + "updateGatewayAddress", + baseWormholeChainID, + ethers.utils.hexZeroPad(baseWormholeGatewayAddress, 32) + ) +} + +export default func + +func.tags = ["SetBaseGatewayAddress"] +func.dependencies = ["BaseWormholeGateway"] diff --git a/cross-chain/arbitrum/external/arbitrumGoerli/BaseWormholeGateway.json b/cross-chain/arbitrum/external/arbitrumGoerli/BaseWormholeGateway.json new file mode 100644 index 000000000..74c39592d --- /dev/null +++ b/cross-chain/arbitrum/external/arbitrumGoerli/BaseWormholeGateway.json @@ -0,0 +1,3 @@ +{ + "address": "0xe3e0511EEbD87F08FbaE4486419cb5dFB06e1343" +} diff --git a/cross-chain/arbitrum/external/arbitrumOne/BaseWormholeGateway.json b/cross-chain/arbitrum/external/arbitrumOne/BaseWormholeGateway.json new file mode 100644 index 000000000..6571efe8d --- /dev/null +++ b/cross-chain/arbitrum/external/arbitrumOne/BaseWormholeGateway.json @@ -0,0 +1,3 @@ +{ + "address": "0x09959798B95d00a3183d20FaC298E4594E599eab" +} diff --git a/cross-chain/optimism/deploy_l2/00_resolve_base_wormhole_gateway.ts b/cross-chain/optimism/deploy_l2/00_resolve_base_wormhole_gateway.ts new file mode 100644 index 000000000..598d1c494 --- /dev/null +++ b/cross-chain/optimism/deploy_l2/00_resolve_base_wormhole_gateway.ts @@ -0,0 +1,28 @@ +import type { HardhatRuntimeEnvironment } from "hardhat/types" +import type { DeployFunction } from "hardhat-deploy/types" + +const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const { helpers, deployments } = hre + const { log } = deployments + + const BaseWormholeGateway = await deployments.getOrNull( + "BaseWormholeGateway" + ) + + if ( + BaseWormholeGateway && + helpers.address.isValid(BaseWormholeGateway.address) + ) { + log( + `using existing BaseWormholeGateway at ${BaseWormholeGateway.address}` + ) + } else if (hre.network.name === "hardhat") { + log("using fake BaseWormholeGateway for hardhat network") + } else { + throw new Error("deployed BaseWormholeGateway contract not found") + } +} + +export default func + +func.tags = ["BaseWormholeGateway"] 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 new file mode 100644 index 000000000..854060ea4 --- /dev/null +++ b/cross-chain/optimism/deploy_l2/15_update_with_base_in_wormhole_gateway_mapping.ts @@ -0,0 +1,39 @@ +import type { HardhatRuntimeEnvironment } from "hardhat/types" +import type { DeployFunction } from "hardhat-deploy/types" + +const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const { deployments, getNamedAccounts, ethers } = hre + const { execute, log } = deployments + const { deployer } = await getNamedAccounts() + + // 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 + const baseWormholeChainID = 30 + + const baseWormholeGateway = await deployments.getOrNull( + "BaseWormholeGateway" + ) + + let baseWormholeGatewayAddress = baseWormholeGateway?.address + if (!baseWormholeGatewayAddress && hre.network.name === "hardhat") { + baseWormholeGatewayAddress = fakeBaseWormholeGateway + log(`fake BaseWormholeGateway address ${baseWormholeGatewayAddress}`) + } + + await execute( + "OptimismWormholeGateway", + { from: deployer, log: true, waitConfirmations: 1 }, + "updateGatewayAddress", + baseWormholeChainID, + ethers.utils.hexZeroPad(baseWormholeGatewayAddress, 32) + ) +} + +export default func + +func.tags = ["SetBaseGatewayAddress"] +func.dependencies = ["BaseWormholeGateway"] diff --git a/cross-chain/optimism/external/optimism/BaseWormholeGateway.json b/cross-chain/optimism/external/optimism/BaseWormholeGateway.json new file mode 100644 index 000000000..6571efe8d --- /dev/null +++ b/cross-chain/optimism/external/optimism/BaseWormholeGateway.json @@ -0,0 +1,3 @@ +{ + "address": "0x09959798B95d00a3183d20FaC298E4594E599eab" +} diff --git a/cross-chain/optimism/external/optimismGoerli/BaseWormholeGateway.json b/cross-chain/optimism/external/optimismGoerli/BaseWormholeGateway.json new file mode 100644 index 000000000..74c39592d --- /dev/null +++ b/cross-chain/optimism/external/optimismGoerli/BaseWormholeGateway.json @@ -0,0 +1,3 @@ +{ + "address": "0xe3e0511EEbD87F08FbaE4486419cb5dFB06e1343" +} diff --git a/cross-chain/polygon/deploy_sidechain/00_resolve_base_wormhole_gateway.ts b/cross-chain/polygon/deploy_sidechain/00_resolve_base_wormhole_gateway.ts new file mode 100644 index 000000000..598d1c494 --- /dev/null +++ b/cross-chain/polygon/deploy_sidechain/00_resolve_base_wormhole_gateway.ts @@ -0,0 +1,28 @@ +import type { HardhatRuntimeEnvironment } from "hardhat/types" +import type { DeployFunction } from "hardhat-deploy/types" + +const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const { helpers, deployments } = hre + const { log } = deployments + + const BaseWormholeGateway = await deployments.getOrNull( + "BaseWormholeGateway" + ) + + if ( + BaseWormholeGateway && + helpers.address.isValid(BaseWormholeGateway.address) + ) { + log( + `using existing BaseWormholeGateway at ${BaseWormholeGateway.address}` + ) + } else if (hre.network.name === "hardhat") { + log("using fake BaseWormholeGateway for hardhat network") + } else { + throw new Error("deployed BaseWormholeGateway contract not found") + } +} + +export default func + +func.tags = ["BaseWormholeGateway"] diff --git a/cross-chain/polygon/deploy_sidechain/15_update_with_base_in_wormhole_gateway_mapping.ts b/cross-chain/polygon/deploy_sidechain/15_update_with_base_in_wormhole_gateway_mapping.ts new file mode 100644 index 000000000..d5f4d771d --- /dev/null +++ b/cross-chain/polygon/deploy_sidechain/15_update_with_base_in_wormhole_gateway_mapping.ts @@ -0,0 +1,41 @@ +import type { HardhatRuntimeEnvironment } from "hardhat/types" +import type { DeployFunction } from "hardhat-deploy/types" + +const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const { deployments, getNamedAccounts, ethers } = hre + const { execute, log } = deployments + const { deployer } = await getNamedAccounts() + + // Fake BaseWormholeGateway for local development purposes only. + const fakeBaseWormholeGateway = + "0x2af5DC16568EFF2d480a43A77E6C409e497FcFb9" + + // See https://docs.wormhole.com/wormhole/blockchain-environments/evm#base + // This ID is valid for both Base Goerli and Mainnet + const baseWormholeChainID = 30 + + const baseWormholeGateway = await deployments.getOrNull( + "BaseWormholeGateway" + ) + + let baseWormholeGatewayAddress = baseWormholeGateway?.address + if (!baseWormholeGatewayAddress && hre.network.name === "hardhat") { + baseWormholeGatewayAddress = fakeBaseWormholeGateway + log( + `fake BaseWormholeGateway address ${baseWormholeGatewayAddress}` + ) + } + + await execute( + "PolygonWormholeGateway", + { from: deployer, log: true, waitConfirmations: 1 }, + "updateGatewayAddress", + baseWormholeChainID, + ethers.utils.hexZeroPad(baseWormholeGatewayAddress, 32) + ) +} + +export default func + +func.tags = ["SetBaseGatewayAddress"] +func.dependencies = ["BaseWormholeGateway"] diff --git a/cross-chain/polygon/external/mumbai/BaseWormholeGateway.json b/cross-chain/polygon/external/mumbai/BaseWormholeGateway.json new file mode 100644 index 000000000..74c39592d --- /dev/null +++ b/cross-chain/polygon/external/mumbai/BaseWormholeGateway.json @@ -0,0 +1,3 @@ +{ + "address": "0xe3e0511EEbD87F08FbaE4486419cb5dFB06e1343" +} diff --git a/cross-chain/polygon/external/polygon/BaseWormholeGateway.json b/cross-chain/polygon/external/polygon/BaseWormholeGateway.json new file mode 100644 index 000000000..6571efe8d --- /dev/null +++ b/cross-chain/polygon/external/polygon/BaseWormholeGateway.json @@ -0,0 +1,3 @@ +{ + "address": "0x09959798B95d00a3183d20FaC298E4594E599eab" +}