Skip to content

feat: modularize ponder config with per-chain src/chains/ (COW-978)#67

Open
lgahdl wants to merge 4 commits into
developfrom
luizhatem/cow-978-modularize-ponder-config-per-chain-files-under-srcchains
Open

feat: modularize ponder config with per-chain src/chains/ (COW-978)#67
lgahdl wants to merge 4 commits into
developfrom
luizhatem/cow-978-modularize-ponder-config-per-chain-files-under-srcchains

Conversation

@lgahdl
Copy link
Copy Markdown
Contributor

@lgahdl lgahdl commented May 28, 2026

Summary

  • Extract per-chain contract addresses and config into src/chains/, one file per chain (mainnet.ts, gnosis.ts, arbitrum.ts stub)
  • A central src/chains/index.ts exports ACTIVE_CHAINS: ChainConfig[]; ponder.config.ts becomes a pure derivation with no hardcoded addresses
  • Enabling or disabling a chain is a single commented/uncommented line in src/chains/index.ts

Changes

  • Added src/chains/types.tsChainConfig interface with all per-chain fields
  • Added src/chains/mainnet.ts, src/chains/gnosis.ts — full chain configs
  • Added src/chains/arbitrum.ts — placeholder with commented-out config (addresses not yet confirmed)
  • Added src/chains/index.ts — exports ACTIVE_CHAINS and re-exports ChainConfig
  • Refactored ponder.config.ts — all config derived via Object.fromEntries(ACTIVE_CHAINS.map(...)); imports CoWShedFactoryAbi and GPv2SettlementAbi directly
  • Updated src/data.ts — removed per-chain deployment objects; BLOCK_TIME_SECONDS, COMPOSABLE_COW_ADDRESS_BY_CHAIN_ID, AAVE_V3_ADAPTER_FACTORY_ADDRESSES, GPV2_SETTLEMENT_DEPLOYMENTS, and ORDERBOOK_API_URLS now derived from ACTIVE_CHAINS

How to Test

  1. pnpm codegen — should complete without errors
  2. pnpm typecheck — should pass
  3. pnpm lint — should pass
  4. Comment out gnosis in src/chains/index.ts and verify pnpm typecheck still passes (single-chain deploy works)

Breaking Changes

None — runtime behavior is identical. src/data.ts no longer exports COMPOSABLE_COW_DEPLOYMENTS, ComposableCowContract, COW_SHED_FACTORY_DEPLOYMENTS, CoWShedFactoryContract, GPv2SettlementContract, or FLASH_LOAN_ROUTER_ADDRESSES; the only consumers were ponder.config.ts (now using chains directly).

Related Issues

COW-978

jeffersonBastos and others added 3 commits May 6, 2026 10:39
feat: COW-970/972/973/969/922 — timestamp policy, candidate expiry, ownerAddressType, GQL docs, bootstrap retry queue
… (COW-978)

Extract per-chain addresses into src/chains/{mainnet,gnosis,arbitrum}.ts with
a central ACTIVE_CHAINS index. ponder.config.ts now derives all config with no
hardcoded addresses. Toggling a chain requires one line in src/chains/index.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 28, 2026

COW-978

Copy link
Copy Markdown

@yvesfracari yvesfracari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are multiple mainnet and gnosis mentions on docs and etc that will be outdated once a new chain is added. Also, the chain ids supported should be imported from cow-sdk as Anxo said to us on the feedback, making missing chains be throw by typescript error. Let me know if you think that this should be addressed on another PR

Comment thread src/chains/arbitrum.ts
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should add all current cow chains in this PR and just having somekind of filter to only run gnosis and mainnet.

Comment thread src/chains/gnosis.ts Outdated
},
flashLoanRouter: "0x9da8B48441583a2b93e2eF8213aAD0EC0b392C69", // confirmed via ROUTER() on Gnosis AaveV3AdapterFactory
aaveV3AdapterFactory: "0xdeCc46a4b09162f5369c5c80383aaa9159bcf192", // verified on Gnosisscan
contractPollerInterval: 4, // ~20s — avoids wasteful RPC calls given 1,461+ generators
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would derivate this from chain time

@lgahdl lgahdl changed the base branch from main to develop May 28, 2026 16:52
- Use SupportedChainId from @cowprotocol/cow-sdk for chainId typing in ChainConfig
- Derive contractPollerInterval from blockTime via pollerInterval() helper (~20s target)
- Add arbitrum, base, and sepolia chain config files (cowShedFactory/gpv2Settlement
  marked null until addresses are confirmed)
- Export ALL_DEFINED_CHAINS for ORDERBOOK_API_URLS; ACTIVE_CHAINS stays mainnet+gnosis
- Make cowShedFactory nullable in ChainConfig; filter in ponder.config.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lgahdl lgahdl requested a review from yvesfracari May 28, 2026 20:21
Copy link
Copy Markdown
Contributor

@jeffersonBastos jeffersonBastos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown

@yvesfracari yvesfracari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my understanding this PR should add all the cow deployed chains as well. However, there are multiple missing (BNB, Avalanche, etc)

Comment thread src/chains/base.ts
Comment on lines +18 to +21
cowShedFactory: null, // TODO: confirm CoWShedFactory address on Base
gpv2Settlement: null, // TODO: enable once AaveV3AdapterFactory is confirmed on Base
flashLoanRouter: null, // TODO: confirm via ROUTER() on Base AaveV3AdapterFactory
aaveV3AdapterFactory: null, // TODO: verify on Basescan
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my understanding this should be done on this PR, right?

Comment thread src/chains/arbitrum.ts
flashLoanRouter: null, // TODO: confirm via ROUTER() on Arbitrum AaveV3AdapterFactory
aaveV3AdapterFactory: null, // TODO: verify on Arbiscan
contractPollerInterval: pollerInterval(blockTime),
orderbookApiUrl: "https://api.cow.fi/arbitrum_one",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick, would change it to orderbookApiPath with only arbitrum_one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants