The swap function will fail for fee-on-transfer input tokens. This is because the parameter amountIn will decrease when a transaction will be done on the input token.
For example, say the user has USDT or STA token (fee-on-transfer tokens) as input token for swap. The user has specified the swap amount as X. Due to which, the amountIn parameter is calculated as (X-Y) amount, where Y is the swap fee. Now, before performing the actual swap, the swap fee Y is transferred. As these tokens incur fee, when transfer functions are called, so this leads to a decrease in the amount of remaining tokens, which is less than the calculated amountIn amount.
As a result of this the safeApprove function fails, because the amount that it was trying to approve was amountIn , but in reality the amount that was remaining is less than amountIn.
Hence when such fee-on-transfer tokens are used, the swap function will always revert.
The protocol doesn't support fee on transfer tokens like USDT or STA
Swap function will always fail for fee-on-transfer tokens
Manual review
Before approving the calculated amount, check the current balance, and accordingly approve the current amount.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.