Skip to content

Commit

Permalink
TON: Fix Burning FTs
Browse files Browse the repository at this point in the history
  • Loading branch information
imsk17 committed Jun 25, 2024
1 parent 59d99dd commit 7f3f88f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/chains/ton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export function tonHandler({
query_id: 0n,
destination: burner,
forward_payload: beginCell()
.storeAddress(bridge)
.storeUint(cid, 64) // Target Chain
.storeRef(
beginCell()
Expand Down Expand Up @@ -243,10 +244,7 @@ export function tonHandler({

async function isWrappedToken(targetChain: bigint, fromTokenId: bigint, targetTokenId: bigint) {
const steps = await bridgeReader.getCrossChainStrategy();
console.log(targetChain)
console.log(steps.get(targetChain))
const strategy = steps.get(targetChain)?.i.get(fromTokenId)?.i.get(targetTokenId);
console.log(strategy)
if (!strategy) return false
for (let i = 0; i < strategy.local_steps.size; i++) {
const strat = strategy.local_steps.steps.get(BigInt(i));
Expand Down Expand Up @@ -352,6 +350,7 @@ export function tonHandler({
const bc = client.open(Bridge.fromAddress(bridge));
const fsid = BigInt(`0x${sha256_sync(fromSymbol).toString("hex")}`);
const tid = BigInt(`0x${sha256_sync(targetSymbol).toString("hex")}`);
const isWrapped = await isWrappedToken(cid, fsid, tid)
if (tid === nativeTokenId) {
await transferTon(
bc,
Expand All @@ -362,7 +361,7 @@ export function tonHandler({
amt,
fee ? { ...gasArgs, value: fee } : gasArgs
);
} else if (await isWrappedToken(cid, fsid , tid)) {
} else if (isWrapped) {
await transferJetton(
burner,
signer,
Expand Down

0 comments on commit 7f3f88f

Please sign in to comment.