Fee on transfer tokens may revert the transaction if the remainder is less than fee amount
Summary
Fee on transfer tokens may revert the transaction if the remainder is less than fee amount
Root Cause
In AmirX::_buyBack function, if the fee token is fee on transfer token, then the transaction may be reverted due to remainder.
_buyback function is used for converting fee tokens to telcoin and sweep the remaining balance to defi safe. But it's missing a potential scenario when we use fee on transfer token as fee token, it's possible to see small differences between the amount in aggregator's swap call.
TessKimy
Medium
Fee on transfer tokens may revert the transaction if the remainder is less than fee amount
Summary
Fee on transfer tokens may revert the transaction if the remainder is less than fee amount
Root Cause
In AmirX::_buyBack function, if the fee token is fee on transfer token, then the transaction may be reverted due to remainder.
_buyback
function is used for converting fee tokens to telcoin and sweep the remaining balance to defi safe. But it's missing a potential scenario when we use fee on transfer token as fee token, it's possible to see small differences between the amount in aggregator's swap call.It's possible to meet following condition:
remainder < fee on transfer fee
In conclusion, whole transaction will be reverted in feeToken implementation.
Internal pre-conditions
Attack Path
_buyBack
is triggeredImpact
Medium - The whole defi swap transaction is reverted and DoS is happened. All the function which contains defi swap functionality is affected.
Mitigation
In the sweep functionality, we can use try-catch mechanism to avoid revert on transfer