Skip to content

Commit

Permalink
Minor updates in logs and description
Browse files Browse the repository at this point in the history
  • Loading branch information
dimpar committed Aug 12, 2023
1 parent c77c1ba commit c2bdc92
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cross-chain/solana/.env.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export AUTHORITY=<path_to_keypair_deployer>
export THRESHOLD_COUNCIL_MULTISIG=<multisig_address>
export NETWORK=<solana-devnet, mainnet>
export CLUSTER=<devnet, mainnet-beta>
export CLUSTER=<devnet, mainnet>
export ANCHOR_PROVIDER_URL=<http://localhost:8899, https://api.devnet.solana.com, https://api.mainnet-beta.solana.com>
export ANCHOR_WALLET=<path_to_keypair_deployer>
9 changes: 5 additions & 4 deletions cross-chain/solana/deploy/helpers/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ export const BASE_GATEWAY_ADDRESS_TESTNET =
export const BASE_GATEWAY_ADDRESS_MAINNET =
"00000000000000000000000009959798B95d00a3183d20FaC298E4594E599eab"

export const SOLANA_GATEWAY_ADDRESS_TESTNET =
"87MEvHZCXE3ML5rrmh5uX1FbShHmRXXS32xJDGbQ7h5t"
export const SOLANA_GATEWAY_ADDRESS_MAINNET =
"87MEvHZCXE3ML5rrmh5uX1FbShHmRXXS32xJDGbQ7h5t"

// deriveWrappedMintKey("DZnkkTmCiFWfYTfT41X3Rd1kDgozqzxWaHqsw6W4x2oe", 2, "0x679874fbe6d4e7cc54a59e315ff1eb266686a937")
export const WRAPPED_TBTC_MINT_TESTNET =
"FMYvcyMJJ22whB9m3T5g1oPKwM6jpLnFBXnrY6eXmCrp"
// deriveWrappedMintKey("wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb", 2, "0x18084fbA666a33d37592fA2633fD49a74DD93a88")
export const WRAPPED_TBTC_MINT_MAINNET =
"25rXTx9zDZcHyTav5sRqM6YBvTGu9pPH9yv83uAEqbgG"

export const SOLANA_GATEWAY_ADDRESS_TESTNET =
"87MEvHZCXE3ML5rrmh5uX1FbShHmRXXS32xJDGbQ7h5t"
// export const SOLANA_GATEWAY_ADDRESS_MAINNET = "tbd"
40 changes: 37 additions & 3 deletions cross-chain/solana/deploy/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async function run(): Promise<void> {

const mintingLimit = "18446744073709551615" // Max u64
let WRAPPED_TBTC = consts.WRAPPED_TBTC_MINT_TESTNET
if (process.env.CLUSTER === "mainnet-beta") {
if (process.env.CLUSTER === "mainnet") {
WRAPPED_TBTC = consts.WRAPPED_TBTC_MINT_MAINNET
}
const WRAPPED_TBTC_MINT = new PublicKey(WRAPPED_TBTC)
Expand All @@ -83,6 +83,11 @@ async function run(): Promise<void> {
wormholeGatewayProgram.programId
)[0]

// NOTE: It might happen on mainnet that tbtc won't be initialized if running this
// script in one shot.
// The simplest solution is just to wait a bit and then proceed with wormhole_gateway
// initializtion.

// Initialize wormhole gateway
await wormholeGatewayProgram.methods
.initialize(new anchor.BN(mintingLimit))
Expand All @@ -96,6 +101,8 @@ async function run(): Promise<void> {
})
.rpc()

console.log("Initialized wormhole gateway program..")

const minterInfo = PublicKey.findProgramAddressSync(
[Buffer.from("minter-info"), minter.toBuffer()],
tbtcProgram.programId
Expand All @@ -113,18 +120,20 @@ async function run(): Promise<void> {
})
.rpc()

console.log("Added a minter..")

// Point to devnet addresses by default
let ARBITRUM_GATEWAY = consts.ARBITRUM_GATEWAY_ADDRESS_TESTNET
let OPTIMISM_GATEWAY = consts.OPTIMISM_GATEWAY_ADDRESS_TESTNET
let POLYGON_GATEWAY = consts.POLYGON_GATEWAY_ADDRESS_TESTNET
let BASE_GATEWAY = consts.BASE_GATEWAY_ADDRESS_TESTNET
let SOLANA_GATEWAY = consts.SOLANA_GATEWAY_ADDRESS_TESTNET
if (process.env.CLUSTER === "mainnet-beta") {
if (process.env.CLUSTER === "mainnet") {
ARBITRUM_GATEWAY = consts.ARBITRUM_GATEWAY_ADDRESS_MAINNET
OPTIMISM_GATEWAY = consts.OPTIMISM_GATEWAY_ADDRESS_MAINNET
POLYGON_GATEWAY = consts.POLYGON_GATEWAY_ADDRESS_MAINNET
BASE_GATEWAY = consts.BASE_GATEWAY_ADDRESS_MAINNET
// TODO: add SOLANA_GATEWAY_ADDRESS_MAINNET once it's deployed
SOLANA_GATEWAY = consts.SOLANA_GATEWAY_ADDRESS_MAINNET
}

// Updating with Arbitrum
Expand All @@ -149,6 +158,11 @@ async function run(): Promise<void> {
})
.rpc()

console.log(
"Updated Solana gateway with Arbitrum..",
Array.from(new PublicKey(ARBITRUM_GATEWAY).toBuffer())
)

// Updating with Optimism
const optiArgs = {
chain: consts.WH_OPTIMISM_CHAIN_ID,
Expand All @@ -171,6 +185,11 @@ async function run(): Promise<void> {
})
.rpc()

console.log(
"Updated Solana gateway with Optimism..",
Array.from(new PublicKey(OPTIMISM_GATEWAY).toBuffer())
)

// Updating with Polygon
const polyArgs = {
chain: consts.WH_POLYGON_CHAIN_ID,
Expand All @@ -193,6 +212,11 @@ async function run(): Promise<void> {
})
.rpc()

console.log(
"Updated Solana gateway with Polygon..",
Array.from(new PublicKey(POLYGON_GATEWAY).toBuffer())
)

// Updating with BASE
const baseArgs = {
chain: consts.WH_BASE_CHAIN_ID,
Expand All @@ -215,6 +239,11 @@ async function run(): Promise<void> {
})
.rpc()

console.log(
"Updated Solana gateway with Base..",
Array.from(Buffer.alloc(32, BASE_GATEWAY, "hex"))
)

// Updating with self (SOLANA)
const solanaArgs = {
chain: consts.WH_SOLANA_CHAIN_ID,
Expand All @@ -237,6 +266,11 @@ async function run(): Promise<void> {
})
.rpc()

console.log(
"Updated Solana gateway with self (Solana)..",
Array.from(new PublicKey(SOLANA_GATEWAY).toBuffer())
)

console.log("Done initializing programs!")
}

Expand Down

0 comments on commit c2bdc92

Please sign in to comment.