Skip to content

Commit

Permalink
fix: remove amounts nearly equal check (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
philbow61 authored Jan 14, 2025
1 parent 0b58844 commit f6a8f21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/features/swap/useFormValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Tokens, getTokenAddress, getTokenByAddress } from 'src/config/tokens'
import { AccountBalances } from 'src/features/accounts/fetchBalances'
import { getMentoSdk } from 'src/features/sdk'
import { SwapFormValues } from 'src/features/swap/types'
import { areAmountsNearlyEqual, parseAmount, toWei } from 'src/utils/amount'
import { parseAmount, toWei } from 'src/utils/amount'
import { logger } from 'src/utils/logger'
import { useChainId } from 'wagmi'

Expand All @@ -23,7 +23,7 @@ export function useFormValidator(balances: AccountBalances, lastUpdated: number
const tokenId = values.fromTokenId
const tokenBalance = balances[tokenId]
const weiAmount = toWei(parsedAmount, Tokens[values.fromTokenId].decimals)
if (weiAmount.gt(tokenBalance) && !areAmountsNearlyEqual(weiAmount, tokenBalance)) {
if (weiAmount.gt(tokenBalance)) {
return { amount: 'Amount exceeds balance' }
}
const { exceeds, errorMsg } = await checkTradingLimits(values, chainId)
Expand Down

0 comments on commit f6a8f21

Please sign in to comment.