Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Commit

Permalink
fix: isQuoteSellAmountBelowMinimum (#1235)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xApotheosis authored Apr 10, 2023
1 parent 659cbcf commit ac5f2c6
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export async function getCowSwapTradeQuote(
},
} = quoteResponse

const quoteSellAmountPlusFeesCryptoBaseUnit = bnOrZero(sellAmountCryptoBaseUnit).plus(
feeAmountInSellTokenCryptoBaseUnit,
)

const buyCryptoAmount = bn(buyAmountCryptoBaseUnit).div(
bn(10).exponentiatedBy(buyAsset.precision),
)
Expand Down Expand Up @@ -143,7 +147,9 @@ export async function getCowSwapTradeQuote(

const feeData = feeDataOptions['fast']

const isQuoteSellAmountBelowMinimum = bnOrZero(sellAmountCryptoBaseUnit).lt(minQuoteSellAmount)
const isQuoteSellAmountBelowMinimum = bnOrZero(quoteSellAmountPlusFeesCryptoBaseUnit).lt(
minQuoteSellAmount,
)
// If isQuoteSellAmountBelowMinimum we don't want to replace it with normalizedSellAmount
// The purpose of this was to get a quote from CowSwap even with small amounts
const quoteSellAmountCryptoBaseUnit = isQuoteSellAmountBelowMinimum
Expand Down

0 comments on commit ac5f2c6

Please sign in to comment.