← Theory library
Solidity theory
The EVM contract language — compiled for real with solc in your browser.
Practise in the Code Lab →Easy
- 1. What Solidity isA contract-oriented language compiled to EVM bytecode.
- 2. Value typesbool, uint/int, address, bytesN and enums.
- 3. Variables and visibilityState, local and global variables, and who can read them.
- 4. Functions and visibilitypublic, external, internal, private and how calls arrive.
- 5. view, pure and payableState-mutability modifiers and what they promise.
- 6. Constructor and immutabilityconstructor, immutable and constant.
- 7. Storage, memory and calldataThe three data locations and their costs.
- 8. ArraysFixed and dynamic arrays, push, pop and length.
- 9. MappingsKey/value state, defaults and why you cannot iterate.
- 10. Structs and enumsGrouping related state and modelling states.
- 11. Control flowif, for, while, break and continue in a gas-metered world.
- 12. Errors: require, revert, custom errorsFailing loudly and cheaply.
- 13. ModifiersReusable pre- and post-checks.
- 14. Events and logsHow contracts talk to the outside world.
- 15. msg, tx and blockContext variables you will use in every contract.
- 16. Sending and receiving ETHreceive, fallback, transfer and call.
- 17. Units: wei, gwei, ether and timeBuilt-in unit suffixes.
- 18. Inheritance and overridesis, virtual, override and super.
- 19. Interfaces and abstract contractsTalking to contracts you did not write.
- 20. Libraries and `using ... for`Reusable pure logic and attached functions.
Medium
- 21. Constructors and immutabilitySetting values once at deploy time.
- 22. Custom errors and requireCheap reverts with structured data.
- 23. Events and indexed topicsHow off-chain apps read what happened.
- 24. Sending ETH safelytransfer, send and call — and why call wins.
- 25. ReentrancyThe classic attack and checks-effects-interactions.
- 26. Access control patternsOwnable, two-step transfer and role-based access.
- 27. Modifiers in depthHow `_;` splices code, and when to prefer a function.
- 28. Structs, arrays and mappings togetherModelling records without unbounded loops.
- 29. Storage layout and gasSlots, packing and cold versus warm access.
- 30. Function selectors and the ABIHow calldata identifies a function.
- 31. call, delegatecall and staticcallThree ways to reach other code.
- 33. ERC-20 in detailBalances, allowances and the approve race.
- 34. ERC-721 and ERC-1155Unique tokens and multi-token balances.
- 45. Layer 2s and BaseRollups, calldata costs and cross-chain messaging.
- 48. Frontend integrationWiring a contract to a dApp.
Hard
- 32. Proxies and upgradeabilitySeparating storage from logic.
- 35. Hashing and signatureskeccak256, ecrecover and EIP-712.
- 36. Randomness on chainWhy block data is not random.
- 37. Oracles and price feedsGetting off-chain data safely.
- 38. Building a staking contractAccounting, reward rate and withdrawals.
- 39. Testing with FoundryUnit tests, cheatcodes and fuzzing.
- 40. Testing and deploying with HardhatJavaScript tests, scripts and verification.
- 41. Gas optimisation techniquesWhere the savings actually are.
- 42. Inline assembly and YulWhen to drop to the metal.
- 43. Create2 and deterministic addressesKnowing an address before you deploy.
- 44. MEV, front-running and slippagePublic mempools change how you design.
- 46. Auditing mindsetReading code the way an attacker does.
- 47. Common vulnerability catalogueThe bugs that keep recurring.
- 49. Deployment checklistFrom local test to verified mainnet contract.
- 50. Capstone: reviewing a full protocolPutting every topic together.