Platform: Stellar Soroban
Language: Rust
License: MIT
Predictify Contracts is a comprehensive prediction market platform built on Stellar's Soroban smart contract platform. The system enables users to create and participate in prediction markets with hybrid resolution mechanisms that combine real-time oracle data (from Pyth Network and Reflector oracles) with community voting. This platform is designed for developers, traders, and organizations looking to build decentralized prediction markets with institutional-grade oracle integration, dispute resolution, and governance features.
The project is ideal for developers building on Stellar, smart contract auditors, and teams creating prediction market applications that require reliable price feeds, community governance, and robust dispute resolution mechanisms.
- Quick Start
- Project Structure
- Setup Instructions
- Development
- Testing
- Deployment
- Documentation
- Contributing
# Clone the repository
git clone <repository-url>
cd predictify-contracts
# Install dependencies (Rust and Soroban CLI)
# See Setup Instructions below
# Build contracts
cd contracts/predictify-hybrid
make build
# Run tests
make testpredictify-contracts/
โโโ contracts/
โ โโโ hello-world/ # Example contract for reference
โ โโโ predictify-hybrid/ # Main prediction market contract
โ โโโ src/ # Contract source code
โ โโโ Makefile # Build and test commands
โโโ docs/ # Comprehensive documentation
โ โโโ api/ # API reference
โ โโโ contracts/ # Contract-specific docs
โ โโโ gas/ # Gas optimization guides
โ โโโ operations/ # Deployment and operations
โ โโโ security/ # Security documentation
โโโ Cargo.toml # Workspace configuration
โโโ README.md # This file
Key Components:
predictify-hybrid: Main prediction market contract with oracle integration, voting, disputes, and governancehello-world: Reference contract demonstrating basic Soroban patterns
- Rust (latest stable version)
- Soroban CLI (version 20.0.0 or later)
- Stellar Account (for deployment and testing)
- Git (for cloning the repository)
# Install Rust using rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Verify installation
rustc --version
cargo --version# Install Soroban CLI
cargo install --locked --version 20.0.0 soroban-cli
# Verify installation
soroban --version# Install Stellar contract build tools
cargo install --locked stellar-cli
# Verify installation
stellar --version# Add testnet (recommended for development)
soroban config network add testnet \
--rpc-url https://soroban-testnet.stellar.org:443 \
--network-passphrase "Test SDF Network ; September 2015"
# Add futurenet (for testing new features)
soroban config network add futurenet \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase "Test SDF Future Network ; October 2022"
# Add mainnet (for production deployment)
soroban config network add mainnet \
--rpc-url https://rpc.mainnet.stellar.org:443 \
--network-passphrase "Public Global Stellar Network ; September 2015"# Use testnet for development
soroban config network use testnetCreate a .env file in the project root (or .env.testnet for testnet):
# .env.testnet
NETWORK=testnet
DEPLOYER_SECRET_KEY="SB..." # Your deployer account secret key
ADMIN_ADDRESS="GB..." # Admin account address
ORACLE_CONTRACT="..." # Oracle contract address (optional for testing).env files to version control. Add them to .gitignore.
# From project root
cd contracts/predictify-hybrid
# Build the contract
make build
# Or use cargo directly
cargo build --target wasm32-unknown-unknown --releaseThe compiled WASM file will be at:
target/wasm32-unknown-unknown/release/predictify_hybrid.wasm
# From contract directory
cd contracts/predictify-hybrid
make test
# Or use cargo directly
cargo test# Unit tests only
cargo test --lib
# Integration tests
cargo test --test integration_test
# Property-based tests
cargo test --test property_based_tests# Deploy to testnet for integration testing
soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/predictify_hybrid.wasm \
--network testnet \
--source $DEPLOYER_SECRET_KEY
# Initialize the contract
soroban contract invoke \
--id <contract_id> \
--fn initialize \
--network testnet \
--source $DEPLOYER_SECRET_KEY \
--arg admin=$ADMIN_ADDRESS# Ensure you're on testnet
soroban config network use testnet
# Deploy contract
soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/predictify_hybrid.wasm \
--network testnet \
--source $DEPLOYER_SECRET_KEY
# Save the contract ID from the output
CONTRACT_ID="<contract_id_from_output>"
# Initialize contract
soroban contract invoke \
--id $CONTRACT_ID \
--fn initialize \
--network testnet \
--source $DEPLOYER_SECRET_KEY \
--arg admin=$ADMIN_ADDRESS- All tests passing
- Security audit completed
- Testnet deployment verified
- Admin keys secured (preferably multisig)
- Oracle contracts configured
- Monitoring setup ready
# Switch to mainnet
soroban config network use mainnet
# Deploy contract
soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/predictify_hybrid.wasm \
--network mainnet \
--source $DEPLOYER_SECRET_KEY
# Initialize contract
soroban contract invoke \
--id $CONTRACT_ID \
--fn initialize \
--network mainnet \
--source $DEPLOYER_SECRET_KEY \
--arg admin=$ADMIN_ADDRESS
# Record contract ID securely
echo "Mainnet Contract ID: $CONTRACT_ID" >> deployment.log# Inspect deployed contract
soroban contract inspect \
--id $CONTRACT_ID \
--network $NETWORK- ๐ Documentation Index - Complete documentation overview
- ๐ API Documentation - Complete API reference and integration guides
- ๐ Contract README - Detailed contract documentation
- Security Best Practices - Development security guidelines
- Attack Vectors - Known threats and mitigations
- Audit Checklist - Security audit requirements
- Security Testing Guide - Security testing procedures
- Gas Optimization - Optimization strategies
- Gas Cost Analysis - Detailed cost breakdown
- Gas Monitoring - Monitoring tools and techniques
- Gas Benchmarking - Performance benchmarks
- Incident Response - Incident management procedures
- Types System - Data structures and types
- Voting System - Voting and dispute resolution
We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch
git checkout -b feature/your-feature-name
- Make your changes
- Follow Rust formatting:
cargo fmt --all - Ensure tests pass:
make test - Update documentation as needed
- Follow Rust formatting:
- Commit your changes
git commit -m "Add: description of your changes" - Push and create a Pull Request
- Formatting: Use
cargo fmt --allbefore committing - Testing: All new features must include tests
- Documentation: Update relevant docs for new features
- Security: Review security implications of changes
- Issues: Use GitHub issues for bug reports and feature requests
- Pull Requests: Include description of changes and test results
- Code Review: All PRs require review before merging
- Testing: Ensure all tests pass and add tests for new features
- Documentation: Check the docs directory
- Issues: Search existing issues or create a new one
- Discussions: Use GitHub Discussions for questions
The Predictify Hybrid contract supports multiple oracle providers for price feeds:
- Pyth Network: Institutional-grade price feeds with high-frequency updates (400ms)
- Reflector Oracle: Stellar-native oracle with proven track record
- Custom Oracles: Extensible architecture for additional providers
See the Contract README for detailed oracle setup instructions and integration examples.
# Format all code
cargo fmt --all
# Or from contract directory
cd contracts/predictify-hybrid
make fmt# Run all tests
make test
# Run with output
cargo test -- --nocapture
# Run specific test
cargo test test_namecontracts/predictify-hybrid/src/: Main contract source codelib.rs: Contract entry point and main implementationmarkets.rs: Market creation and managementoracles.rs: Oracle integration (Pyth, Reflector)voting.rs: Community voting systemdisputes.rs: Dispute resolution mechanismgovernance.rs: Governance and admin functionstypes.rs: Core data structureserrors.rs: Error definitions
- Create feature branch
- Implement feature with tests
- Update documentation
- Run full test suite
- Submit PR with description
- Stellar Expert: Blockchain explorer
- Soroban CLI: Contract inspection and interaction
- Custom Scripts: Monitor transactions and events
- Oracle submission frequency and reliability
- Market creation and resolution rates
- Dispute activations and resolution times
- Gas costs and optimization opportunities
- Review Security Documentation before deployment
- Complete security audit checklist
- Use hardware wallets for admin keys
- Implement multisig for critical operations
- Monitor for suspicious activity
Please report security issues privately to the maintainers. See Security Best Practices for details.
This project is open source and available under the MIT License.
- Stellar Documentation: Stellar platform docs
- Soroban Documentation: Soroban smart contract platform
- Pyth Network: Oracle provider documentation
- Stellar Developer Discord: Community support
- Issues: GitHub Issues
- Documentation: Documentation Index
- Questions: Use GitHub Discussions
Last updated: 2025