Indexer
Block-Level Indexing
Rosetta’s Indexer computes the state of every tracked vault and market at every block.The Problem with Event-Based Systems
Most DeFi data infrastructure is event-based: state updates only when transactions occur. Between transactions, data goes stale. But interest accrues every block. A market with no transactions still has borrowers owing more, lenders entitled to more, utilization shifting, and rates adjusting. Event-based systems miss all of this.What Rosetta Does Differently
Rosetta treats each block as the atomic unit of truth. Instead of waiting for events, the Indexer:- Accrues interest forward: Computes what borrowers owe and lenders are entitled to at the current block, regardless of when the last transaction occurred
- Recomputes utilization: Calculates the current ratio of borrowed to supplied assets, reflecting accrued interest
- Recalculates rates: Runs the protocol’s IRM logic to determine current Borrow APY and Supply APY
- Updates vault state: Rolls up market-level changes to compute current vault positions, PPS, and blended yields
- Stores block-level snapshots: Maintains a time series of state at block granularity
Why This Matters
Block-level data enables:- Accurate yield comparison: Compare vaults using current rates, not stale snapshots
- Precise routing decisions: The Yield Router acts on real-time data, not outdated signals
- Honest APY reporting: Users see what they will actually earn, not what the rate was hours ago
- Backtesting with fidelity: Historical analysis uses actual block-by-block state, not interpolated guesses
How It Works
Accrual Computation
Interest accrues based on time elapsed and the current borrow rate. For each block, the Indexer computes:Utilization and Rate Recalculation
With updated totals, utilization is recomputed:C = 4 (curve steepness) and speed = 50 (adaptation speed).
Supply rate derives from borrow rate:
APY Conversion
Rates are per-second. To convert to APY:Price Per Share (PPS)
For markets and vaults, PPS tracks the value of each share over time:total_assets grows while total_shares remains constant (until deposits/withdrawals), causing PPS to increase.
Vault State Rollup
Vaults hold shares in multiple markets. The Indexer values each position and aggregates:Block Snapshot Schema
Each block produces a snapshot stored with the following structure:What It Tracks
The Indexer maintains continuous state for two entity types: markets and vaults.Markets
For each lending market, the Indexer tracks:| Field | Description |
|---|---|
| Total Supplied | Assets deposited by lenders |
| Total Borrowed | Assets borrowed against collateral |
| Utilization | Ratio of borrowed to supplied |
| Borrow APY | Current annualized rate borrowers pay |
| Supply APY | Current annualized rate lenders earn |
| Available Liquidity | Withdrawable assets (supplied minus borrowed) |
| LLTV | Liquidation threshold for the market |
| Rate At Target | Current IRM target rate (for adaptive models) |
Vaults
For each vault, the Indexer tracks:| Field | Description |
|---|---|
| Total Assets | Sum of all positions valued in underlying asset |
| Total Shares | Outstanding vault shares |
| PPS | Price per share (total assets / total shares) |
| Supply APY | Weighted average of underlying market rates |
| Market Allocations | Current distribution across markets |
| Curator | Entity managing the vault strategy |
| Deposit Queue | Order in which new deposits are allocated |
| Withdraw Queue | Order in which withdrawals are sourced |
Update Frequency
All metrics are recomputed every block. On HyperEVM with ~1 second block times, this means near real-time accuracy. Historical data is retained at block granularity, enabling:- Point-in-time queries at any block height
- Time-series analysis of yield trends
- Backtesting of routing strategies