Although https://github.com/Cyfrin/2024-08-tadle?tab=readme-ov-file#compatibilities states that this protocol should be compatible with ERC20 (any token that follows the ERC20 standard)
, this protocol actually cannot support the fee-on-transfer ERC20 tokens that follow all specifications of https://eips.ethereum.org/EIPS/eip-20.
When calling the following tillIn
function, _transfer(_tokenAddress, _accountAddress, capitalPoolAddr, _amount, capitalPoolAddr)
would be executed when the _tokenAddress
input is not wrappedNativeToken
.
Then, in the following _transfer
function, _safe_transfer_from(_token, _from, _to, _amount)
is executed. When the corresponding token is a fee-on-transfer ERC20 token, such _safe_transfer_from
function call would transfer a token amount that equals _amount
minus the associated transfer fee to _to
. Since the actual token amount received by _to
is less than _amount
, toBalanceAft != toBalanceBef + _amount
would be true
, and such _transfer
and tillIn
function calls would revert.
This protocol cannot support the fee-on-transfer ERC20 tokens even though such tokens can follow all specifications of https://eips.ethereum.org/EIPS/eip-20. This breaks the requirement that this protocol should be compatible with ERC20 (any token that follows the ERC20 standard)
, which is stated in https://github.com/Cyfrin/2024-08-tadle?tab=readme-ov-file#compatibilities.
Manual Review
https://github.com/Cyfrin/2024-08-tadle/blob/c249cdb68c37c47025cdc4c4782c8ee3f20a5b98/src/core/TokenManager.sol#L259-L261 can be updated to the following code.
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.