Indexer service for the Uncap Protocol on Starknet. It uses Checkpoint to ingest on-chain events, persist them to Postgres, and expose a GraphQL API for querying protocol state.
- Indexes mainnet and sepolia with independent RPC providers.
- Watches USDU for new collateral branches and dynamically attaches templates.
- Tracks troves, borrowers, batches, and interest rate brackets.
- Exposes a GraphQL endpoint backed by a typed schema.
- Sends Telegram notifications for trove updates, liquidations, and redemptions (mainnet only).
- Entry point: src/index.ts
- Checkpoint config and sources: src/config.ts
- Event writers: src/writers.ts
- Domain handlers:
- src/USDU.ts (new collateral branches)
- src/TroveManager.ts (trove operations, batches, rate brackets)
- src/TroveNFT.ts (ownership transfers)
- GraphQL schema: src/schema.gql
The schema includes:
Collateral,CollateralAddressesTrove,TroveManagerEventsEmitter,TroveNFTBorrowerInfoInterestBatch,InterestRateBracket
See src/schema.gql for full types and relations.
- Node.js 18+
- Postgres 15+
For local Postgres, use docker-compose.yml.
Required:
DATABASE_URL(orDATABASE_URL_INDEXwithDATABASE_URL_<index>variants)STARKNET_RPC_URL_MAINNETSTARKNET_RPC_URL_SEPOLIA
Optional:
PORT(default: 3000)NODE_ENV(in production, startup is delayed by 60s to avoid double indexing)CA_CERT(PEM string; supports \n escaping)START_BLOCK(skip Telegram notifications below this block)CMC_API_KEY(CoinMarketCap API key for WBTC USD estimates)
Telegram notifications (mainnet only):
TELEGRAM_BOT_TOKENTELEGRAM_CHAT_IDTELEGRAM_BOT_TOKEN_CRITICAL_ALERTSTELEGRAM_CHAT_ID_CRITICAL_ALERTS
- Install dependencies.
- Configure env vars.
- Start Postgres (optional Docker Compose).
- Run the indexer.
yarn codegen: generate Checkpoint modelsyarn dev: run in watch mode (includes codegen)yarn build: compile TypeScriptyarn start: run compiled buildyarn lint: lint and autofix
- Start Postgres using docker-compose.yml.
- Run
yarn dev. - Open the GraphQL endpoint at http://localhost:3000.
The GraphQL API is mounted at /.
- Mainnet and sepolia are indexed in the same process with separate contexts.
- New collateral branches are discovered from USDU events and templates are attached for:
TroveManagerEventsEmitterTroveNFTBatchManager
- Telegram notifications are skipped for historical events and for non-mainnet indexers.
MIT