MorpheusAI

MorpheusAI
Foundry
22,500 USDC
View results
Submission Details
Severity: low
Invalid

Unsafe use of `transfer()/transferFrom()` with `IERC20`

Summary

Some tokens do not implement the ERC20 standard properly but are still accepted by most code that accepts ERC20 tokens. For example, Tether (USDT)'s transfer() and transferFrom() functions on L1 do not return booleans as the specification requires, and instead have no return value.

File: contracts/mock/SwapRouterMock.sol
9: IERC20(params_.tokenIn).transferFrom(msg.sender, address(this), params_.amountIn);
10: IERC20(params_.tokenOut).transfer(params_.recipient, params_.amountIn);
File: contracts/mock/GatewayRouterMock.sol
15: IERC20(_token).transferFrom(msg.sender, _to, _amount);
File: contracts/mock/tokens/WStETHMock.sol
25: stETH.transferFrom(msg.sender, address(this), stETHAmount_);

Recommendations

Consider using OpenZeppelin’s SafeERC20's safeTransfer()/safeTransferFrom() instead.

Updates

Lead Judging Commences

inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.