Platform Documentation

Complete technical overview of DEXolator - A unified perpetual exchange protocol on Solana

View on GitHub

System Architecture

DEXolator consists of two main on-chain Solana contracts:

Router Contract

RoutR1VdCpHqj89WEMJhb6TkGT9cPfrlrVjhM3e2YQr

Central coordinator managing collateral, portfolio margin, and cross-market routing

  • Vault - Asset custody management per token
  • Escrow - User deposits with replay protection
  • Cap - Time-restricted access authorization tokens (2min expiry)
  • Portfolio - Cross-market margin tracking across memory blocks
  • MarketRegistry - Governance-controlled market registry

Memory Block Contract

SLabZ6PsDLh2X6HzEoqxFDMqCVcJXDKCNEYuPzUvGPk

Per-market order book and matching engine in a single 10MB account

  • BlockState - Header + 5 memory pools (64KB each)
  • Order Book - Price-time priority matching engine
  • Matching Engine - Central limit order book
  • Risk Calculations - Initial/Maintenance margin
  • Protection Mechanisms - Price Protection, JIT Penalty, Roundtrip Tax

Implementation Status

  • Core data structures (Router & Memory Block)
  • Order book management
  • Risk calculations (IM/MM)
  • Funding rate system
  • Router orchestration (multi-slab)
  • Account initialization helpers
  • TypeScript SDK
  • 140+ passing tests
  • Memory pools with O(1) freelists
  • Reserve & Commit operations
  • Capability system (scoped debits)
  • Instruction handlers
  • Liquidation engine
  • BPF deployment scripts
  • CLI Tools
  • Integration testing (Surfpool)

Development Stack

Pinocchio v0.9.2

Minimal dependency Solana SDK for on-chain programs

Surfpool

Local Solana development validator with mainnet state

Rust (no_std)

Minimal allocations, panic = abort for BPF

System Principles

Security

  • Memory Blocks cannot access Router vaults directly
  • Memory Blocks can only debit via unexpired Access Tokens
  • Total debits ≤ min(token.remaining, escrow.balance)
  • No cross-contamination between users/memory blocks

Order Matching

  • Price-time priority rigorously enforced
  • Reserved quantity ≤ available quantity always
  • Order book links acyclic and consistent
  • Pending orders never match before promotion

Market Protection Systems

Price Protection

Reject orders if market price moved beyond threshold since batch open

JIT Penalty

Market Maker orders posted after batch_open receive no rebate, discouraging toxic flow

Roundtrip Tax

Roundtrip trades within the same batch are taxed/clipped to prevent gaming

Back to Home