The TokenManager contract does not properly account for fee-on-transfer tokens, which could lead to transaction failures and accounting discrepancies if such tokens are used.
The contract assumes that when transferring tokens, the full amount sent will be received by the recipient. This assumption is evident in the _transfer
function, which checks for exact balance changes:
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/TokenManager.sol#L252
For fee-on-transfer tokens, these checks would fail because the recipient receives less than the sent amount due to transfer fees.
Transaction Failures: If a fee-on-transfer token is whitelisted and used, functions like tillIn
and withdraw
could fail due to the strict balance checks in _transfer
.
Accounting Discrepancies: The contract doesn't account for the possibility of receiving fewer tokens than expected, which could lead to incorrect balance tracking.
Potential Fund Lock: In severe cases, this could lead to funds being locked and DoS in the contract if transfers consistently fail.
Manual Review
Modify balance checks for discrepancy
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)
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.