Lesson 1Common contract patterns: Ownable, Pausable, ReentrancyGuard, Pull over Push payments, Checks-Effects-Interactions patternWe look at basic smart contract patterns that enhance safety and ease of maintenance. You will create Ownable, Pausable, and ReentrancyGuard, and use Pull over Push and Checks-Effects-Interactions in actual payment processes to ensure reliability.
Implementing and using Ownable access controlPausable contracts and emergency stopsReentrancyGuard and reentrancy attack defensePull over Push payment flow designChecks-Effects-Interactions best practicesLesson 2Safe math and overflow protections in Solidity 0.8+: built-in checks vs. explicit libraries (OpenZeppelin SafeMath history)We examine how Solidity 0.8+ includes automatic overflow checks to improve arithmetic safety. Compare old SafeMath libraries with new methods, and understand when to use unchecked blocks safely for better gas efficiency in operations.
Integer overflow and underflow fundamentalsBuilt-in arithmetic checks in Solidity 0.8+Legacy SafeMath libraries and migrationUsing unchecked blocks safely for gasTesting arithmetic edge cases and limitsLesson 3State variables, storage vs memory, events, modifiers, and error handling (require, revert, assert, custom errors)Gain mastery in how Solidity manages data with state variables, storage, memory, and calldata. Learn to send events, create reusable modifiers, and use require, revert, assert, and custom errors for effective error management in contracts.
State variables and storage slotsStorage vs memory vs calldata usageDesigning and emitting useful eventsWriting reusable and safe modifiersRequire, revert, assert, and custom errorsLesson 4Function visibility and mutability: public, external, internal, private; view, pure, payableUnderstand how function visibility and changeability impact security, gas costs, and ease of use. Learn to choose public, external, internal, or private, and see how view, pure, and payable affect state updates and value movements.
Public vs external function trade-offsInternal and private for encapsulationView and pure for read-only logicPayable functions and ETH transfersDesigning clear and safe APIsLesson 5Designing deposit/withdraw accounting: mapping(address => uint256) balances, events for deposits/withdrawals, handling multiple tokens vs single-token vaultsDiscover how to create secure deposit and withdrawal systems using mappings, events, and token interfaces. Compare single-token and multi-token vaults, and manage challenges like failed transfers and unusual token actions.
Mapping balances and accounting invariantsEmitting events for deposits and withdrawalsSingle-token vault design and interfacesMulti-token vaults and token identifiersHandling failed transfers and token quirksLesson 6Testing smart contracts: unit testing concepts, fixtures, mocks for ERC-20 tokens, and test structure (arrange-act-assert)Learn structured testing for smart contracts. You will develop unit tests, apply fixtures and mocks for ERC-20 tokens, use arrange-act-assert, and test edge cases, failures, and event outcomes thoroughly.
Testing frameworks and project setupArrange-Act-Assert test structureUsing fixtures for repeatable stateMocking ERC-20 tokens and behaviorsTesting reverts, events, and edge casesLesson 7Solidity language basics: syntax, types, visibility, inheritance, and compiler pragmas (0.8.x specifics)Develop a strong understanding of Solidity syntax, types, and visibility rules. Explore inheritance, interfaces, compiler settings, and 0.8.x features like custom errors and better type safety for contemporary smart contract building.
Source files, contracts, and basic syntaxValue types, reference types, and arraysFunction and state variable visibilityInheritance, interfaces, and abstract contractsCompiler pragmas and 0.8.x language changesLesson 8Contract upgradeability basics and trade-offs: proxy patterns (transparent, UUPS) and when to avoid upgrades for simple vaultsGrasp when and how to update contracts with proxy patterns. Compare transparent and UUPS proxies, storage rules, and management risks, and learn why basic vaults might be more secure without upgrades.
Why upgrade contracts and when to avoid itTransparent proxy architecture and rolesUUPS proxy pattern and upgrade functionsStorage layout compatibility and pitfallsSecurity and governance risks of upgradesLesson 9Gas optimization basics: storage layout, packing, minimizing external calls, and using calldataAcquire practical ways to reduce gas in Solidity contracts. Analyze storage arrangement and packing, cut costly external calls, use calldata, and track gas to support safe small improvements.
Understanding gas costs and refundsStorage layout and variable packingMinimizing external and cross-contract callsUsing calldata for cheap read-only inputsMeasuring and benchmarking gas usageLesson 10ERC-20 token standard deep dive: interfaces (IERC20), allowances, approve/transferFrom semantics, return value handling and non-standard tokensDelve into ERC-20 standards, emphasizing IERC20 interface, balances, allowances, and approve/transferFrom processes. Handle return values, unusual tokens, and safe interaction methods for live contracts.
IERC20 interface and required functionsBalances, totalSupply, and decimals handlingApprove and transferFrom allowance workflowDealing with non-standard ERC-20 tokensSafe ERC-20 interactions with helper libraries