Skip to content

Commit

Permalink
add fix to allow sending canonical tBTC to non canonical supported ne…
Browse files Browse the repository at this point in the history
…twork
  • Loading branch information
sebastianscatularo committed Nov 7, 2023
1 parent 20feb80 commit 7ca4047
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/assets/providers/tbtc/solana/WormholeGateway.v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import {
THRESHOLD_TBTC_SOLANA_PROGRAM,
} from "../../../../utils/consts";
import {
CHAIN_ID_ETH,
CHAIN_ID_ARBITRUM,
CHAIN_ID_BASE,
CHAIN_ID_OPTIMISM,
CHAIN_ID_POLYGON,
CHAIN_ID_SOLANA,
ChainId,
SignedVaa,
Expand Down Expand Up @@ -176,6 +179,12 @@ function sendTbtcWrapped(
return tx;
}

const CANNONICAL_CHAINS: number[] = [CHAIN_ID_POLYGON, CHAIN_ID_OPTIMISM, CHAIN_ID_ARBITRUM, CHAIN_ID_BASE, CHAIN_ID_SOLANA];

const isCanonical = (chainId: number) => {
return CANNONICAL_CHAINS.includes(chainId);
}

/**
* Send tBtc beween gateways allow burn and mint of tBtc
*/
Expand Down Expand Up @@ -347,7 +356,7 @@ export function newThresholdWormholeGateway(
new PublicKey(senderToken),
new PublicKey(wallet.getAddress()!)
);
if (recipientChain === CHAIN_ID_ETH) {
if (!isCanonical(recipientChain)) {
const wrappedAccounts = {
custodian,
wrappedTbtcToken,
Expand Down

0 comments on commit 7ca4047

Please sign in to comment.