Skip to content

Integer Overflow / Underflow (pre-0.8 or unchecked)

SAFE-0016 Arithmetic Checked automatically by the scanner
1

What goes wrong

Arithmetic wraps around its type bounds. Before Solidity 0.8 this is silent; in 0.8+ it can still occur inside `unchecked` blocks or via casts, corrupting balances and allowing free mints.

2

How to fix it

the pattern that is safe
// Solidity 0.8+: checked by default
function transfer(address to, uint256 v) external {
    require(balances[msg.sender] >= v, "insufficient");
    balances[msg.sender] -= v;
    balances[to] += v;
}
BeautyChain (BEC) overflow. Use 0.8+ or SafeMath; audit unchecked.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0016 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs