Skip to main content
Solidity Bug Hunt Medium +20 XP

Missing Event Emit

This transfer function updates state but breaks off-chain tracking.

SolidityFind the bug
1function transfer(address to, uint amt) external {
2 balances[msg.sender] -= amt;
3 balances[to] += amt;
4}
The bug is on line 3

Select the correct fix

Show answer and explanation

Answer: Emit a Transfer event

Events are essential for off-chain apps to track state changes. The ERC-20 standard requires emitting Transfer events.

Hint: How do DApps track blockchain state changes?

What this challenge tests

Bug Hunt in Solidity: events, erc20.

Related challenges