The RebateFiHook contract does not specify eligible ERC20 tokens assuming that any ERC20 token may be used as a pool token. There are weird ERC20 tokens that will not revert on failed transfer, but will return false instead. Some tokens (e.g. Tether Gold) will return false even when transfer was succesful.
There is no check of returned value for ERC20 token transfer in RebateFiHook::withdrawTokens function. Even if the check was there, it is known that some tokens (e.g. Tether Gold) will return false even when transfer was succesful.
Likelihood:
The issue will occur when attempting to withdraw ERC20 tokens that return false on transfer or do not return any bool by design.
Impact:
Attempt to transfer ERC20 tokens with missing return values will revert even though a transfer itself was succesful.
Attempt to transfer ERC20 tokens with returned false will not revert RebateFiHook::withdrawTokens function and the TokensWithdrawn event will be emitted but no withdrawal occurred.
These weird tokens will be locked in the RebateFiHook contract.
Here is a test attempting to withdraw USDT and MockERC20:
USDT is missing return bool, so ERC20's transfer will fail even when the transfer was succesful, i.e. the ERC20's Transfer event was emitted. This occurs because ERC20 interface expects a bool return value from USDT transfer function.
MockERC20 token returns false on ERC20 transfer but RebateFiHook::withdrawTokens does not revert and emits TokensWithdrawn event, pretending that withdraw was succesful. The balances of RebateFiHook and owner stay the same after withdrawal, i.e to transfer occured.
Add the following test TestReFiSwapRebateHook::test_WithdrawWeirdTokenand and MockERC20FailsOnTransfer to the TestReFiSwapRebateHook.sol and run it on mainnet fork:
Use a safe transfer library like OpenZeppelin SafeERC20 to ensure consistent handling of ERC20 return values and abstract over inconsistent ERC20 implementations.
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.