From d665fa762c35aa3ac39953f5d4bb036032b6be32 Mon Sep 17 00:00:00 2001 From: perfogic Date: Fri, 19 Jul 2024 19:51:31 +0700 Subject: [PATCH 1/4] add minimum bridge validation --- components/page/bridge/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/page/bridge/index.tsx b/components/page/bridge/index.tsx index 1fdcc45..6489a0e 100644 --- a/components/page/bridge/index.tsx +++ b/components/page/bridge/index.tsx @@ -271,6 +271,11 @@ const Bridge = () => { const timeout = BigInt(Math.floor(new Date().getTime() / 1000) + 3600); const memo = beginCell().endCell(); + const value = toDisplay(fmtAmount.toString(), token.decimal); + if (value < 100) { + throw Error("Minimum bridge to Oraichain is 100 USDT/USDC"); + } + const getNativeBridgePayload = () => BridgeAdapter.buildBridgeTonBody( { From 6d3c1954239020170ccec5206e1da516251cabf6 Mon Sep 17 00:00:00 2001 From: perfogic Date: Fri, 19 Jul 2024 19:54:38 +0700 Subject: [PATCH 2/4] chore: fix message --- components/page/bridge/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/page/bridge/index.tsx b/components/page/bridge/index.tsx index 6489a0e..277a213 100644 --- a/components/page/bridge/index.tsx +++ b/components/page/bridge/index.tsx @@ -273,7 +273,7 @@ const Bridge = () => { const value = toDisplay(fmtAmount.toString(), token.decimal); if (value < 100) { - throw Error("Minimum bridge to Oraichain is 100 USDT/USDC"); + throw Error("Minimum bridge to Oraichain is 100 USDT"); } const getNativeBridgePayload = () => From 33f1d33d49650f87c86271a8af8013182b2363a5 Mon Sep 17 00:00:00 2001 From: perfogic Date: Fri, 19 Jul 2024 20:00:39 +0700 Subject: [PATCH 3/4] update minimum usdt --- components/page/bridge/index.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/components/page/bridge/index.tsx b/components/page/bridge/index.tsx index 277a213..9dc7e6e 100644 --- a/components/page/bridge/index.tsx +++ b/components/page/bridge/index.tsx @@ -255,6 +255,10 @@ const Bridge = () => { throw `The bridge contract does not have enough balance to process this bridge transaction. Wanted ${amount} ${token.symbol}, have ${balanceMax} ${token.symbol}`; } + if (Number(amount) < 100) { + throw Error("Minimum bridge is 100 USDT"); + } + const bridgeAdapterAddress = Address.parse( TonInteractionContract[tonNetwork].bridgeAdapter ); @@ -271,11 +275,6 @@ const Bridge = () => { const timeout = BigInt(Math.floor(new Date().getTime() / 1000) + 3600); const memo = beginCell().endCell(); - const value = toDisplay(fmtAmount.toString(), token.decimal); - if (value < 100) { - throw Error("Minimum bridge to Oraichain is 100 USDT"); - } - const getNativeBridgePayload = () => BridgeAdapter.buildBridgeTonBody( { @@ -396,6 +395,10 @@ const Bridge = () => { throw `The bridge contract does not have enough balance to process this bridge transaction. Wanted ${amount} ${token.symbol}, have ${displayBalance} ${token.symbol}`; } + if (Number(amount) < 100) { + throw Error("Minimum bridge is 100 USDT"); + } + const tonBridgeClient = new TonbridgeBridgeClient( window.client, oraiAddress, @@ -573,7 +576,7 @@ const Bridge = () => {
{oraiAddress && tonAddress ? (