Platform: Stellar Soroban
Language: Rust
License: MIT
PredictIQ 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 PredictIQ
# Install dependencies (Rust and Soroban CLI)
# See Setup Instructions below
# Build contracts
cd contracts/predict-iq
make build
# Run tests
make testPredictIQ/
โโโ .archive/ # Historical documentation
โโโ .github/ # GitHub templates and workflows
โ โโโ PULL_REQUEST_TEMPLATE.md
โ โโโ workflows/
โโโ contracts/
โ โโโ predict-iq/ # Main prediction market contract
โ โโโ src/ # Contract source code
โ โโโ Makefile # Build and test commands
โโโ docs/ # Comprehensive documentation
โ โโโ README.md # Documentation index
โ โโโ gas/ # Gas optimization guides
โ โโโ security/ # Security documentation
โ โโโ quick-reference/ # Quick reference guides
โโโ tests/ # Test files
โโโ README.md # This file
โโโ CONTRIBUTING.md # Contribution guidelines
โโโ DEVELOPMENT.md # Development setup guide
โโโ ARCHITECTURE.md # System architecture
โโโ API_SPEC.md # API specification
โโโ CHANGELOG.md # Version history
โโโ Cargo.toml # Workspace configuration
Key Components:
contracts/predict-iq/: Main prediction market contract with oracle integration, voting, disputes, and governancedocs/: Organized documentation by category.archive/: Historical documentation for reference
- 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/predict-iq
# 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/predict_iq.wasm
# From contract directory
cd contracts/predict-iq
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/predict_iq.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/predict_iq.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/predict_iq.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| Document | Description |
|---|---|
| ๐ Documentation Index | Complete documentation overview |
| ๐ Getting Started | Development setup and workflows |
| ๐ค Contributing | Contribution guidelines |
| ๐๏ธ Architecture | System design and architecture |
| ๐ API Specification | API reference and integration |
| ๐ Changelog | Version history and changes |
- Development Guide - Complete setup instructions
- Quick Start - Get up and running quickly
- Contributing Guidelines - How to contribute
- Architecture Overview - System design and components
- API Specification - Complete API reference
- Gas Optimization Guide - Optimization strategies
- Quick Start Gas Optimization - Quick tips
- Multisig Emergency Pause - Emergency controls
- Security Best Practices - Security guidelines
- Quick Reference Guides - Command references and cheat sheets
- Contract Documentation - Detailed contract docs
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 PredictIQ 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/predict-iq
make fmt# Run all tests
make test
# Run with output
cargo test -- --nocapture
# Run specific test
cargo test test_namecontracts/predict-iq/src/: Main contract source codelib.rs: Contract entry point and main implementationmodules/: Modular contract implementationadmin.rs: Admin functionsmarkets.rs: Market creation and managementoracles.rs: Oracle integration (Pyth, Reflector)voting.rs: Community voting systemdisputes.rs: Dispute resolution mechanismfees.rs: Fee management
types.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
- Stellar Developer Discord: Community support
- Issues: GitHub Issues
- Documentation: Documentation Index
- Questions: Use GitHub Discussions
Last updated: 2026