Your First 90 DaysAcademy
Fluent Reading · Any Contract, Cold · Week 10 · Checkpoint 22

An Dialect Older

Two hundred and one lines of Uniswap V2, written in a version of Solidity that is not the one you have been reading. A pinned pragma, a library for addition, two reserves packed beside a clock, and a swap that sends the tokens out before it works out what came in.

16 steps~32 min3 nodes for your map
01 · Two hundred and one lines, cold

Two hundred and one lines, and this file is the core of Uniswap V2. Every pair of tokens that ever traded through it runs this exact text. The act opens the way the rest of it will go: a real file, read cold, with nothing arranged for you in advance.

Read it the way you would open an unfamiliar file at work. Find the declarations, work out what is stored, then walk the functions in the order they matter. The vocabulary is all behind you. What is ahead is a version of the language you have not read yet.

02 · A pin, and a file you have already read

Line 1 pins one compiler with an equals sign rather than a caret. Every contract you have read so far has been in the 0.8 series. This one is 0.5, and most of the code deployed on chain was written under rules that are not the ones you know.

Now read line 11. `UniswapV2ERC20` is the file you went through line by line in checkpoint three, all ninety four of them, unchanged. The token you took apart in week two turns out to be half of a contract that has held billions.

03 · A library for addition

Line 12 attaches a library to `uint`, so a sum anywhere in this file is written `x.add(y)`. Line 13 does the same for a fixed point type you will meet at line 79. A library that exists in order to do addition is worth stopping on.

Ask why a contract would need to import addition. You learned in checkpoint two that from 0.8 onward the compiler checks arithmetic itself. Line 1 says this file is older than that. Work out what `add` is doing that a plain `+` is not.

Line 12 lets a plain addition be written `x.add(y)`. Under the compiler line 1 pins, what does that actually buy the file?
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?
older dialectspacked slotsout before in

Three new nodes on your map

older dialects · packed slots · out before in · +10 Lynx