Skip to content

Commit

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

Expand Down

0 comments on commit d91e277

Please sign in to comment.