Skip to content

Commit

Permalink
Merge pull request #74 from compolabs/fix/token-approve-decimals
Browse files Browse the repository at this point in the history
ToDecima Places round up  added for the  input during approvement
  • Loading branch information
PaulZhemanov authored Feb 26, 2024
2 parents 9e1ae41 + 4f8bf29 commit d84389c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { PropsWithChildren, useMemo } from "react";
import BigNumber from "bignumber.js";
import { ethers } from "ethers";
import _ from "lodash";
import { makeAutoObservable, reaction } from "mobx";
Expand Down Expand Up @@ -212,7 +213,7 @@ class CreateOrderSpotVM {
const quoteToken = market.quoteToken;

const activeToken = this.isSell ? baseToken : quoteToken;
const approveAmount = this.isSell ? this.inputAmount : this.inputTotal;
const approveAmount = (this.isSell ? this.inputAmount : this.inputTotal).toDecimalPlaces(0, BigNumber.ROUND_UP);

this.setLoading(true);

Expand All @@ -225,6 +226,7 @@ class CreateOrderSpotVM {

notificationStore.toast(`${activeToken.symbol} approved!`, { type: "success" });
} catch (error) {
console.error(error);
notificationStore.toast(`Something goes wrong with ${activeToken.symbol} approve`, { type: "error" });
}

Expand Down

0 comments on commit d84389c

Please sign in to comment.