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

Adding Solana gateway address for supported x-chains #689

Merged
merged 4 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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_solana_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 SolanaWormholeGateway = await deployments.getOrNull(
"SolanaWormholeGateway"
)

if (
SolanaWormholeGateway &&
helpers.address.isValid(SolanaWormholeGateway.address)
) {
log(
`using existing SolanaWormholeGateway at ${SolanaWormholeGateway.address}`
)
} else if (hre.network.name === "hardhat") {
log("using fake SolanaWormholeGateway for hardhat network")
} else {
throw new Error("deployed SolanaWormholeGateway contract not found")
}
}

export default func

func.tags = ["SolanaWormholeGateway"]
Original file line number Diff line number Diff line change
@@ -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 } = hre
const { execute, log } = deployments
const { deployer } = await getNamedAccounts()

// Fake SolanaWormholeGateway for local development purposes only.
const fakeSolanaWormholeGateway =
"0x11a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"

// See https://docs.wormhole.com/wormhole/blockchain-environments/solana
// This ID is valid for both Solana Devnet and Mainnet
const solanaWormholeChainID = 1

const solanaWormholeGateway = await deployments.getOrNull(
"SolanaWormholeGateway"
)

let solanaWormholeGatewayAddress = solanaWormholeGateway?.address
if (!solanaWormholeGatewayAddress && hre.network.name === "hardhat") {
solanaWormholeGatewayAddress = fakeSolanaWormholeGateway
log(`fake SolanaWormholeGateway address ${solanaWormholeGatewayAddress}`)
}

await execute(
"ArbitrumWormholeGateway",
{ from: deployer, log: true, waitConfirmations: 1 },
"updateGatewayAddress",
solanaWormholeChainID,
solanaWormholeGatewayAddress
)
}

export default func

func.tags = ["SetSolanaGatewayAddress"]
func.dependencies = ["ArbitrumWormholeGateway", "SolanaWormholeGateway"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0x69a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0x69a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"
}
28 changes: 28 additions & 0 deletions cross-chain/base/deploy_l2/00_resolve_solana_wormhole_gateway.ts
Original file line number Diff line number Diff line change
@@ -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 SolanaWormholeGateway = await deployments.getOrNull(
"SolanaWormholeGateway"
)

if (
SolanaWormholeGateway &&
helpers.address.isValid(SolanaWormholeGateway.address)
) {
log(
`using existing SolanaWormholeGateway at ${SolanaWormholeGateway.address}`
)
} else if (hre.network.name === "hardhat") {
log("using fake SolanaWormholeGateway for hardhat network")
} else {
throw new Error("deployed SolanaWormholeGateway contract not found")
}
}

export default func

func.tags = ["SolanaWormholeGateway"]
Original file line number Diff line number Diff line change
@@ -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 } = hre
const { execute, log } = deployments
const { deployer } = await getNamedAccounts()

// Fake SolanaWormholeGateway for local development purposes only.
const fakeSolanaWormholeGateway =
"0x11a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"

// See https://docs.wormhole.com/wormhole/blockchain-environments/solana
// This ID is valid for both Solana Devnet and Mainnet
const solanaWormholeChainID = 1

const solanaWormholeGateway = await deployments.getOrNull(
"SolanaWormholeGateway"
)

let solanaWormholeGatewayAddress = solanaWormholeGateway?.address
if (!solanaWormholeGatewayAddress && hre.network.name === "hardhat") {
solanaWormholeGatewayAddress = fakeSolanaWormholeGateway
log(`fake SolanaWormholeGateway address ${solanaWormholeGatewayAddress}`)
}

await execute(
"BaseWormholeGateway",
{ from: deployer, log: true, waitConfirmations: 1 },
"updateGatewayAddress",
solanaWormholeChainID,
solanaWormholeGatewayAddress
)
}

export default func

