diff --git a/cross-chain/solana/.env.template b/cross-chain/solana/.env.template index 564120216..c39ee6ef5 100644 --- a/cross-chain/solana/.env.template +++ b/cross-chain/solana/.env.template @@ -1,6 +1,6 @@ export AUTHORITY= export THRESHOLD_COUNCIL_MULTISIG= export NETWORK= -export CLUSTER= +export CLUSTER= export ANCHOR_PROVIDER_URL= export ANCHOR_WALLET= \ No newline at end of file diff --git a/cross-chain/solana/deploy/helpers/consts.ts b/cross-chain/solana/deploy/helpers/consts.ts index a9a4f17d2..6a36dafe8 100644 --- a/cross-chain/solana/deploy/helpers/consts.ts +++ b/cross-chain/solana/deploy/helpers/consts.ts @@ -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" diff --git a/cross-chain/solana/deploy/init.ts b/cross-chain/solana/deploy/init.ts index 97ba91bca..3a9d674eb 100644 --- a/cross-chain/solana/deploy/init.ts +++ b/cross-chain/solana/deploy/init.ts @@ -68,7 +68,7 @@ async function run(): Promise { 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) @@ -83,6 +83,11 @@ async function run(): Promise { 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)) @@ -96,6 +101,8 @@ async function run(): Promise { }) .rpc() + console.log("Initialized wormhole gateway program..") + const minterInfo = PublicKey.findProgramAddressSync( [Buffer.from("minter-info"), minter.toBuffer()], tbtcProgram.programId @@ -113,18 +120,20 @@ async function run(): Promise { }) .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 @@ -149,6 +158,11 @@ async function run(): Promise { }) .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, @@ -171,6 +185,11 @@ async function run(): Promise { }) .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, @@ -193,6 +212,11 @@ async function run(): Promise { }) .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, @@ -215,6 +239,11 @@ async function run(): Promise { }) .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, @@ -237,6 +266,11 @@ async function run(): Promise { }) .rpc() + console.log( + "Updated Solana gateway with self (Solana)..", + Array.from(new PublicKey(SOLANA_GATEWAY).toBuffer()) + ) + console.log("Done initializing programs!") }