Skip to main content
Track dynamically created contracts with evmEventDecoder().
Parameters:
  • address: Factory contract address or array of addresses (required)
  • event: Factory creation event ABI or filtered event object (required)
    • Simple format: AbiEvent<T> - Capture all factory events
    • Filtered format: { event: AbiEvent<T>, params: {...} } - Filter by indexed parameters
    Events should be specified using the same approach as evmEventDecoder() itself uses.
  • childAddressField: How to extract the child contract address from the decoded factory event (required). Either
    • a key of the decoded event data (e.g. 'pool'), or
    • a function (decodedEventData) => string | null. Return null to skip the event.
  • database: A factory store that persists the list of known child contracts (required). Accepts a FactoryPersistentAdapter instance or a Promise resolving to one, so you can pass the result of contractFactorySqliteStore() directly.
Example:
Filtered factory events:
Only indexed event parameters can be used in the params object. Another way to look at it is that parameter values should be available as event topics. Reference.

contractFactorySqliteStore

Create an SQLite factory database: an object used to persist the list of child contracts in a fork-aware way. For now, only SQLite-based factory databases are supported.
The returned promise can be passed to contractFactory()’s database option as is.