๐ About This Reference
Each contract in this repo isolates a single Solidity concept with clean, commented code and corresponding Hardhat tests. Built during an intensive blockchain developer bootcamp โ think of it as a Solidity cookbook where every chapter is a standalone, copy-ready recipe.
๐ Contract Modules
Types.sol
uint, int, bool, address, bytes โ the full value type system with examples.
Variables.sol
State, local, and global variables. Visibility modifiers: public, private, internal, external.
Functions.sol
Pure, view, payable. Return values, function modifiers, and overloading.
Conditionals.sol
if/else, ternary, require, revert, and custom error patterns.
Loops.sol
for, while, do-while โ with gas cost considerations for unbounded loops.
Operators.sol
Arithmetic, logical, bitwise, comparison, and assignment operators.
Arrays.sol
Fixed and dynamic arrays, push/pop/delete, memory vs. storage location.
Mappings.sol
Key-value stores, nested mappings, and enumeration limitations.
Structs.sol
Custom data types, struct arrays, and efficient storage packing.
Enums.sol
Enumerated types for state machines โ the clean way to track lifecycle states.
Constructors.sol
Initialization, constructor arguments, ownership, and one-time setup patterns.
Events.sol
Emitting events, indexed parameters, and frontend subscription patterns.
Errors.sol
Custom errors, require vs. revert, and the gas savings of custom error types.
Inheritance.sol
is keyword, virtual/override, multiple inheritance, and super.
Ether.sol
msg.value, payable, transfer/send/call โ and the receive/fallback function pair.
Time.sol
block.timestamp, time-based access control, and expiry patterns.
Token.sol
A manual ERC-20 implementation from scratch โ no OpenZeppelin, pure Solidity.
Interactions.sol
Calling external contracts, interfaces, and low-level call patterns.