Skip to main content
Solidity Code Reorder Hard +35 XP

ERC-20 Transfer

Arrange the safe ERC-20 transfer logic.

Click lines in the correct order

Available lines4 left

Your order

Click lines above to build your solution.

Show answer and explanation

Answer: require(balances[msg.sender] >= amount, "Insufficient"); balances[msg.sender] -= amount; balances[to] += amount; emit Transfer(msg.sender, to, amount);

Check first (require), then update state (effects), then emit event. Follows checks-effects-interactions.

Hint: Check, then update state, then emit.

What this challenge tests

Code Reorder in Solidity: erc20, patterns.

Related challenges