Older OptionBook Indexer API

Core OptionBook Contract Indexer - Tracks events from OptionBook contract on Base network

Choose the correct indexer

This page documents the older optionbook-indexer.thetanuts.finance/api/v1 service used by existing apps. It is separate from the current V4 SDK indexer.

For new SDK integrations, use https://indexer.thetanuts.finance/api/v1/book for presigned maker-order execution history and /api/v1/factory for RFQs. Check book stats, factory stats, and the current SDK guide.

Do not copy the paths or response shapes below onto the current host. Check indexed contracts and checkpoints for the service you use. The separate old OF indexer is retired.

Contract callbacks and external webhook integration

Overview

Purpose

Indexes and tracks events from OptionBook contract on Base network, providing API access to options data and trading analytics.

Network

Base Mainnet (Chain ID: 8453)

Contract

OptionBook: 0x1bDff855d6811728acaDC00989e79143a2bdfDed

Deploy Block

36605331

Update Frequency

Every 5 minutes (cron trigger)

Features

Real-time event indexing, user position tracking, options data aggregation, and trading analytics.

Configuration Details

Price Feeds
ETH Price Feed

Address: 0x71041dddad3595f9ced3dccfbe3d1f4b0a16bb70
Decimals: 8

BTC Price Feed

Address: 0x64c911996d3c6ac71f9b455b1e8e7266bcbd848f
Decimals: 8

Collateral Tokens
USDC

Address: 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
Decimals: 6

WETH

Address: 0x4200000000000000000000000000000000000006
Decimals: 18

CBBTC

Address: 0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf
Decimals: 8

Option Types
0x0000

ETH Call (Inverse Vanilla Call)

0x0101

ETH Put (Vanilla Put)

Operational Configuration

Worker Settings
UPDATE_COOLDOWN

10 seconds - Minimum time between manual updates

BATCH_SIZE

50,000 blocks - Maximum blocks per RPC batch

STATE_FRESHNESS_WINDOW

15 seconds - Cache validity period

API Endpoints

GET /api/v1/state Get complete indexer state (debug/admin)
Response

Returns the full internal state object including all positions, user mappings, and events. This endpoint is useful for debugging and administration.

{ "lastProcessedBlock": 36610000, "unsafe": 36610000, "unsafeHash": "0xabcd...", "finalized": 36609900, "indexedOptionBookAddress": "0x1bdff855d6811728acadc00989e79143a2bdfded", "lastUpdateRequest": 1704067200000, "updateCount": 42, "currentExpiry": 1704067200, "settlementPrices": { "0x71041dddad3595f9ced3dccfbe3d1f4b0a16bb70": "200000000000" }, "positions": { "0x1234...": { "address": "0x1234...", "status": "open", "entryTimestamp": 1703980800, "entryTxHash": "0xabc...", "entryBlock": 36605500, "orderFilledData": { }, "initializedData": { }, "settlementData": null, "closeData": null } }, "userPositions": { "0x742d35...": { "open": ["0x1234..."], "history": [] } }, "events": { "0x1234...": [ { "name": "OptionInitialized", "blockNumber": 36605500, "txHash": "0xabc...", "logIndex": 42, "timestamp": 1703980800, "args": { } } ] }, "lastUpdateTimestamp": 1704067200000 }
200 OK
GET /api/v1/option-events/{address} Get option position and all events for a specific option
Path Parameters
Parameter Type Required Description
address string Required Option contract address
Response
{ "address": "0x1234567890abcdef1234567890abcdef12345678", "position": { "address": "0x1234567890abcdef1234567890abcdef12345678", "status": "open", "buyer": "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6", "seller": "0x9876...", "entryPremium": "50000", "entryFeePaid": "5000", "optionTypeRaw": 257, "collateralToken": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "strikes": ["2000000000"], "expiryTimestamp": 1704067200, "numContracts": "5", "collateralAmount": "5000000", "underlyingAsset": "ETH", "collateralSymbol": "USDC" }, "events": [ { "name": "OptionInitialized", "blockNumber": 36605500, "txHash": "0xtxhash...", "logIndex": 42, "timestamp": 1703980800, "args": { } } ], "eventCount": 1 }
200 OK 404 Not Found
GET /api/v1/open-positions Get all open positions
Response
{ "count": 75, "positions": [ { "address": "0x1234567890abcdef1234567890abcdef12345678", "status": "open", "buyer": "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6", "seller": "0x9876...", "entryPremium": "50000", "entryFeePaid": "5000", "optionTypeRaw": 257, "collateralToken": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "strikes": ["2000000000"], "expiryTimestamp": 1704067200, "numContracts": "5", "collateralAmount": "5000000", "underlyingAsset": "ETH", "collateralSymbol": "USDC", "settlement": { "settlementPrice": null, "payoutBuyer": null, "collateralReturnedSeller": null } } ] }
200 OK
GET /api/v1/user/{address}/{type} Get user positions or history
Path Parameters
Parameter Type Required Description
address string Required User's Ethereum address
type string Required Either "positions" or "history"
Response
[ { "address": "0x1234567890abcdef1234567890abcdef12345678", "status": "open", "buyer": "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6", "seller": "0x9876...", "entryPremium": "50000", "entryFeePaid": "5000", "optionTypeRaw": 257, "collateralToken": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", "strikes": ["2000000000"], "expiryTimestamp": 1704067200, "numContracts": "5", "collateralAmount": "5000000", "underlyingAsset": "ETH", "collateralSymbol": "USDC", "settlement": { "settlementPrice": null, "payoutBuyer": null, "collateralReturnedSeller": null } } ]
200 OK 404 Not Found
GET /api/v1/stats Get platform statistics
Response
{ "totalOptionsTracked": 150, "openPositions": 75, "settledPositions": 50, "closedPositions": 25, "uniqueUsers": 85, "lastProcessedBlock": 36610000, "lastUpdateTimestamp": 1704067200000 }
200 OK
POST /api/v1/update Trigger manual state update
Response
{ "status": "success", "message": "State updated", "startBlock": 36610001, "endBlock": 36610500, "processedEvents": 25, "newPositions": 3, "updatedPositions": 8, "errors": [] }
200 OK 500 Internal Error

CORS Configuration

This API allows cross-origin requests from all origins (Access-Control-Allow-Origin: *) to facilitate easy integration.