Query editor
/* ============================================================================CADC · Aerodrome pool-level volume — reconciliation query (v2, COST-FIXED)----------------------------------------------------------------------------WHY: @mrfrost931's two Aerodrome pools show ~400M (CADC/USDC cl-10) + ~80M(CADC/WETH) = ~480M CADC cumulative. 02_dex_volume.sql, built on the curateddex.trades spellbook, reports only 293.85M for the WHOLE of Base. Two poolscannot exceed the whole chain, so one of them is wrong. Hypothesis:dex.trades under-covers Aerodrome Slipstream (CL) pools.*** v1 WAS DANGEROUS: it filtered aerodrome_base.clpool_evt_swap by DATEONLY, which scans every Aerodrome CL swap on Base (one of the largest DEXeson that chain). Cancelled mid-flight. v2 pins contract_address to thespecific CADC-touching pool candidates already identified by recon 0d, sothe scan is pruned hard. ****** ALSO: never JOIN a VALUES CTE against a big partitioned table to filterit. Trino does not reliably push that predicate into the scan. Query 8390957did exactly that and burned 2,150 + 2,500 credits on two resource-capfailures. Use literal IN lists, as below. ***Pool candidates from recon 0d (base CADC counterparties, in ~= out, hightransfer counts = pool or router):0x09da4832d34bebbb55783340d5bede7a70f5c48e 297.6M in / 297.5M out (168k/164k)0x3debc1a83ede28e30baaa43f9fa110e052d4ccdd 62.0M in / 62.0M out (193k/182k)0x61040e143a77f165ba44543af4a079f2c809d14b 64.0M in / 64.0M out (14k/14k)0x3cbf80e2b57dca2b78e40fdeb0c08340a6818586 37.4M0xe708c0a4595de83135a8732ab87f2706d1ace7f7 35.9M0xa07fd9cf6bc47577e919bf241e925dadba3706e2 33.1M0xad4f8f6098232b250f2be2efd02248731246915d 29.2M (exactly equal bothsides, 70,980 each = router)0x6e4141d33021b52c91c28608403db4a0ffb50ec6 25.7MThe swap-event join below decides which of these are genuinely Aerodromepools — routers will not appear in clpool_evt_swap/pool_evt_swap ascontract_address.METHOD: sum the CADC transfer legs touching a pool in a tx that emitted aswap on that pool. A swap crosses the pool boundary once, so each swap iscounted once. Joining on the swap event is what excludes LP add/remove(those transfer CADC too but emit Mint/Burn, not Swap).NOTE: this is DEX volume, a subset. Aerodrome CL swaps are ALREADY inside01/07's Base gross figure, because tokens.transfers sees every ERC-20Transfer whether or not the pool is decoded.========================================================================= */WITHpool_candidate (addr) AS (VALUES(0x09da4832d34bebbb55783340d5bede7a70f5c48e),(0x3debc1a83ede28e30baaa43f9fa110e052d4ccdd),(0x61040e143a77f165ba44543af4a079f2c809d14b),(0x3cbf80e2b57dca2b78e40fdeb0c08340a6818586),(0xe708c0a4595de83135a8732ab87f2706d1ace7f7),(0xa07fd9cf6bc47577e919bf241e925dadba3706e2),(0xad4f8f6098232b250f2be2efd02248731246915d),(0x6e4141d33021b52c91c28608403db4a0ffb50ec6)),/* Literal IN list -> pruned scan. Do NOT convert this to a join. */