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:Aave Accrual
The Indexer also tracks Aave markets using the Aave V3 accrual model. While the principles are the same — compute state at every block — the mechanics differ from Morpho.Aave Interest Accrual
Aave tracks cumulative interest via a liquidity index, a monotonically increasing multiplier:scaled_balance is set at deposit time and remains constant. As the liquidity index grows, the actual balance increases — this is how Aave accrues yield.
Aave Supply APY
Multi-Chain Indexing
The same block-level approach applies across all supported chains. On Base, the Indexer tracks Morpho markets using the same accrual computation described above. Each chain maintains its own snapshot timeline indexed by block number.What It Tracks
The Indexer maintains continuous state for three entity types: Morpho markets, Morpho vaults, and Aave reserves.Morpho Markets
For each Morpho 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) |
Morpho 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 |
Aave Reserves
For each Aave reserve, the Indexer tracks:| Field | Description |
|---|---|
| Total Supply | Assets deposited by suppliers |
| Total Borrowed | Assets borrowed from the pool |
| Utilization | Ratio of borrowed to supplied |
| Supply APY | Current annualized rate suppliers earn |
| Variable Borrow APY | Current annualized rate borrowers pay |
| Liquidity Index | Cumulative interest multiplier |
| Available Liquidity | Withdrawable assets |
| aToken Address | Interest-bearing token contract |
Update Frequency
All metrics are recomputed every block. On HyperEVM with ~1 second block times, this means near real-time accuracy. On Base, block times are ~2 seconds. 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
- Cross-chain yield comparison at synchronized timestamps