Factory Contracts

Dynamically discover and index child contracts as they're deployed.

Configuration

Instead of a static address, define a [contracts.factory] block that tells Sieve how to find child contracts.

sieve.toml
[[contracts]]
name = "UniswapV3Pool"
abi = "abis/uniswap_v3_pool.json"

[contracts.factory]
address = "0x1F98431c8aD98523631AE4a59f267346ea31F984"
event = "PoolCreated"
param = "pool"
start_block = 12_369_621
address · required the factory contract address
event · required creation event name (e.g. PoolCreated, PairCreated)
param · required event parameter that holds the child contract address
start_block · required block to start scanning for factory events
abi · optional factory ABI (defaults to the parent contract's ABI)

How it works

Sieve scans the factory contract for creation events starting from start_block. Each time a new child address is found, it's registered dynamically. All events and calls defined on the parent contract are then indexed for every discovered child.

A contract_address column is automatically added to every table so you can distinguish which child contract emitted each event.

Key rules

The parent contract must NOT have an address field. A contract is either static (has address) or factory-based (has factory block), never both.
The event must exist in the factory ABI, and parameter must be a parameter in that event.
Children inherit the parent's events and calls config. You define them once on the parent.

Next steps

Streaming push indexed events to webhooks or RabbitMQ