Indexer & Data Flow
The indexer reads contract events from a chain RPC endpoint and writes normalized records to Supabase.
Event Sources
Primary TokenFactory event ingestion includes:
TokenCreated
TokensBought
TokensSold
TokenGraduated
Data Outputs
tokenstradesprice_candlestoken_pricesindexer_state
Invocation Model
In production, indexing is triggered through /api/indexer/run and can be scheduled by Vercel cron.
To reduce serverless timeout risk, indexing is processed in bounded block windows per invocation and resumes from indexer_state checkpoints.
Real-time Updates
Supabase Realtime can be enabled for selected tables (for example, price_candles, trades) to push updates directly to clients.
Current Limitation
The current indexer primarily handles TokenFactory events. Perp-specific event indexing and derived perp analytics are still being expanded. Until that work is complete, some perp UI metrics should be treated as chain-derived or provisional rather than fully indexed historical analytics.
Perp Event Expansion
The hardening branch extends indexing beyond TokenFactory by tracking PerpEngine events for opens, closes, liquidations, and funding updates. These feed dedicated perp-oriented tables and improve the correctness of market stats shown in the trading interface.
Operational Visibility
The hardening branch adds /api/indexer/status and /api/health endpoints plus an internal /ops page to make indexer and chain state easier to inspect without raw database or RPC tooling.
Last updated