Unified zero-copy portfolio
QuantDesk V2 introduces a unified zero-copy portfolio architecture. Unlike V1, which managed separate Program Derived Addresses (PDAs) for balances, positions, and orders, V2 consolidates all trader state into a single, high-performance account.The V1 to V2 shift
V1: fragmented state
In V1, every position and open order required its own account creation and rent payment. This led to:- Higher latency: multiple RPC calls to fetch complete state.
- Complexity: higher risk of state divergence.
- Cost: multiple rent-exempt deposits.
V2: the unified advantage
V2 uses a singlePortfolioAccount PDA that acts as a high-density, zero-copy buffer.
- Atomic execution: balances, positions, and open orders update in a single transaction.
- Sub-ms parsing: with zero-copy (via
bytemuck), the UI and bots read the entire account state without expensive deserialization. - Deterministic PDAs: each user has exactly one
PortfolioAccount, derived from their wallet address and the market program ID.