Development
Configuration
The project features a highly modular and type-safe configuration system located in src/config/
. This structure replaced a monolithic approach, making the system easier to maintain and scale.
Chains:
src/config/chains/
- Each chain has its own configuration file defining its ID, RPC, start blocks, and contract addresses.Contracts:
src/config/contracts/
- Contract definitions are generated dynamically based on the chain configurations. This avoids manual repetition.Blocks:
src/config/blocks/
- Defines periodic tasks (like oracle updates) that run at set block intervals.
This modularity means that adding a new chain or contract is a simple, isolated task with minimal risk to existing configurations.
Adding a New Chain
Create a new file
src/config/chains/newchain.ts
with theChainConfig
structure.Add all relevant contract addresses for the new chain.
Export the config and add it to the
chainConfigs
object insrc/config/chains/index.ts
.Add the corresponding RPC environment variable to
.env.example
and your local.env.local
.
Adding a New Contract
Add the contract ABI file to the appropriate directory in
src/abis/
.Update the contract configuration generators in
src/config/contracts/
to include the new contract.If the contract is a factory, create a new factory helper in
src/config/contracts/factories.ts
.Add the new event handler logic in the relevant
src/indexer/indexer-v*.ts
file.
Code Generation
After making changes to the database schema (ponder.schema.ts
), you must regenerate the Ponder types.
pnpm codegen
This ensures that all database interactions and API types are updated to reflect your schema changes.
Last updated