shapeshift / lib

MIT License
22 stars 54 forks source link

fix: isQuoteSellAmountBelowMinimum #1235

Closed 0xApotheosis closed 1 year ago

0xApotheosis commented 1 year ago

Existing logic incorrectly assumes that the sellAmountCryptoBaseUnit is the amount not including fees.

In reality, CoW Swap subtracts any trading fees from the sellAmountCryptoBaseUnit value in the returned response, so we need to add them back on to get the true "sell amount" of the sell asset.

This is causing the UI to show that the "sell amount is lower than the fee" when the sell amount is above the minimum by less than the fee amount.

To test, attempt to use CoW swap to trade, say, $21 - this should now work, whereas previously is would not until you sold $20 plus the fee amount.

shapeshift-ci-bot commented 1 year ago

:tada: This PR is included in version @shapeshiftoss/swapper-v17.6.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: