Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating existing supported chains after Base deployment #687

Merged
merged 2 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions cross-chain/arbitrum/deploy_l2/00_resolve_base_wormhole_gateway.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { HardhatRuntimeEnvironment } from "hardhat/types"
import type { DeployFunction } from "hardhat-deploy/types"

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

Check warning on line 4 in cross-chain/arbitrum/deploy_l2/00_resolve_base_wormhole_gateway.ts

View workflow job for this annotation

GitHub Actions / contracts-format

Unexpected unnamed async function
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"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0xe3e0511EEbD87F08FbaE4486419cb5dFB06e1343"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0x09959798B95d00a3183d20FaC298E4594E599eab"
}
24 changes: 24 additions & 0 deletions cross-chain/optimism/deploy_l2/00_resolve_base_wormhole_gateway.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { HardhatRuntimeEnvironment } from "hardhat/types"
import type { DeployFunction } from "hardhat-deploy/types"

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

Check warning on line 4 in cross-chain/optimism/deploy_l2/00_resolve_base_wormhole_gateway.ts

View workflow job for this annotation

GitHub Actions / contracts-format

Unexpected unnamed async function
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"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0x09959798B95d00a3183d20FaC298E4594E599eab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0xe3e0511EEbD87F08FbaE4486419cb5dFB06e1343"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { HardhatRuntimeEnvironment } from "hardhat/types"
import type { DeployFunction } from "hardhat-deploy/types"

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

Check warning on line 4 in cross-chain/polygon/deploy_sidechain/00_resolve_base_wormhole_gateway.ts

View workflow job for this annotation

GitHub Actions / contracts-format

Unexpected unnamed async function
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"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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"]
3 changes: 3 additions & 0 deletions cross-chain/polygon/external/mumbai/BaseWormholeGateway.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0xe3e0511EEbD87F08FbaE4486419cb5dFB06e1343"
}
3 changes: 3 additions & 0 deletions cross-chain/polygon/external/polygon/BaseWormholeGateway.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0x09959798B95d00a3183d20FaC298E4594E599eab"
}
Loading