Skip to main content
Repository: purpletrade/percolator-match · License: Apache 2.0 · Language: Rust

What It Does

percolator-match is a Solana program that provides passive market making for Percolator markets. When a user submits a TradeCpi instruction, the Percolator program calls this matcher via CPI to determine the execution price and size. The matcher quotes prices around the oracle with a configurable spread. Deployed on mainnet at MTCPqs6RWWUPMHhvZnnB6BLAXS86TDpTaxQW7Pa3aDh.

How It Works

The matcher writes its response into a context account that Percolator reads after the CPI returns.

Two Matching Modes

Passive Mode (kind=0)

Fixed spread around the oracle price. Simple and predictable:
All integer math, no floating point. Rounding is always passive-favorable (bid rounds down, ask rounds up).

vAMM Mode (kind=1)

Dynamic pricing with configurable parameters: Price impact increases with trade size relative to liquidity_notional_e6, creating a virtual AMM curve.

Context Account Layout

Each LP gets a 320-byte context account owned by the matcher program:

Security

  • LP PDA binding — The matcher verifies the CPI signer matches the stored LP PDA on every call. Prevents unauthorized programs from using the matcher.
  • One-time init — Context can only be initialized once (no rebinding).
  • Program ownership — Context account must be owned by the matcher program.
  • Atomic setup required — Context creation + LP initialization must be in a single transaction to prevent race conditions.

Instructions

Build

Verified Build

Built deterministically using solanafoundation/solana-verifiable-build:2.3.0. See the Source Verification page for the SHA-256 hash and reproduction instructions.

View Repository

Source code, context layout, vAMM implementation

Verified Build

Latest SBF build artifact with SHA-256 hash