Skip to content

Commit

Permalink
add prevention for not bridging token from orai to ton if wallet is n…
Browse files Browse the repository at this point in the history
…ot active
  • Loading branch information
perfogic committed Aug 16, 2024
1 parent 4fae5d6 commit 7b773c3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components/page/bridge/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const FWD_AMOUNT = toNano(0.15);
const TON_MESSAGE_VALID_UNTIL = 100000;
const BRIDGE_TON_TO_ORAI_MINIMUM_GAS = toNano(1);
const EXTERNAL_MESSAGE_FEE = toNano(0.01);
const MINIMUM_BRIDGE_PER_USD = 10;
const MINIMUM_BRIDGE_PER_USD = 0;

export {
FWD_AMOUNT,
Expand Down
13 changes: 13 additions & 0 deletions components/page/bridge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,19 @@ const Bridge = () => {

validatePrice(token, amount);

// get the decentralized RPC endpoint
const endpoint = await getHttpEndpoint();
const client = new TonClient({
endpoint,
});

const isActiveDestinationAddress = await client.isContractDeployed(
Address.parse(destinationAddress)
);
if (!isActiveDestinationAddress) {
throw "Destination address has to be an active address!";
}

setLoading(true);

const tokenInTon = TonTokenList(TonNetwork.Mainnet).find(
Expand Down

0 comments on commit 7b773c3

Please sign in to comment.