feat: modularize ponder config with per-chain src/chains/ (COW-978)#67
Conversation
Deploy M3
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>
yvesfracari
left a comment
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
| }, | ||
| flashLoanRouter: "0x9da8B48441583a2b93e2eF8213aAD0EC0b392C69", // confirmed via ROUTER() on Gnosis AaveV3AdapterFactory | ||
| aaveV3AdapterFactory: "0xdeCc46a4b09162f5369c5c80383aaa9159bcf192", // verified on Gnosisscan | ||
| contractPollerInterval: 4, // ~20s — avoids wasteful RPC calls given 1,461+ generators |
There was a problem hiding this comment.
would derivate this from chain time
- 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>
yvesfracari
left a comment
There was a problem hiding this comment.
In my understanding this PR should add all the cow deployed chains as well. However, there are multiple missing (BNB, Avalanche, etc)
| 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 |
There was a problem hiding this comment.
In my understanding this should be done on this PR, right?
| 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", |
There was a problem hiding this comment.
nitpick, would change it to orderbookApiPath with only arbitrum_one
Summary
src/chains/, one file per chain (mainnet.ts,gnosis.ts,arbitrum.tsstub)src/chains/index.tsexportsACTIVE_CHAINS: ChainConfig[];ponder.config.tsbecomes a pure derivation with no hardcoded addressessrc/chains/index.tsChanges
src/chains/types.ts—ChainConfiginterface with all per-chain fieldssrc/chains/mainnet.ts,src/chains/gnosis.ts— full chain configssrc/chains/arbitrum.ts— placeholder with commented-out config (addresses not yet confirmed)src/chains/index.ts— exportsACTIVE_CHAINSand re-exportsChainConfigponder.config.ts— all config derived viaObject.fromEntries(ACTIVE_CHAINS.map(...)); importsCoWShedFactoryAbiandGPv2SettlementAbidirectlysrc/data.ts— removed per-chain deployment objects;BLOCK_TIME_SECONDS,COMPOSABLE_COW_ADDRESS_BY_CHAIN_ID,AAVE_V3_ADAPTER_FACTORY_ADDRESSES,GPV2_SETTLEMENT_DEPLOYMENTS, andORDERBOOK_API_URLSnow derived fromACTIVE_CHAINSHow to Test
pnpm codegen— should complete without errorspnpm typecheck— should passpnpm lint— should passgnosisinsrc/chains/index.tsand verifypnpm typecheckstill passes (single-chain deploy works)Breaking Changes
None — runtime behavior is identical.
src/data.tsno longer exportsCOMPOSABLE_COW_DEPLOYMENTS,ComposableCowContract,COW_SHED_FACTORY_DEPLOYMENTS,CoWShedFactoryContract,GPv2SettlementContract, orFLASH_LOAN_ROUTER_ADDRESSES; the only consumers wereponder.config.ts(now using chains directly).Related Issues
COW-978