The _transfer function in TokenManager.sol fails with fee-on-transfer tokens like PAXG and STA because the actual balances after transfer don't match the expected values, causing errors. This flaw also breaks the tillIn function, which depend on _transfer.
The _transfer function in the TokenManager.sol contract is unable to handle fee-on-transfer tokens such as PAXG and STA. These tokens deduct a fee during transfers, which causes the expected balances to differ from the actual balances. Specifically, the conditions fromBalanceAft != fromBalanceBef - _amount and toBalanceAft != toBalanceBef + _amount are not met, resulting in an error that prevents the function from operating correctly.
src/core/TokenManager.sol:_transfer_L255-L261
Since the tillIn function within TokenManager.sol rely on _transfer, this issue causes such functions to fail as well.
src/core/TokenManager.sol:tillIn_L93-L99
The _transfer function's inability to process fee-on-transfer tokens leads to a failure in executing related functions such as tillIn, making these operations impossible to perform within the contract.
Manual Review
It is recommended to check the balance of Token before and after the transfer to see how much tokens were received to handles fee on transfer tokens.
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.