A non-custodial perpetual futures DEX on Solana, built with Anchor. Supports hybrid order matching, trades fill against an on-chain AMM or a live order book, whichever offers a better price.
Fill routing- when a taker order arrives, the engine:
- Collects book-side makers sorted by best price
- For each maker that beats the AMM, routes to order matching first
- Falls back to the AMM for any remaining quantity
| Account | Seeds | Description |
|---|---|---|
State |
drift_state |
Global config |
PerpMarket |
perp_market |
Per-market params + embedded AMM state |
perp_market_vault |
perp_market_vault |
SPL token vault for a market |
User |
user / <authority> / <account_id> |
Orders array (max 8) + positions (max 16) |
Oracle |
oracle / <market_index> |
Custom price feed with staleness & deviation checks |
| Tool | Version |
|---|---|
| Rust | 1.89.0 (see rust-toolchain.toml) |
| Solana CLI | ≥ 2.x |
| Anchor CLI | 0.32.1 |
| Node.js | ≥ 18 |
| Yarn | any |
yarn installanchor buildanchor test# Start a local validator
surfpool start
# Deploy
surfpool run deploymentSee runbooks/ for devnet and mainnet deployment.
The AMM uses a constant-product curve (k = base × quote). Price impact is computed off-chain by the filler and passed as limit_price.
bid_price = quote_reserve / base_reserve
ask_price = base_reserve / quote_reserve
weighted_price = (oracle_price × oracle_weight + amm_price × (10000 − oracle_weight)) / 10000
oracle_price_weight (0–10000 bps) controls how strongly the oracle anchors the displayed price.
ISC