@darkpool/server processes. It polls Sui events on a configurable interval (INDEXER_POLL_MS, default 4000ms) and writes them to Postgres via Drizzle. Cursor state is persisted in the indexer_cursors table so restarts resume cleanly.
Streams
| Stream | Source | Destination table |
|---|---|---|
predict::PositionMinted | DeepBook Predict package | fills |
predict::PositionRedeemed | DeepBook Predict package | redemptions |
predict::oracle::* | DeepBook Predict package | oracles, oracle_strikes |
darkpool::oo_resolution::ProposalCreated etc. | DarkPool package | oo_proposals, oo_votes |
darkpool::agent::AgentRegistered | DarkPool package | agents |
darkpool::dark_pool::VaultCreated etc. | DarkPool package | dark_pool_vaults, dark_pool_deposits, dark_pool_settlements, dark_pool_redemptions |
binary::<slug>::settlement::Redeemed | per-market binary packages (registry) | redemptions (source = “binary”) |
binary::<slug> stream is created per .binary-markets/registry.json entry at startup. New markets need an indexer restart before their event stream exists.
Cursors
sui.queryEvents({ MoveEventType: … }) with the stored cursor; on success the new tail cursor is upserted in the same transaction.
Logs
Database schema
Drizzle schema lives inpackages/server/src/db/schema.ts. Migrations under packages/server/src/db/migrations/. Run:
migrate Docker service runs this as a one-shot at compose-up.
Inspection
What’s not indexed yet (v0.4 follow-ups)
binary::<slug>::settlement::MarketCreated/PairMinted/MarketResolvedare not indexed./v1/binary-marketsreads chain state directly, which is fine at this scale.predict_facade::*attribution events are not indexed. The router relies on the underlyingpredict::*events instead.- Pause / resume of agents is not indexed (no events emitted by Move). The UI reads
is_activelive viasui.getObject.