Solidity案例汇总
目录
- 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
- ABI Encode
- ABI Decode
- Hashing with Keccak256
- Verifying Signature
- Gas Optimizations
- Bitwise Operators
Applications
- Ether Wallet
- Multi Sig Wallet
- Merkle Tree
- Iterable Mapping
- ERC20
- ERC721
- Precompute Contract Address with Create2
- Minimal Proxy Contract
- Upgradeable Proxy
- Deploy Any Contract
- Write to Any Slot
- Uni-directional Payment Channel
- Bi-directional Payment Channel
- English Auction
- Dutch Auction
- Crowd Fund
- Multi Call
- Multi Delegatecall
- Time Lock
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
Tests
DeFi
- Uniswap V2 Swap
- Uniswap V2 Add Remove Liquidity
- Uniswap V2 Optimal One Sided Supply
- Uniswap V2 Flash Swap
- Uniswap V3 Swap
- Uniswap V3 Liquidity
- Uniswap V3 Flash Loan
- Uniswap V3 Flash Swap Arbitrage
- Chainlink Price Oracle
- Staking Rewards
- Vault
- Constant Sum AMM
- Constant Product AMM
- Stable Swap AMM
来自:https://solidity-by-example.org/
如果你觉得这篇文章对你有所帮助,欢迎赞赏~
赞赏