Skip to content
low Best Practice No SWC entry CWE-778

No Event on Critical State Change

SAFE-0141 Best Practice Checked automatically by the scanner
1

What goes wrong

A privileged state change (owner, fee, oracle, pause, upgrade) emits no event. Off-chain monitors, block explorers, and users cannot detect the change in real time, delaying incident response to a malicious or mistaken admin action.

2

The vulnerable pattern

proof of concept — how it is exploited
// owner silently calls setOracle(evilOracle) with no event.
// nothing alerts users; the next deposits are priced by the attacker
// before anyone notices.
3

How to fix it

the pattern that is safe
event FeeUpdated(uint256 oldFee, uint256 newFee);
function setFee(uint256 f) external onlyOwner { emit FeeUpdated(feeBps, f); feeBps = f; }
Emit an event on every privileged state transition.
4

Where this has happened

Largest recorded losses in the same failure class — related, not the same bug:

Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0141 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