From 4e3dc659a0f52fb079686c518d53018e435a74be Mon Sep 17 00:00:00 2001 From: jdrskr Date: Mon, 4 Dec 2023 15:19:48 +0100 Subject: [PATCH] feat: use bignumber. --- .../pages/client/pages/components/InteractionsWidget.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/client/pages/components/InteractionsWidget.tsx b/frontend/src/pages/client/pages/components/InteractionsWidget.tsx index 7d43217..d5d9555 100644 --- a/frontend/src/pages/client/pages/components/InteractionsWidget.tsx +++ b/frontend/src/pages/client/pages/components/InteractionsWidget.tsx @@ -17,7 +17,7 @@ import { ERC20Mock__factory, OrdersExchange__factory, } from "../../../../typechain"; -import { ethers } from "ethers"; +import { BigNumber, ethers } from "ethers"; import { ASSETS } from "../../../../constants/Assets"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; @@ -71,7 +71,7 @@ export const InteractionsWidget: React.FC = () => { if (!value) { await stableContract.approve( process.env.REACT_APP_SWAP_CONTRACT_ADDRESS as string, - data.amount * 10 ** 6 + BigNumber.from(data.amount).mul(10 ** 6) ); } else { const contract = new ERC20Mock__factory() @@ -80,13 +80,13 @@ export const InteractionsWidget: React.FC = () => { await contract.approve( process.env.REACT_APP_SWAP_CONTRACT_ADDRESS as string, - data.amount * 10 ** 18 + BigNumber.from(data.amount).mul(10 ** 18) ); } const tx = await contract.scheduleOrder( ASSETS[asset].address!, - data.amount * 10 ** (!value ? 6 : 18), + BigNumber.from(data.amount).mul(10 ** (!value ? 6 : 18)), !value );