From d91e27789fc33173152ad1e525fcfad3b7224798 Mon Sep 17 00:00:00 2001 From: jdrskr Date: Mon, 4 Dec 2023 15:44:17 +0100 Subject: [PATCH] fix: bignumbers. --- .../client/pages/components/InteractionsWidget.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/client/pages/components/InteractionsWidget.tsx b/frontend/src/pages/client/pages/components/InteractionsWidget.tsx index d5d9555..1a62eeb 100644 --- a/frontend/src/pages/client/pages/components/InteractionsWidget.tsx +++ b/frontend/src/pages/client/pages/components/InteractionsWidget.tsx @@ -71,7 +71,9 @@ export const InteractionsWidget: React.FC = () => { if (!value) { await stableContract.approve( process.env.REACT_APP_SWAP_CONTRACT_ADDRESS as string, - BigNumber.from(data.amount).mul(10 ** 6) + BigNumber.from(data.amount) + .mul(BigNumber.from(10).pow(6)) + .toString() ); } else { const contract = new ERC20Mock__factory() @@ -80,13 +82,16 @@ export const InteractionsWidget: React.FC = () => { await contract.approve( process.env.REACT_APP_SWAP_CONTRACT_ADDRESS as string, - BigNumber.from(data.amount).mul(10 ** 18) + BigNumber.from(data.amount) + .mul(BigNumber.from(10).pow(18)) + .toString() ); } - const tx = await contract.scheduleOrder( ASSETS[asset].address!, - BigNumber.from(data.amount).mul(10 ** (!value ? 6 : 18)), + BigNumber.from(data.amount) + .mul(BigNumber.from(10).pow(!value ? 6 : 18)) + .toString(), !value );