According to Readme and the comments in the codebase, the protocol is expected to work with Erc20 tokens. However TokenManager.sol does not properly support tokens that implement a fee on transfer.
The withdraw function is intended to handle both native and erc20 tokens.
The logic in the withdraw function assumes that claimAbleAmount will be transferred to the user by _safe_transfer_from. However, if the token is a fee-on transfer token, the actual amount received by the user will be less due to the fee deducted.
NOTE: Also tillIn function has the similar issue. In this function, a call is made to _transfer, which records the balances of both the sender (_from) and the recipient (_to) before the transfer. It then checks whether the balances of sender and recipient have changed by exactly the amount specified.
Due to the checks here , the function will be reverted, which means whenever FoT token is involved user deposits will not work as intended.
The protocol will be incompatible with any FoT tokens and users will be affected accordingly
Manual review, Vs Code
I would recommend checking balance of msg.sender for the _tokenAddress before and after the transfer so that the actual amount received (by user or capital pool) after the fee is applied.
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.