Skip to content

Commit

Permalink
Unpause-contract script can be issued per-chain
Browse files Browse the repository at this point in the history
  • Loading branch information
hernandp committed Jan 3, 2025
1 parent 7690e9a commit 532d6d3
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions deployment/solana/unpause-contract.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SolanaTokenBridgeRelayer } from '@xlabs-xyz/solana-arbitrary-token-transfers';
import { chainToChainId } from '@wormhole-foundation/sdk-base';
import { chain, chains, chainToChainId, isChain } from '@wormhole-foundation/sdk-base';
import { runOnSolana, ledgerSignAndSend, getConnection } from '../helpers/solana.js';
import { SolanaScriptCb } from '../helpers/interfaces.js';
import { dependencies } from '../helpers/env.js';
Expand All @@ -10,6 +10,20 @@ const unpauseContract: SolanaScriptCb = async function (
signer,
// log,
) {

if (process.argv.length != 3) {
console.log('\nUsage: \n\nunpause-contract <chain-name>\n');
console.log('where chain-name is the case-sensitive name of the chain for which outbound transfers will be unpaused');
console.log('\nValid chain names are:', chains.join(', '));
process.exit(0);
}

const chainName = process.argv[2];

if (!isChain(chainName)) {
throw new Error(`Invalid chain name: ${chainName}`);
}

const signerKey = new PublicKey(await signer.getAddress());
const connection = getConnection(operatingChain);
const solanaDependencies = dependencies.find((d) => d.chainId === chainToChainId(operatingChain.name));
Expand All @@ -18,7 +32,7 @@ const unpauseContract: SolanaScriptCb = async function (
}
const tbr = await SolanaTokenBridgeRelayer.create(connection);

const initializeIx = await tbr.setPauseForOutboundTransfers(signerKey, 'Sepolia', false);
const initializeIx = await tbr.setPauseForOutboundTransfers(signerKey, chainName, false);

await ledgerSignAndSend(connection, [initializeIx], []);
}
Expand Down

0 comments on commit 532d6d3

Please sign in to comment.