Write, test, and deploy Ethereum smart contracts with Solidity — the primary language of EVM-compatible chains.
Solidity is a statically typed, contract-oriented language that compiles to EVM bytecode.
Language fundamentals:
- Data types: uint, int, address, bool, bytes, string, arrays, mappings, structs
- State vs memory vs calldata vs stack
- Functions: visibility (public/private/internal/external), pure/view/payable
- Events and indexed parameters
- Modifiers — reusable access control
- Inheritance, interfaces, abstract contracts, libraries
- Error handling: require, revert, custom errors
- Constructor
- Fallback and receive functions
Key patterns:
- OpenZeppelin contracts (ERC-20, ERC-721, ERC-1155, Ownable, AccessControl)
- Upgradeable contracts (Transparent Proxy, UUPS)
- Reentrancy guard
- Pull over push payment pattern
- Checks-Effects-Interactions pattern
Gas optimisation:
- packing structs, using uint8 vs uint256
- Events instead of storage where possible
- Using calldata vs memory
- Avoiding loops over unbounded arrays
Language fundamentals:
- Data types: uint, int, address, bool, bytes, string, arrays, mappings, structs
- State vs memory vs calldata vs stack
- Functions: visibility (public/private/internal/external), pure/view/payable
- Events and indexed parameters
- Modifiers — reusable access control
- Inheritance, interfaces, abstract contracts, libraries
- Error handling: require, revert, custom errors
- Constructor
- Fallback and receive functions
Key patterns:
- OpenZeppelin contracts (ERC-20, ERC-721, ERC-1155, Ownable, AccessControl)
- Upgradeable contracts (Transparent Proxy, UUPS)
- Reentrancy guard
- Pull over push payment pattern
- Checks-Effects-Interactions pattern
Gas optimisation:
- packing structs, using uint8 vs uint256
- Events instead of storage where possible
- Using calldata vs memory
- Avoiding loops over unbounded arrays