Swap / DEX·EVM
Vertex Protocol
Hybrid spot, perps, and money-market DEX on Arbitrum (and Edge deployments on Mantle, Base, Sei) using an off-chain sequencer with on-chain settlement. Cross-margin across all books from a single subaccount.
- 01Arbitrum perps + spot trading UIs
- 02cross-margin universal accounts
- 03low-latency orderbook with on-chain settlement
- 04vault / structured-product backends
- 05Vertex Edge multi-chain liquidity
- pnpm add @vertex-protocol/client viem bignumber.js
| Variable | Scope | Description |
|---|---|---|
| NEXT_PUBLIC_VERTEX_NETWORK | Client | Network slug: `arbitrumOne`, `mantle`, `base`, `seiTestnet`, `arbitrumSepolia`, etc. Selects RPC + endpoint defaults. |
| VERTEX_PRIVATE_KEY | Server | Server-only signer for placing orders. For browsers, sign with the user's wallet via viem `WalletClient`. |
Use the Vertex TypeScript SDK: `import { createVertexClient } from '@vertex-protocol/client'` and call `createVertexClient('arbitrumOne', { signerOrProvider })`. Trade via `client.market.placeOrder({ productId, order: { amount, priceX18, expiration, nonce }, spotLeverage })` where `productId` indexes the universal product table (perps + spot share IDs). Query state via `client.subaccount.getEngineSubaccountSummary(...)` and stream fills/book over the WebSocket at `wss://gateway.{network}.vertexprotocol.com/v1/subscribe`. EIP-712 sign each order off-chain — settlement and risk live in on-chain `Endpoint` and `Clearinghouse` contracts.
- ⚑Orders are matched off-chain by the sequencer and settled on-chain in batches — fills are not final until the on-chain settlement tx confirms. UIs should reconcile sequencer responses against on-chain state.
- ⚑Subaccount IDs are hex-encoded `bytes32` (address + label). Mixing labels per-feature is fine, but every subaccount has its own margin — funds don't auto-rebalance.
- ⚑Funding for perps is paid every settlement period, not continuously. Liquidations cascade by product and can pull spot collateral to cover perp losses (universal cross-margin).
- ⚑Oracle prices come from a Vertex-operated price oracle aggregating Pyth/Stork/Chainlink — extreme volatility may pause specific markets via the on-chain risk engine.
- ⚑Vertex Edge deploys the same SDK on multiple chains (Arbitrum, Mantle, Base, Sei) but liquidity is unified across them via the Edge sequencer; querying the wrong network slug returns empty subaccount data, not an error.
- ⚑Testnet (`arbitrumSepolia`) uses mock USDC — bridge with the Vertex testnet faucet, not LayerZero/Stargate.