> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tulipai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Indexer overview

> Read-only market telemetry for canonical Tulip Uniswap v4 pools.

`tulip-indexer` is a reorg-aware PostgreSQL indexer for Tulip model-credit markets. It derives market telemetry from factory and Uniswap v4 `PoolManager` events.

## What it indexes

1. `MarketLaunched` events discover canonical ModelIDs, credits, pools, curve settings, fee, supply, token ordering, and launch position.
2. Matching `Swap` events provide token deltas, price state, liquidity, tick, fee, sender, transaction, and block.
3. The indexer normalizes credit and USDG amounts and stores fixed-point prices without floating-point loss.

## Guarantees

* `(transaction_hash, log_index)` is the swap primary key, making replay idempotent.
* Each cursor stores the indexed block hash.
* A hash mismatch rolls back a safety window and replays canonical logs.
* A confirmation delay avoids ingesting the unstable head.
* Cursor and event records commit in one database transaction.

## Execution independence

The indexer is not part of trading. Clients use direct chain reads, the official v4 Quoter, Permit2, and the Universal Router for execution.

If the API reports standby, lag, or an error, show telemetry as unavailable and keep execution controls connected to chain state.

## Serialization

Decimal prices and amounts are returned as JSON strings. Keep them as arbitrary-precision decimal values until final display formatting.
