Example contracts demonstrating SolScript features, organized from beginner to advanced.
Start here if you're new to SolScript or smart contract development.
| Example | Description | Key Features |
|---|---|---|
| hello-world | Your first contract | State variables, constructor, functions |
| simple | Basic state management | Public variables, view functions |
| counter | Counter with ownership | Events, errors, modifiers, access control |
| storage | Storage patterns | Data types, mappings, arrays, loops |
Build on the basics with more complex patterns.
| Example | Description | Key Features |
|---|---|---|
| token | ERC20-style token | Transfers, approvals, minting, burning, pausable |
| voting | Voting system | Structs, enums, time-based logic, weighted votes |
| multisig | Multi-signature wallet | Multi-party coordination, transaction lifecycle |
Complex DeFi and NFT patterns.
| Example | Description | Key Features |
|---|---|---|
| escrow | Trustless escrow | State machine, disputes, deadlines |
| nft | NFT collection | ERC721 pattern, metadata, minting |
| staking | Staking pool | Time-based rewards, APR calculation, compounding |
| amm | Automated market maker | Constant product formula, LP tokens, swaps |
Each example can be built and tested with:
# Navigate to example
cd <example-name>
# Check the contract
solscript check <name>.sol
# Build to BPF
solscript build <name>.sol
# Deploy to devnet
solscript deploy <name>.sol --cluster devnetUse solscript new to create a new project from a template:
# List available templates
solscript new --list
# Create from template
solscript new my-project --template counterAvailable templates: simple, counter, token, voting, escrow, nft
Week 1: Foundations
- hello-world - Understand contract structure
- simple - Learn state management
- counter - Add events and access control
- storage - Master data types
Week 2: Token Patterns 5. token - Build a fungible token 6. nft - Create an NFT collection
Week 3: Governance & Security 7. voting - Implement governance 8. multisig - Multi-party security 9. escrow - Trustless transactions
Week 4: DeFi 10. staking - Yield generation 11. amm - Decentralized exchange