Skip to content

Latest commit

Β 

History

884 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Predinex Stellar

Next-generation prediction markets on Stellar (via Soroban).

Status Commits Rust Soroban License

πŸ— System Architecture

The project centers around the predinex, Soroban smart contract which manages pool states, betting logic, and fund distribution. It utilizes the Stellar Asset Contract (SAC) for secure token transfers.

graph TD
    User[User / Client]
    
    subgraph Stellar_Blockchain [Stellar Blockchain]
        Contract[predinex.wasm]
        Ledger[Ledger State]
    end
    
    subgraph Storage [Soroban Storage]
        Pools[Pools Data]
        UserBets[User Bets Data]
    end

    User -- "Create Pool" --> Contract
    User -- "Place Bet (XLM/TKN)" --> Contract
    User -- "Settle Pool" --> Contract
    
    Contract -- Read/Write --> Pools
    Contract -- Read/Write --> UserBets
    Contract -- Updates --> Ledger
Loading

πŸ”„ Workflow

The prediction market lifecycle on Stellar is designed for speed and finality.

stateDiagram-v2
    [*] --> Created: create_pool
    
    state Created {
        [*] --> BettingOpen
        BettingOpen --> BettingOpen: place_bet
    }
    
    Created --> Settled: settle_pool
    
    state Settled {
        [*] --> FundsDistributed
        note right of FundsDistributed
          Winner is declared
          Marked as settled
        end note
    }
    
    Settled --> [*]
Loading

✨ Features

  • Decentralized Prediction Pools: Create and manage binary and multi-outcome prediction markets with ease.
  • Fast Settlements: Leverages Stellar's near-instant finality for rapid results.
  • Cross-Asset Betting: Compatible with any Stellar asset via the Stellar Asset Contract (SAC).
  • LP Yield Farming: Deposit liquidity, earn fees, and boost rewards by staking LP shares.
  • Automated Bookkeeping: Real-time tracking of pool totals and user positions.
  • Rich Web Experience: A Next.js app with market discovery, portfolio, analytics, comparisons, disputes, and more.
  • Embeddable Widget: Integrate live pools into any website with a drop-in widget (packages/widget).
  • Automation Bot: Repo-managed off-chain tooling for pool/oracle workflows (bot).
  • Robust Security: Built with Rust and Soroban's secure-by-design architecture.
  • Transparency: Fully verifiable on-chain data and transaction history.

πŸ—‚ Repository Layout

  • contracts/predinex β€” the core Soroban prediction-market contract (pool lifecycle, betting, settlement, LP incentives).
  • contracts/pool β€” related pool utility/auxiliary contract.
  • web β€” the Next.js frontend (App Router): markets, dashboard, analytics, admin, disputes, oracle management, portfolio.
  • packages/widget β€” the embeddable pool widget for third-party sites.
  • bot β€” automated off-chain workflows (oracle reporting, market upkeep).
  • docs β€” protocol, contract API, deployment, and development documentation.
  • scripts β€” bootstrap and CI/verification helpers.

πŸš€ Getting Started

Prerequisites

Installation

  1. Clone the repository

    git clone <repository-url>
    cd predinex-stellar
  2. Quick Start (Recommended)

    Run the bootstrap script to install all dependencies and verify your environment:

    ./scripts/bootstrap.sh
  3. Build the Contract

    cd contracts/predinex
    stellar contract build
  4. Run Contract Tests

    cargo test
  5. Run the Web App

    cd web
    npm install
    npm run dev

πŸ›£οΈ Roadmap

Predinex Stellar ships in phases, growing from core on-chain mechanics to a full product experience.

Phase 1: Core Soroban Implementation (COMPLETED)

  • βœ… Core contract logic (Pools, Bets, Settlement, Cancellation).
  • βœ… Multi-outcome pools and template support.
  • βœ… LP yield farming with stake boost.
  • βœ… Unit test suite for full lifecycle verification.
  • βœ… Token integration (SAC).

Phase 2: Frontend & Product (IN PROGRESS)

  • πŸ”„ Stellar SDK integration.
  • πŸ”„ Wallet and network support are tracked in the canonical wallet and network support page.
  • βœ… Market discovery, market detail, and portfolio.
  • βœ… Admin, analytics, disputes, oracle management, and comparison tooling.
  • βœ… Embeddable pool widget.

Phase 3: Lending Security (IN PROGRESS)

  • βœ… Emergency withdrawal controls for lending pools.
  • βœ… TWAP oracle price manipulation guard modules.
  • βœ… Interest-rate manipulation detection and prevention modules.
  • βœ… MEV/sandwich attack protection modules.
  • πŸ”„ Production wiring for lending pool deployment and signed API submission.
  • πŸ”œ Multi-source oracle quorum weighting and asset-specific volatility limits.

🀝 Contributing & Releases

We welcome contributions! Please read the Contributing Guide first β€” it covers local setup, running checks, documentation standards, and the issue/PR workflow.

Additional development guides:

πŸ› οΈ CI/CD Pipeline

The project uses GitHub Actions to ensure code quality and prevent regressions. The workflow runs on every push and pull request to main.

Preview Deployments

Pull requests automatically generate preview deployments for the web app, making it easy to review UI changes:

  • πŸš€ Automatic: Every PR with web changes gets a live preview
  • πŸ”— Shareable: Preview URLs are posted as PR comments
  • πŸ”’ Safe: Previews use testnet configuration only
  • ⚑ Fast: Deployments complete in ~2 minutes

Setup Guide: See Preview Deployments Guide for configuration instructions.

Full Documentation: Preview Deployments Guide

Local Verification

You can run the same checks locally to verify your changes before pushing:

Web App:

cd web
npm run lint
npm run test
npm run build

Smart Contracts:

cd contracts/predinex
cargo fmt
cargo fmt --check
cargo clippy -- -D warnings
cargo test

πŸ“„ License

This project is licensed under the ISC License.


πŸ”’ Security

For information about reporting security vulnerabilities, please see our Security Policy.

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages