Tokens¶
Token standards are interfaces, not deployed code. This section explains ERC-20, ERC-721, and ERC-1155 through their actual function signatures and events, building working, compiled implementations rather than describing the standards in the abstract. Every interface and non-trivial contract in this section has been compiled with solc 0.8.26 and confirmed to build cleanly; the WETH example's real deployed address was verified live, on-chain.
What you need to know first¶
Smart Contracts, especially Mappings and Events and Logs. Token contracts are, mechanically, mappings tracked via the patterns that section already covered.
Chapters¶
- ERC-20: the fungible token interface, with a full working implementation
- Balances: why a balance is just a mapping, verified against a real token's live decimals
- Transfers: transfer vs. transferFrom, and the trust distinction between them
- Allowances and Approvals: the approve race condition, and why unlimited approvals are a real risk
- ERC-721: non-fungible tokens, and the safeTransferFrom check ERC-20 lacks entirely
- ERC-1155: one contract, many token types, and the batching efficiency that motivated it
- NFT Metadata: tokenURI, and the real gap between on-chain permanence and off-chain availability
- Minting and Burning: the zero-address convention, and why minting access control matters enormously
- Wrapped Assets: the lock-and-mint pattern, and WBTC's custodial trust model stated plainly
- Wrapped Ether: a complete, compiled WETH contract, with its real mainnet address verified live
- Token Supply: why "fixed supply" is only as trustworthy as the code enforcing it
Next¶
Continue to Building Web3 Applications, where these same token interfaces get called from ordinary TypeScript applications, reading balances, decoding events, and sending transactions against real, live contracts.