From 2f1b0f478fbd51108bc34c580d6be4aa0f26e452 Mon Sep 17 00:00:00 2001 From: Etienne Donneger Date: Tue, 12 May 2026 17:06:47 -0400 Subject: [PATCH] fix(pools): exclude cow and dodo from /v1/evm/pools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both protocols are decoded from router/aggregator contracts, not liquidity pools. CoW's settlement contract (0x9008d19f…) batches and routes orders through external solvers and holds no liquidity. DODO's RouteProxy contracts are smart-routing entry points, not PMM pools. The decoders emit factory == pool == log.address — a single contract that "touches" thousands of unrelated pairs. In the existing aggregation MV (state_pools_aggregating_by_token), these contracts then map to every token they ever routed, so any ?input_token=X filter returns the contract with arbitrary token0/ token1 picked from the bag — observable as e.g. /v1/evm/pools? input_token=GRT returning rows where neither side is GRT. CoW + DODO swap records remain available via /v1/evm/swaps where they belong. Tracked for proper decoding in substreams-evm. Closes #526, #527 Co-Authored-By: Claude Opus 4.7 (1M context) --- src/routes/pools/evm.sql | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/routes/pools/evm.sql b/src/routes/pools/evm.sql index d69eaa29..2e3baed1 100644 --- a/src/routes/pools/evm.sql +++ b/src/routes/pools/evm.sql @@ -17,7 +17,12 @@ pools AS ( sum(transactions) as transactions FROM {db_dex:Identifier}.state_pools_aggregating_by_pool WHERE - (empty({input_token:Array(String)}) OR pool IN input_pools) + /* cow and dodo are decoded from router/aggregator contracts, not liquidity pools — + their factory == pool address is a single settlement/routing contract handling + thousands of unrelated pairs. They belong in /v1/evm/swaps, not /v1/evm/pools. + Tracked at https://github.com/pinax-network/substreams-evm */ + toString(protocol) NOT IN ('cow', 'dodo') + AND (empty({input_token:Array(String)}) OR pool IN input_pools) AND (empty({output_token:Array(String)}) OR pool IN output_pools) AND (empty({pool:Array(String)}) OR pool IN {pool:Array(String)}) AND (empty({factory:Array(String)}) OR factory IN {factory:Array(String)})