GraphQL Endpoint
- Local (Graph Node)
- Sepolia (Subgraph Studio)
docker compose with the local Graph Node stack.Indexed Data Sources
The subgraph listens to events from six contracts:| Data Source | Events Indexed | Entities Updated |
|---|---|---|
| PositionManager | PositionOpened, PositionIncreased, PositionClosed, TradingFeeCollected, OracleFeeCollected | Position, Account, PoolState, PoolTransaction |
| SettlementEngine | PositionSettledAtMaturity, PositionLiquidated, PositionClosedEarly, PositionReduced, FeesCollected, OracleFeeCollected | Position, PoolState, PositionReduction, PoolTransaction |
| PoolVault | Deposit, Withdraw, PnlApplied, ExposureUpdated | PoolState, Account, VaultEvent |
| MarginAccounts | CollateralDeposited, CollateralWithdrawn, MarginLocked, MarginUnlocked, PnlSettled, BadDebt | Account |
| OracleModule | ForwardRoundPublished, FixingPriceRecorded | OracleRound, OracleState, FixingPrice |
| ModeController | ModeTransition | ModeTransition, ProtocolState |
Entity Overview
Fourteen entity types fall into three categories:Mutable State Entities
Updated as new events arrive. Use these for current-state queries.| Entity | ID Pattern | Description |
|---|---|---|
| Position | positionId | Full position lifecycle data |
| Account | address | Trader margin and LP state |
| PoolState | "pool" (singleton) | Pool assets, exposure, fees |
| OracleState | "oracle" (singleton) | Forward round and fixing counts |
| ProtocolState | "protocol" (singleton) | Current operating mode |
| OracleRound | fixingTimestamp-roundId | Forward price rounds |
| DailyStats | Unix day number | Daily aggregate analytics |
Immutable Event Records
Append-only, never updated after creation. Optimized for write performance.| Entity | ID Pattern | Description |
|---|---|---|
| FixingPrice | pairId-fixingTimestamp | Settlement fixing prices |
| FeeEvent | txHash-logIndex | Fee collection events |
| PositionReduction | txHash-logIndex | Partial reduction records |
| VaultEvent | txHash-logIndex | LP deposit/withdraw history |
| PoolTransaction | txHash-logIndex | Unified activity feed |
| ModeTransition | txHash-logIndex | Mode state change audit trail |
Internal Helper
| Entity | Description |
|---|---|
| TxFeeAccumulator | Links fee events to pool transactions within a single tx. Not queried directly. |
Design Principles
Event-driven only — the subgraph uses no block handlers or call handlers. All data comes from emitted events, keeping indexing fast and deterministic. No eth_calls — handler code never calls contract functions. Every data point is derived from event parameters, avoiding RPC round-trips during indexing. Immutable optimization — append-only entities use@entity(immutable: true), skipping block-range versioning and reducing write amplification by 2-3x.
Related Pages
Schema Reference
Complete entity and field definitions.
Query Examples
Common GraphQL query patterns.
Data Source Guide
When to use subgraph vs RPC.