Tadle

Tadle
DeFi
30,000 USDC
View results
Submission Details
Severity: medium
Valid

TokenManager.sol::_transfer doesn’t allow transferring of fee-on-transfer tokens and will make tillIn and withdraw revert

Summary

TokenManager.sol::_transfer doesn’t allow transferring of fee-on-transfer tokens

Vulnerability Details

In TokenManager.sol::_transfer there are check of the balances of the token for the recipient and the sender of the token before and after the token. Unfortunately a problem arises when а fee-on-transfer token is transferred because the fee is not accounted for when checking the balance of the receiver of the token after the transfer. This will make the function to revert. Users won't be able to call tillIn or withdraw with a fee-on-transfer-token

// here the fee amount is not removed from the _amount
if (toBalanceAft != toBalanceBef + _amount) {
revert TransferFailed();
}

Impact

Cannot transfer fee-on-transfer tokens.

Tools Used

Manual Review

Recommendations

If there is a Fee-On-Transfer token calculate the transfer fee and reduce the _amount with the fee when checking the balances of the receiver.

Updates

Lead Judging Commences

0xnevi Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-TokenManager-FOT-Rebasing

Valid medium, there are disruptions to the ability to take market actions. The following functions will be disrupted without the possibiliy of reaching settlement, since the respective offers cannot be created/listed regardless of mode when transferring collateral token required to the CapitalPool contract or when refunding token from user to capital pool during relisting. So withdrawal is not an issue - `createOffer()` - reverts [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L96-L102) - `listOffer()` - reverts [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L355-L362) - `relistOffer()` - reverts [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L515-L521) - `createTaker()` - reverts [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L831-L836) I believe medium severity is appropriate although the likelihood is high and impact is medium (only some level of disruption i.e. FOT tokens not supported and no funds at risk)

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.