Skip to content

Commit

Permalink
feat: use bignumber.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrskr committed Dec 4, 2023
1 parent 3bfaf80 commit 4e3dc65
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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()
Expand All @@ -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
);

Expand Down

0 comments on commit 4e3dc65

Please sign in to comment.