PERColator

a perp DEX program that just uses one slab of memory in an account for everything with its own LP/risk/matching engine

Contract Address
CXobgfkQT6wCysehb3abkuimkmx5chS62fZew9NBpump
Forked from Anatoly Yakovenko's Percolator|~28 commits ahead

This is an enhanced fork with production-ready infrastructure, not a copy of the original work.

Scroll to explore

Key Concepts

Essential terms to understand how PERColator works

Slab

A 10MB memory block containing an entire market - order book, positions, and all trading data in one contiguous space for maximum speed.

Reserve-Commit

Two-phase trading: First 'reserve' locks liquidity at current prices, then 'commit' executes the trade - preventing price manipulation between steps.

Slice

A piece of reserved liquidity from a specific order. Your reservation might grab slices from multiple orders to fill your size.

DLP

Designated Liquidity Provider - VIP traders who can post orders immediately and trade during freeze windows. Think of them as market makers with special access.

Kill Band

Safety check that rejects trades if the price moved too much (default 1%) since you reserved. Protects you from stale prices.

ARG Tax

Aggressor Roundtrip Guard - detects if you buy AND sell in the same batch (sandwich attempt) and charges you extra. Anti-manipulation.

Portfolio

Your cross-market account tracking total exposure and risk across all slabs. One portfolio, many markets.

Capability Token

Time-limited (2min max) authorization pass that lets specific markets access your funds. Scoped security - no blanket permissions.

Funding Rate

Hourly payment between longs and shorts that keeps perpetual prices anchored to spot. If perp > spot, longs pay shorts (and vice versa).

Core Features

Unified Memory Architecture

Single 10MB account per market containing order book, positions, reservations, and free lists in one cohesive structure.

Ultra-Low Latency

Sub-second execution times with O(1) operations and optimized memory pools for maximum trading performance.

Advanced Security

Capability-based access control with time-limited tokens and anti-replay protection for secure operations.

Cross-Margin Trading

Portfolio-level risk management with cross-slab margin calculations and unified collateral system.

Anti-Toxicity Mechanisms

Kill Band, JIT Penalty, and ARG systems protect against toxic order flow and ensure fair trading.

Modular Design

Router and Slab programs work together seamlessly with clear separation of concerns and responsibilities.

Technical Architecture

Solana Program Architecture

Router Program

RoutR1VdCpHqj89WEMJhb6TkGT9cPfr1rVjhM3e2YQr
Vault - Collateral custody per asset
Escrow - Per-user pledges with anti-replay
Cap - Time-limited debit tokens (2min TTL)
Portfolio - Cross-margin tracking

Slab Program

SLabZ6PsDLh2X6HzEoqxFDMqCVcJXDKCNEYuPzUvGPk
SlabState - 10MB account with 5 memory pools
Order Book - Price-time priority matching
Risk Engine - IM/MM calculations
Anti-Toxicity - Kill Band, JIT Penalty, ARG

Memory Layout (10MB)

Header
200B
Accounts
320KB
Orders
2.4MB
Positions
1.4MB
Reservations
480KB
Slices
512KB
Trades
800KB
Aggressor
192KB
Total: ~6.2MB (under 10MB limit)

Key Design Principles

Safety First

Slabs cannot access Router vaults directly. All debits require unexpired, correctly scoped Caps.

Ultra-Fast Matching

Price-time priority strictly maintained. O(1) freelist operations for maximum performance.

Memory Efficiency

Single 10MB account per market. No cross-contamination between users or slabs.

Anti-Toxicity

Kill Band, JIT Penalty, and ARG mechanisms protect against toxic order flow.

Technology Stack

Pinocchio
Zero-dependency Solana SDK
Rust
no_std, zero allocations
Surfpool
Local test validator
140+ Tests
Comprehensive coverage