BuildBot

State on the Chain

Access control, errors & money

Lesson 3 of 5

Modifiers factor out permission checks, custom errors replace strings, and payable functions let a contract hold ETH. Revert rolls it all back, and the withdraw pattern keeps the money safe.

What you'll learn

  • Write an onlyOwner modifier and a custom error and explain what each costs
  • Accept ETH with payable and pay it out with the pull-based withdraw pattern
  • Show that a revert rolls back state and refunds msg.value
Members only

A free account unlocks this lesson and every other one.

Runnable challenges, knowledge checks, and progress that syncs across your devices. No card needed.

Not sure yet? Try the free lesson first: The EVM mental model