Subgraph & events (The Graph)
Level: Advanced · Based on the Earn V2 subgraph docs.
Topology
Entities
| Entity | Notes |
|---|---|
Factory | id, vaultCount, derived roleMembers. |
Vault | Name, symbol, decimals, isAsync, underlyingAsset, totalSupply, cachedTotalAssets, sharePrice, fee totals, historical deposits/withdrawals, created-at info, derived strategies; async-only: isQueueActive, currentEpoch, latestProcessedEpoch, pastEpochUnclaimedAssets, *EpochRequestedShares, withdrawalQueue, epochs. |
WithdrawalQueue | Per user per epoch pending requests; created on QueuedWithdrawal, updated on claim/move, deleted on RequestCancelled. |
PartialEpochRequestProcessed | Immutable record of a request fulfilled from a closed-but-unprocessed epoch (needs WITHDRAWAL_MANAGER). |
PriorityWithdrawalClaimed | Immutable: shares, grossAssets, unwindCost, netAssets, epochID. |
Account / SharesBalance | User positions. lastActivityTimestamp updates on Deposit/Withdraw only - not on plain Transfer. |
Strategy | vault (nullable), strategyType, allocatedValue. |
Aggregations (daily)
NewUserStats (per vault), NewUserGlobalStats (protocol-wide), VaultStats (last totalSupply, cachedTotalAssets, sharePrice per day), VaultFeesStats (daily + cumulative management/performance fees).
Tracked events (headline set)
Deposit, Withdraw, YieldAccrued, ManagementFeeAccrued, PerformanceFeeAccrued, QueuedWithdrawal, RequestCancelled, RequestClaimed, RequestMovedToNextEpoch, EpochProcessed, PartialEpochRequestProcessed, PriorityWithdrawalClaimed, StrategyYieldAccrued, AllocateFunds, DeallocateFunds, StrategyWithdraw, AdjustTotalAssets.
Query patterns
Ready-to-adapt queries live in `examples/graphql/subgraph-queries.graphql`. Tips:
Use cases
| Goal | Query |
|---|---|
| Vault dashboard (TVL, share price) | vaults + vaultStats |
| APY estimate | Δ sharePrice over time, annualised (net of fees) |
| Fee analytics | vaultFeesStats |
| Queue depth / withdrawal tracker | withdrawalQueues, Vault.currentEpochRequestedShares |
| Strategy exposure | strategies + allocatedValue |
| Growth metrics | NewUserStats, NewUserGlobalStats |