Skip to content
 
 

Repository files navigation

Soroban Contract Templates

Built for Soroban Stellar Wave Ready License

A curated, well-documented collection of production-ready, modular Soroban smart contract templates and examples. These help new and experienced developers quickly bootstrap common use cases on Soroban (Stellar's smart contract platform), lowering the barrier to building dApps, DeFi, NFTs, payments, and more.

This repository aims to fill gaps beyond the official stellar/soroban-examples by including more real-world patterns, best practices, comprehensive tests, deployment scripts, and frontend integration stubs.

🚀 Quick Start

# Clone the repository
git clone https://github.com/your-username/soroban-contract-templates.git
cd soroban-contract-templates

# Build a contract (example: token)
cd contracts/token
soroban contract build

# Deploy to testnet
./scripts/deploy.sh testnet

# Run tests
cargo test

📦 Included Templates

Template Description Use Cases Status
Token Custom fungible token with mint/burn/admin controls DeFi tokens, governance tokens, utility tokens ✅ Complete
Escrow Two-party escrow with timeout and refund mechanism P2P trading, service payments, milestone payments ✅ Complete
Voting Governance/DAO voting with balance-weighted votes DAOs, community governance, proposal systems 🚧 Planned
Subscription Recurring payment streaming using timestamps SaaS payments, content subscriptions, memberships 🚧 Planned
NFT Mint Simple NFT minting with metadata storage Digital collectibles, certificates, gaming assets 🚧 Planned

Token Contract Features

  • Standard Interface: Full Soroban token compatibility
  • Administrative Controls: Mint, burn, and admin management
  • Metadata Support: Name, symbol, and decimals
  • Allowance System: Approve and transfer_from functionality
  • Event Emission: All operations emit events for tracking
  • Error Handling: Custom error types for better debugging

Escrow Contract Features

  • Two-Party Security: Secure buyer-seller transactions
  • Deadline Protection: Automatic refunds after deadline
  • Arbiter Support: Third-party dispute resolution
  • State Management: Clear transaction lifecycle
  • Token Agnostic: Works with any Soroban token
  • Event Emission: All operations emit events for tracking

Each template includes:

  • ✅ Complete contract implementation
  • ✅ Comprehensive unit tests (8+ test cases each)
  • ✅ Deployment scripts with examples
  • ✅ Usage examples and documentation
  • ✅ React Native mobile integration

🛠 Prerequisites

📖 Usage

Building Contracts

cd contracts/[template-name]
soroban contract build

Running Tests

cd contracts/[template-name]
cargo test

Deploying to Testnet

cd contracts/[template-name]
./scripts/deploy.sh testnet

Frontend Integration

Each contract includes a complete React Native mobile app example in examples/react-native/ showing how to:

  • Connect with Stellar wallets (Freighter, Albedo)
  • Deploy contracts from mobile
  • Interact with all contract functions
  • Handle transaction states and errors
  • Provide native iOS/Android user experience
# Run the React Native example
cd examples/react-native
npm install
npm run ios  # or npm run android

🤝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines on:

  • Adding new contract templates
  • Improving existing contracts
  • Fixing bugs and issues
  • Writing documentation

🌊 Stellar Wave Program

This repository is applying to the Stellar Wave Program on Drips.network! Look for issues labeled stellar-wave for bounty opportunities to contribute and earn rewards.

How to Contribute for Rewards:

  1. Browse open issues
  2. Look for stellar-wave labeled issues with point values
  3. Comment to claim an issue
  4. Submit a PR with your solution
  5. Earn rewards through Drips after PR approval!

📚 Resources

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

🙏 Acknowledgments

  • Stellar Development Foundation for Soroban
  • The Stellar developer community
  • Contributors and maintainers

Ready to build on Soroban? Start with any template and customize it for your use case! 🚀

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages