feat: modularize ponder config with per-chain src/chains/ (COW-978)#67
Conversation
… (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
…W-978) Every chain in cow-sdk's ALL_SUPPORTED_CHAIN_IDS now has a config file in src/chains/. New stubs (BNB, Polygon, Lens, Plasma, Avalanche, Ink, Linea) follow the same pattern as existing stubs — composableCow address is the known CREATE2 deployment; all other addresses are null with TODOs pointing to the relevant block explorer. None are active until addresses are confirmed (tracked in COW-986). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…der-config-per-chain-files-under-srcchains' into luizhatem/cow-986-support-all-cow-protocol-chain-ids-bnb-ink-linea-etc
…(COW-986) Add verified ComposableCoW deployment blocks where confirmed on-chain via cowprotocol/composable-cow networks.json cross-referenced with block explorers and public RPC nodes. Also verify orderbook API URLs against cow-sdk ORDER_BOOK_PROD_CONFIG source. Verified startBlocks: - Arbitrum (42161): 204751436 (networks.json + arbiscan) - Base (8453): 21794150 (basescan, 2024-10-31) - Sepolia (11155111): 5072748 (networks.json + sepolia.etherscan.io, 2024-01-12) - BNB (56): 48433175 (networks.json + bscscan.com, 2025-04-17) - Polygon (137): 70406888 (polygonscan.com, 2025-04-17) - Lens (232): 3516559 (networks.json + rpc.lens.xyz, 2025-09) - Plasma (9745): 4810535 (networks.json + rpc.plasma.to) - Avalanche (43114): 60434336 (snowscan.xyz, 2025-04-17) - Ink (57073): 34878187 (Blockscout API + rpc-gel.inkonchain.com) - Linea (59144): 25028474 (networks.json + lineascan.build) Verified orderbook API URLs (all return HTTP 200 from api.cow.fi): - bnb, polygon, plasma, avalanche, ink, linea — confirmed active - lens — NOT yet in cow-sdk ORDER_BOOK_PROD_CONFIG; api.cow.fi/lens returns 404 Also restore CHAIN_NAMES export in src/data.ts (removed during merge conflict resolution) — derived from ACTIVE_CHAINS.name instead of the old getChainInfo(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rbookApiUrl to orderbookApiPath (COW-978) - Remove contractPollerInterval field from ChainConfig; compute inline in ponder.config.ts via pollerInterval() - Rename orderbookApiUrl -> orderbookApiPath storing only the path suffix (e.g. "mainnet", "xdai") - Update src/data.ts to construct full URL from path: https://api.cow.fi/${c.orderbookApiPath} - Update all 12 chain files accordingly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…978) Replace placeholder startBlocks (0 / rough estimates) with values verified from cowprotocol/composable-cow networks.json and block explorers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…b-ink-linea-etc' into luizhatem/cow-978-modularize-ponder-config-per-chain-files-under-srcchains Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…2Settlement for 5 chains (COW-978) All addresses confirmed on-chain via ROUTER() call. Deployment blocks verified by binary search on each chain's RPC. Chains: arbitrum, base, avalanche, linea, polygon Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…2Settlement for BNB and Plasma (COW-978) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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