The TokenManager::withdraw
function relies on Rescuable::_safe_transfer_from
to transfer tokens using the transferFrom
method. However, this function reverts for tokens like USDT, which don’t return a boolean success value, making it impossible for users to withdraw these tokens.
The function TokenManager::withdraw
uses the method transferFrom of the underlying function Rescuable::_safe_transfer_from
to transfer tokens to the users. As currently designed, this underlying function reverts if the token the user attempts to withdraw does not return a boolean success value, as shown below:
This behavior is incompatible with certain tokens, such as USDT, which do not return a boolean on transferFrom, resulting in users being unable to withdraw these tokens from the protocol.
This issue results in a complete inability for users to withdraw affected tokens, leading to the loss of access to their funds. Tokens remain stuck in the contract, rendering them unusable.
Manual code review.
To avoid this issue, consider using OpenZeppelin’s SafeERC20::safeTransferFrom
function, which accounts for tokens that do not return a boolean success value. Link to OpenZeppelin’s implementation: SafeERC20.sol
I believe the issues and duplicates do not warrant low severity severity as even if the call to transfers returns false instead of reverting, there is no impact as it is arguably correct given there will be insufficient funds to perform a rescue/withdrawal. This will not affect `tillIn()` as there are explicit balance [checks that revert accordingly](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/TokenManager.sol#L255-L260) to prevent allowing creation of offers without posting the necessary collateral
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.