Index factories
This page or paragraph is yet to be written. Come back later.
DipDup allows creating new indexes in runtime. To begin with, you need to define index templates in the top-level templates
section of the config. Then call ctx.add_contract
and ctx.add_index
methods from any user callback.
The most common way to spawn indexes is to create an index that tracks the originations of contracts with similar code or originated by a specific contract. A minimal example looks like this:
contracts:
registry:
address: KT19CF3KKrvdW77ttFomCuin2k4uAVkryYqh
indexes:
factory:
kind: operation
datasource: tzkt
types:
- origination
handlers:
- callback: on_factory_origination
pattern:
- type: origination
similar_to: registry
Another solution is to implement custom logic in on_restart
hook (see 5.3. Event hooks → on_restart)