Docs · spec draft-0.1

PerpFactory documentation

Overview

PerpFactory is a market creation layer for perpetual futures on Solana. Traders discover and trade markets; creators configure and deploy new markets for eligible tokens. Every market is isolated: its own configuration account, collateral vault, insurance vault and oracle adapter.

Current status

PerpFactory is pre-launch. The launch markets, their parameters and the Market Factory rules are published here; trading and on-chain market deployment open once the program is live. Configurations built in the Market Factory today are validated and saved in your browser, ready to deploy at launch.

Market data shown on the site is real: spot prices from the Jupiter Price API, spot DEX volume, liquidity and candles from GeckoTerminal, served through this site's own API routes. Open interest, funding and PerpFactory volume will appear once markets are live.

Market lifecycle

  1. 01Select. The creator picks a token. The eligibility engine checks liquidity, age, holders, authorities and oracle coverage.
  2. 02Configure. Parameters are chosen within bounds set by the token's liquidity tier and oracle type.
  3. 03Fund. Full launch: the creator provides all required liquidity. Bootstrap: at least 25% up front, the remainder from LPs within 14 days.
  4. 04Deploy. The program re-validates every input on-chain, creates the market accounts and seeds the insurance fund.
  5. 05Trade. The market opens when liquidity requirements are met. Funding settles hourly.

Eligibility

Draft rules. A token must satisfy all of them, and must not already have a market.

DEX liquidity≥ $1.00M
Token age≥ 7 days
Holders≥ 5,000
Mint authorityRevoked
Freeze authorityRevoked
OraclePyth or Switchboard feed, or DEX TWAP (leverage capped at 5x)

Liquidity tiers

Tiers bound maximum leverage and open interest by on-chain liquidity.

TierMin DEX liquidityMax leverageMax OI
Tier 1$100.00M50x$150.00M
Tier 2$10.00M20x$25.00M
Tier 3$2.00M10x$5.00M
Tier 4$1.00M5x$1.00M

Integration

The UI talks to the protocol only through PerpProtocolClient. Launchpads and apps integrate against the same boundary. An Anchor implementation builds instructions from the program IDL, requests a wallet signature and confirms the transaction.

export interface PerpProtocolClient {
  readonly mode: "prelaunch" | "onchain";
  readonly tradingEnabled: boolean;
  placeOrder(params: PlaceOrderParams): Promise<ExecutionResult<{ kind: "position" | "order"; id: string }>>;
  closePosition(positionId: string, market: Market): Promise<ExecutionResult<{ realizedPnl: number }>>;
  createMarket(config: MarketConfig, creator: string | null): Promise<ExecutionResult<CreateMarketOutcome>>;
}

// Only an on-chain result can carry a signature.
type ExecutionResult<T> =
  | { mode: "prelaunch"; ok: true; data: T; note: string }
  | { mode: "onchain"; ok: true; data: T; signature: string; slot: number }
  | { mode: "prelaunch" | "onchain"; ok: false; error: string };

Frontend architecture

src/lib/factory/spec.tsProtocol spec: every configurable parameter and its bounds. Must mirror the program.
src/lib/factory/*Eligibility engine, draft validation, deployment cost, token resolution service.
src/lib/protocol/*PerpProtocolClient interface and the pre-launch implementation.
src/lib/market-data/*Launch markets feed, live data sources (Jupiter, GeckoTerminal), API client and hooks.
src/lib/trading/*Pure margin math behind the position calculator (size, liquidation, fees).
src/lib/wallet/*Injected wallet access (Phantom, Solflare, Backpack) and wallet context.
src/lib/store/*Locally saved market configurations.
src/components/*UI primitives, chart, trading terminal, factory wizard, pages.

See also: Risk Disclosure