func.tags = ["SetSolanaGatewayAddress"]
func.dependencies = ["BaseWormholeGateway", "SolanaWormholeGateway"]
3 changes: 3 additions & 0 deletions cross-chain/base/external/base/SolanaWormholeGateway.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0x69a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0x69a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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_solana_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 SolanaWormholeGateway = await deployments.getOrNull(
"SolanaWormholeGateway"
)

if (
SolanaWormholeGateway &&
helpers.address.isValid(SolanaWormholeGateway.address)
) {
log(
`using existing SolanaWormholeGateway at ${SolanaWormholeGateway.address}`
)
} else if (hre.network.name === "hardhat") {
log("using fake SolanaWormholeGateway for hardhat network")
} else {
throw new Error("deployed SolanaWormholeGateway contract not found")
}
}

export default func

func.tags = ["SolanaWormholeGateway"]
Original file line number Diff line number Diff line change
@@ -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 } = hre
const { execute, log } = deployments
const { deployer } = await getNamedAccounts()

// Fake SolanaWormholeGateway for local development purposes only.
const fakeSolanaWormholeGateway =
"0x11a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"

// See https://docs.wormhole.com/wormhole/blockchain-environments/solana
// This ID is valid for both Solana Devnet and Mainnet
const solanaWormholeChainID = 1

const solanaWormholeGateway = await deployments.getOrNull(
"SolanaWormholeGateway"
)

let solanaWormholeGatewayAddress = solanaWormholeGateway?.address
if (!solanaWormholeGatewayAddress && hre.network.name === "hardhat") {
solanaWormholeGatewayAddress = fakeSolanaWormholeGateway
log(`fake SolanaWormholeGateway address ${solanaWormholeGatewayAddress}`)
}

await execute(
"OptimismWormholeGateway",
{ from: deployer, log: true, waitConfirmations: 1 },
"updateGatewayAddress",
solanaWormholeChainID,
solanaWormholeGatewayAddress
)
}

export default func

func.tags = ["SetSolanaGatewayAddress"]
func.dependencies = ["OptimismWormholeGateway", "SolanaWormholeGateway"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0x69a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0x69a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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_solana_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 SolanaWormholeGateway = await deployments.getOrNull(
"SolanaWormholeGateway"
)

if (
SolanaWormholeGateway &&
helpers.address.isValid(SolanaWormholeGateway.address)
) {
log(
`using existing SolanaWormholeGateway at ${SolanaWormholeGateway.address}`
)
} else if (hre.network.name === "hardhat") {
log("using fake SolanaWormholeGateway for hardhat network")
} else {
throw new Error("deployed SolanaWormholeGateway contract not found")
}
}

export default func

func.tags = ["SolanaWormholeGateway"]
Original file line number Diff line number Diff line change
@@ -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 } = hre
const { execute, log } = deployments
const { deployer } = await getNamedAccounts()

// Fake SolanaWormholeGateway for local development purposes only.
const fakeSolanaWormholeGateway =
"0x11a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"

// See https://docs.wormhole.com/wormhole/blockchain-environments/solana
// This ID is valid for both Solana Devnet and Mainnet
const solanaWormholeChainID = 1

const solanaWormholeGateway = await deployments.getOrNull(
"SolanaWormholeGateway"
)

let solanaWormholeGatewayAddress = solanaWormholeGateway?.address
if (!solanaWormholeGatewayAddress && hre.network.name === "hardhat") {
solanaWormholeGatewayAddress = fakeSolanaWormholeGateway
log(`fake SolanaWormholeGateway address ${solanaWormholeGatewayAddress}`)
}

await execute(
"PolygonWormholeGateway",
{ from: deployer, log: true, waitConfirmations: 1 },
"updateGatewayAddress",
solanaWormholeChainID,
solanaWormholeGatewayAddress
)
}

export default func

func.tags = ["SetSolanaGatewayAddress"]
func.dependencies = ["PolygonWormholeGateway", "SolanaWormholeGateway"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0x69a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"address": "0x69a22dc2e01ecd2ae40864822d4406ff8aed4e2b8932385dabe818422ff67e1b"
}
Loading