Solana Anchor programs for the Scrunchy decentralized game asset marketplace.
This project consists of three Anchor programs:
- Asset Registry (
asset-registry) - Manages game asset creation, metadata, and ownership - Marketplace (
marketplace) - Handles asset listings, rentals, and payment distribution - Access Control (
access-control) - Provides fast ownership/rental verification for SDKs
See INSTALLATION.md for complete setup instructions.
Required tools:
- Rust 1.70+
- Solana CLI 1.18+
- Anchor Framework 0.29+
- Node.js 18+
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install Solana CLI
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
# Install Anchor
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
avm install latest
avm use latestanchor buildanchor test# Set Solana to devnet
solana config set --url devnet
# Get devnet SOL (see docs/AUTO_AIRDROP_GUIDE.md for automated script)
solana airdrop 2
# Deploy programs (or use scripts/deploy-individual.sh for more reliable deployment)
anchor deployNote: For more reliable deployment, use the individual deployment script:
bash scripts/deploy-individual.shSee Deployment Guide for detailed instructions.
- Asset Registry:
AssetRegistry11111111111111111111111111111 - Marketplace:
Mktplce11111111111111111111111111111111111 - Access Control:
AccssCtrl111111111111111111111111111111
Note: These are placeholder IDs. After deployment, update Anchor.toml with actual program IDs.
scrunchy-contract/
├── programs/ # Solana Anchor programs
│ ├── asset-registry/ # Asset Registry Program
│ ├── marketplace/ # Marketplace Program
│ └── access-control/ # Access Control Program
├── tests/ # Integration tests
├── scripts/ # Deployment and utility scripts
├── docs/ # Project documentation
├── Anchor.toml # Anchor configuration
└── Cargo.toml # Workspace configuration
- Create game assets as NFTs
- Register games for integration
- Manage asset metadata and attributes
- Track asset statistics
- Transfer asset ownership
- List assets for rent
- Create rental agreements
- Escrow payment management
- Revenue distribution (owner, platform, game)
- Rental extension and completion
- Fast ownership verification
- Rental status checking
- SDK-optimized queries
anchor build -p asset-registry
anchor build -p marketplace
anchor build -p access-controlanchor idl parse -f programs/asset-registry/src/lib.rs -o target/idl/asset_registry.json# Start local validator
solana-test-validator
# In another terminal, run tests
anchor test --skip-local-validator- All programs use PDA (Program Derived Address) for account derivation
- Signer validation on all state-changing instructions
- Integer overflow protection with checked arithmetic
- Escrow pattern for secure payment handling
- Cross-program invocation (CPI) validation
- Deployment Guide - Deploy to devnet
- Deployment Costs - Calculate deployment costs
- Troubleshooting - Fix deployment errors
- SOL Airdrop Guide - Get devnet SOL
See the docs folder for complete documentation including:
- Deployment guides and troubleshooting
- Setup and configuration
- SOL airdrop guides
- Build status and known issues
For detailed architecture documentation, see:
MIT License