Solidity by Example
v 0.8.3
an introduction to Solidity with simple examples
2021/11/04 - Update array examples
2021/10/26 - Dutch Auction
2021/10/22 - English Auction
- Hello World
- First App
- Primitive Data Types
- Variables
- Constants
- Immutable
- Reading and Writing to a State Variable
- Ether and Wei
- Gas and Gas Price
- If / Else
- For and While Loop
- Mapping
- Array
- Enum
- Structs
- Data Locations - Storage, Memory and Calldata
- Function
- View and Pure Functions
- Error
- Function Modifier
- Events
- Constructor
- Inheritance
- Shadowing Inherited State Variables
- Calling Parent Contracts
- Visibility
- Interface
- Payable
- Sending Ether - Transfer, Send, and Call
- Fallback
- Call
- Delegatecall
- Function Selector
- Calling Other Contract
- Creating Contracts from a Contract
- Try / Catch
- Import
- Library
- Hashing with Keccak256
- Verifying Signature
Applications
- Multi Sig Wallet
- Merkle Tree
- Iterable Mapping
- ERC20
- Precompute Contract Address with Create2
- Minimal Proxy Contract
- Uni-directional Payment Channel
- Bi-directional Payment Channel
- English Auction
- Dutch Auction
Hacks
- Re-Entrancy
- Arithmetic Overflow and Underflow
- Self Destruct
- Accessing Private Data
- Delegatecall
- Source of Randomness
- Denial of Service
- Phishing with tx.origin
- Hiding Malicious Code with External Contract
- Honeypot
- Front Running
- Block Timestamp Manipulation
- Signature Replay
- Bypass Contract Size Check