Rules › Solidity
ERC-20 transfer result ignored
Some tokens return false instead of reverting; use SafeERC20 or check the returned bool.
Why it matters
The ERC-20 standard says transfer and transferFrom return a bool, but some tokens return false instead of reverting on failure, and some (USDT among them) return nothing at all, which breaks a plain require(token.transfer(...)) at the ABI level. SafeERC20 handles all of these.
Vulnerable
function pay(address to, uint256 amount) external {
token.transfer(to, amount);
}
Fixed
using SafeERC20 for IERC20;
function pay(address to, uint256 amount) external {
token.safeTransfer(to, amount);
}
What other tools call it
| Tool | Detector or reference |
|---|---|
| Slither | unchecked-transfer |
| Aderyn | unsafe-erc20-functions |
| SWC registry | SWC-104 |
Check your code
Paste a contract into the in-browser checker, or let the Claude Code plugin scan before every deploy. The quick check for this rule is a pattern match: treat a hit as "look here", and a miss as no guarantee.
Related rules
- tx.origin used for authorization
- State written after an external call (reentrancy)
- Return value of a low-level call is ignored
- delegatecall to an address the caller controls
- Initializer anyone can call
- Privileged function without access control
Static analysis finds known bug classes; it can't prove code is safe and isn't an audit. Get a professional audit before deploying code that will hold value.