Overview
PaxSpot is a spot exchange built entirely in the EVM layer of HyperPaxeer. It introduces six novel primitives that exploit chain-level advantages — custom precompiles, validator-integrated keepers, and native gas policy — to deliver execution quality that no protocol on a shared chain can match.Oracle-Relative Orders
Orders stored as basis-point offsets from oracle price, not absolute prices
Dual-Mode Matching
Continuous in calm markets, sealed-bid batch auctions under volatility
Capital-Integrated
Funded smart wallets trade as first-class participants via Argus VM
Six Primitives
1. Oracle-Relative Order Book (OROB)
All orders and liquidity positions are stored as basis-point offsets from the oracle price, not absolute prices. A limit buy at “anchor - 5 bps” automatically follows the market.- State compression: orders do not need repricing when the market moves
- Fills outside configurable oracle bands are rejected (anti-manipulation)
- LP positions track the market without active management
- Resolution computed by precompile
0x901(OROBResolver) — near-zero gas
2. Adaptive Dual-Mode Execution
The protocol dynamically switches matching mode per market based on conditions:| Condition | Mode | Benefit |
|---|---|---|
| Normal / low volatility | Continuous — orders fill within the block they arrive | Fast UX, tight spreads |
| High volatility / anomalous flow | Sealed-bid batch auction — uniform clearing price per block | MEV-immune, fair execution |
- Oracle confidence interval exceeds threshold
- Block volume > 3 sigma of rolling 50-block average
- Governance-configurable sensitivity
0x902 (BatchClearing).
3. Programmable Liquidity Vaults (PLVs)
Composable strategy vaults that implement a standard interface:4. Proof-of-Fill-Quality (PoFQ)
0x904 (PoFQScorer). Vaults accumulate a rolling quality score on-chain. Higher score yields higher fee share, priority routing, and increased capital allocation from the Argus risk engine.
5. Lazy Netting Settlement
- Users trade against virtual balances updated in the same block
- Every settlement epoch (~5 blocks / 10 s), the protocol computes net transfers across all participants
- Gas reduction: 5–10x vs. per-trade settlement
- Fast-settle lane: 1 bps premium for same-block finality
6. Capital-Integrated Trading
PaxSpot interfaces with the Argus VM for funded smart-wallet trading:IPaxSpotReader (PoFQ scores, PnL, positions) and enforces per-address limits via IAllowanceProvider. Funded wallets are indistinguishable from self-funded wallets at the matching-engine level.
Contract Architecture
Built with Foundry, Solidity 0.8.24, OpenZeppelin v5.0.1.| Contract | Purpose |
|---|---|
| PaxSpotRouter | Order gateway — signature validation, rate limiting, funded-wallet allowance checks |
| MatchingEngine | OROB continuous + batch matching via precompiles 0x901/0x902/0x904 |
| SettlementEngine | Virtual-balance ledger, epoch netting, fast-settle lane |
| OracleAdapter | Pyth primary + Validator Oracle Module (VOM) fallback via precompile 0x903 |
Custom Precompiles
| Address | Name | Type | Purpose |
|---|---|---|---|
0x901 | OROBResolver | Stateless | Convert offset orders to absolute prices and back |
0x902 | BatchClearing | Stateless | Compute uniform clearing price for sealed-bid auctions |
0x903 | OracleAggregator | Stateful | Confidence-weighted median of validator-submitted prices (x/paxoracle) |
0x904 | PoFQScorer | Stateless | Score fill quality against oracle at execution time |
Oracle Architecture
PaxSpot uses a two-tier oracle with automatic fallback:- Primary — Pyth Network: Sub-second pull-oracle with confidence intervals
- Fallback — Validator Oracle Module (VOM): Validators submit prices via the
0x903precompile (submitPrice). Thex/paxoracleCosmos SDK module aggregates submissions using a confidence-weighted median with staleness filtering (15-block threshold) and quorum enforcement.
Test Results
155 unit tests, 0 failures, 95.73% line coverage (Foundry,vm.mockCall for precompiles).
| Contract | Lines | Branches | Functions |
|---|---|---|---|
| MatchingEngine | 98.87% | 89.47% | 100% |
| SettlementEngine | 98.06% | 100% | 94.74% |
| PaxSpotRouter | 98.48% | 91.67% | 100% |
| OracleAdapter | 96.25% | 83.33% | 100% |
- Precompile 0x901
resolveOffset+toOffset - Precompile 0x902
computeClearing - Precompile 0x903
submitPrice+getValidatorPriceround-trip - Precompile 0x904
scoreFill - OracleAdapter
getPrice(Pyth primary + VOM fallback) - MatchingEngine market creation + state query
- PaxSpotRouter
submitOrderend-to-end
Resources
Spot Trading Design
Full technical specification
Smart Contracts
General deployment and verification guide