Your First 90 DaysAcademy
First Contact · What a Contract Even Is · Week 2 · Checkpoint 5

When It Says No

A contract refusing to act is not an error, it is an undo. Read OpenZeppelin's Pausable end to end: one boolean, two gates, two named errors, and the four ways of saying no you have now met across five real contracts.

14 steps~27 min3 nodes for your map
01 · A contract that only knows how to say no

Your fifth contract, and the smallest idea in the course so far. OpenZeppelin's Pausable holds no tokens, moves no value, and owns nothing. Its entire job is to give another contract the ability to refuse, and to make that refusal readable to whoever asked.

One hundred and twelve lines, and the shape will feel familiar within seconds, because it is built exactly like the Ownable you read in week one. What is new is the subject. This lesson is about the moment a contract says no, and what that moment actually does.

02 · The shape you already know

Nothing here is new. A licence comment, a release stamp, the caret version that accepts 0.8.20 and anything later in the series, an import naming Context, and an abstract contract built on it. Line for line, this is the opening of Ownable.

That is worth noticing rather than skipping. A whole family of files shares this shape, so once you can read the first six lines of one of them you can read the first six lines of all of them. Move fast here. The interesting part starts at line 18.

03 · Everything it remembers

One state variable. A `bool`, which holds one of exactly two values, marked `private` so no other Solidity code reaches it directly. Every refusal in this file turns on that single bit, and there is nothing else stored anywhere in it.

Two things follow from the type alone. It starts out `false`, because that is what an unset boolean is, so a fresh contract is not paused. And it can never record who flipped it, or when, because one bit has no room for either fact.

04 · The two announcements

Two events, one for each direction, and both carry an address: the account that did it. The state block could not hold that fact, so the file puts it somewhere else, into the log, where anything watching from outside can read it afterwards.

Hold them against the event you read in Ownable, which marked its addresses `indexed`. These two do not. Indexing makes a field searchable by anything filtering the log, and these two announcements are simply not written that way.

05 · Two named refusals

Two custom errors, the same construction you met in Ownable: a named failure type the contract can raise instead of stopping with a message. Notice the empty parentheses. Unlike `OwnableUnauthorizedAccount`, neither of these carries any data at all.

`EnforcedPause` is the obvious one, raised when something is attempted while the contract is paused. The second name is less obvious, and it is worth predicting before you read on.

The file declares a second error, ExpectedPause. Given that the first one covers acting while paused, what is this one for?
your balance2,400
BANK_DBowner: the bank
you2,400
what the app is actually showing you
BANK_DBowner: the bank
you2,400their pen
you hold a claim. they hold the pen.
your digital life
BANK · you2,400the bank ✍
INSTAGRAM · you2.1M followersMeta ✍
STEAM · you134 gamesValve ✍
AIRLINE · you58,200 milesthe airline ✍
four tables. zero pens that are yours.
BANK_DBowner: the bank
you2,400
DENIED
try both pens
PLATFORM_DBowner: the platform
her · 8 years2,000,000 followers
one automated decision away
BANK_DB · you · 2,400intentcompetencecontinuity
your row stands on all three
FTX_DBowner: FTX
you5 BTC
the backing vault●●●●●
the row stayed. the backing did not.
CARD_DBowner: your bank ✍
TV you never bought−1,100
fraud reversal+1,100
someone holds the pen, so someone can fix it
?_DBowner: nobody
youstill yours?
?
can a table exist that nobody owns?
?
?_DBowner: ̶n̶o̶b̶o̶d̶y̶
you100
no owner, no pen, no trust?
keeper 1
you100
keeper 2
you100
keeper 3
you100
keeper 4
you100
keeper 5
you100
no THE copy, only copies.
keeper 2
you100
keeper 3
you100
keeper 4
you100
keeper 5
you100
your copy
you100
five copies. one of them is yours.
one attacker
one attacker, ten thousand faces.
real machinesburned wattsnext page, sealed
writing costs watts. faking voters buys nothing.
cost paid OUTSIDE: hardware and power
proof of work, burn energy to vote.
page 1you · 100page 2you · 100page 3you · 100page 4you · 100
rewrite one line, break every lock after it.
office lunchtrusted keeperconsensusfive keepers, real cost
the price buys trustlessness. the office already has trust.
?
ownerless ledger
you?
a key, not a login?
nobody owns the table. so who owns your row?
revertcustom errorsstate gates

Three new nodes on your map

revert · custom errors · state gates · +10 Lynx