If non-compliant ERC20 tokens are added in future as collateral (like USDT), then protocol may not be able to handle the transfers.
The protocol use transfer
and transferFrom
to transfer collateral token. It also verifies that its return value is true
:
For WETH and WBTC, if transfer doesn't revert, success
is always true. Hence this check can be skipped to save gas. However, if we want to add other collateral tokens in future, it's recommended to use OpenZeppelin's SafeERC20
library which accommodates non-compliant ERC20 tokens. For example, USDT which doesn't return anything on a successful transfer.
Manual review.
Use OpenZeppelin's SafeERC20
library to handle ERC20 transfer. Add the following at the top of the contract:
Now replace .transfer
and .transferFrom
with .safeTransfer
and .safeTransferFrom
. For instance:
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.