The _transfer function incorrectly assumes that the balance of the sender and receiver will change exactly by the amount being transferred. This assumption is flawed, particularly when dealing with ERC-20 tokens that implement fee-on-transfer mechanisms or other non-standard behaviors. This oversight could lead to unexpected reverts and failures in token transfers, potentially disrupting the contract's functionality.
The function performs strict equality checks for both the sender's and receiver's balances, which does not account for tokens with fee-on-transfer mechanisms
In cases where a token applies a transfer fee, the balance checks will fail, causing the transfer to revert even though it was successful from the token's perspective.
Incorrect balance checks can cause token transfers to fail, especially with tokens that have non-standard behaviors like fees on transfers. This can disrupt contract functionality, lead to failed transactions, and limit compatibility with a range of ERC-20 tokens.
Update the balance checks to account for potential discrepancies due to fees or other deductions. The checks should ensure that the balance changes are at least as expected but allow for additional reductions due to token-specific behaviors.
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.