Skip to content

Sortis-AI/sol-pm

Repository files navigation

Permissionless On-Chain Prediction Markets

Solana prediction market protocol. Port of z-fi/pm from Ethereum to Solana using Anchor.

Binary outcome markets with USDC collateral. Users split USDC into YES/NO outcome tokens, trade them on an AMM or orderbook, and claim winnings after oracle-based resolution.

Architecture

Five Anchor programs plus a shared utility crate:

Program ID Purpose
pm-core 9dikrEFTsLTAHT9ncHZbhwtAfwyWeJtNULtnph1xFABc Market lifecycle: create, split, merge, resolve, claim, close
pm-amm 6zmapSbzauK9tMi9X47DQLYPLUhyHREXHaqeerMGCp37 Constant-product AMM with dynamic fees
pm-orderbook 5AtUShLVGuJCEnSaVYWoFV61RAgv39LQCdZ5DemEsoDv Pooled limit orders with accumulator accounting
pm-router 9jsyndsMRXX5pkLRNhZ7eomDKPMh8fnjADdRmjyWr8fL Multi-venue routing with bootstrap vault
pm-resolver 4FruEU3tx21AAvYNFjnChidJ2TqmJeumsWjxTEsJYFDt Oracle-based resolution (Pyth, Switchboard, authority)

Shared crate (pm-shared): checked math, SPL token account initialization helpers, common error types.

Prerequisites

  • Rust (stable toolchain)
  • Solana CLI
  • Anchor 0.32.1
  • Node.js (for tests)
  • Yarn

Build

anchor build

Test

anchor test

Project Layout

programs/
  shared/             Shared crate: math, token_init, error types
  pm-core/            Market lifecycle (create/split/merge/resolve/claim/close)
  pm-amm/             Constant-product AMM with TWAP and dynamic fees
  pm-orderbook/       Pooled limit orderbook with accumulator-based fairness
  pm-router/          Multi-venue buy/sell routing with bootstrap vault
  pm-resolver/        Oracle conditions, Pyth/Switchboard parsing, CPI resolution
Anchor.toml           Program IDs, cluster config, test script
Cargo.toml            Workspace members, shared dependency versions
package.json          JS test dependencies (@coral-xyz/anchor, mocha, chai)
tsconfig.json         TypeScript config for tests

Token Model

  • Collateral: USDC (SPL Token, 6 decimals)
  • Outcome tokens: YES and NO mints created per market (SPL Token, 6 decimals)
  • Market PDA is mint authority for both outcome mints
  • 1 USDC splits into 1 YES + 1 NO; merging burns both and returns USDC

Resolution

Markets resolve via the pm-resolver program, which reads oracle prices (Pyth or Switchboard), evaluates a registered condition (price threshold, ratio, or authority decision), and CPIs into pm-core::resolve. Winning token holders burn tokens to claim their proportional share of the collateral vault.

About

100% Permissionless Prediction Markets on Solana

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors