Query editor
with cb as (select blockchain, venue, pool_id, block_date, sum(vol_usdt) as vol, sum(fee_lp_usd) as m_fee_lp, sum(fee_platform_usd) as m_fee_pffrom dune.gcm.result_metric_bench_cube_v2where ok and sane and venue in ('metric 2_beta', 'uniswap 3', 'pancakeswap 3', 'uniswap 4', 'aerodrome slipstream', 'aero cl')group by 1, 2, 3, 4), pools as (select blockchain, venue, pool_id, sum(vol) as vol,sum(case when block_date between date '2026-09-17' and date '2026-11-18' then vol end) as vol_epochs,sum(case when blockchain = 'base' and block_date >= date '2026-11-12' then vol else 0 end) as vol_after_pcs_change,sum(m_fee_lp) as m_fee_lp, sum(m_fee_pf) as m_fee_pffrom cb group by 1, 2, 3), v3c as (select 'ethereum' as blockchain, pool, fee from uniswap_v3_ethereum.factory_evt_poolcreatedunion all select 'base', pool, fee from uniswap_v3_base.uniswapv3factory_evt_poolcreatedunion all select 'arbitrum', pool, fee from uniswap_v3_arbitrum.factory_evt_poolcreatedunion all select 'bnb', pool, fee from uniswap_v3_bnb.factory_evt_poolcreatedunion all select 'ethereum', pool, fee from pancakeswap_v3_ethereum.pancakev3factory_evt_poolcreatedunion all select 'base', pool, fee from pancakeswap_v3_base.pancakev3factory_evt_poolcreatedunion all select 'arbitrum', pool, fee from pancakeswap_v3_arbitrum.pancakev3factory_evt_poolcreatedunion all select 'bnb', pool, fee from pancakeswap_v3_bnb.pancakev3factory_evt_poolcreated), ufp0 as (select 'ethereum' as blockchain, contract_address as pool, evt_block_time, feeProtocol0New as fp from uniswap_v3_ethereum.uniswapv3pool_evt_setfeeprotocolunion all select 'base', contract_address, evt_block_time, feeProtocol0New from uniswap_v3_base.uniswapv3pool_evt_setfeeprotocolunion all select 'arbitrum', contract_address, evt_block_time, feeProtocol0New from uniswap_v3_arbitrum.uniswapv3pool_evt_setfeeprotocolunion all select 'bnb', contract_address, evt_block_time, feeProtocol0New from uniswap_v3_bnb.uniswapv3pool_evt_setfeeprotocol), ufp as (select blockchain, pool, max_by(fp, evt_block_time) as fp, max(evt_block_time) as fp_set_timefrom ufp0 where evt_block_time < timestamp '2026-11-24' group by 1, 2), v4i as (select 'ethereum' as blockchain, id, fee as init_fee, hooks from uniswap_v4_ethereum.poolmanager_evt_initializeunion all select 'base', id, fee, hooks from uniswap_v4_base.poolmanager_evt_initializeunion all select 'arbitrum', id, fee, hooks from uniswap_v4_arbitrum.poolmanager_evt_initializeunion all select 'bnb', id, fee, hooks from uniswap_v4_bnb.poolmanager_evt_initialize), v4s0 as (select 'ethereum' as blockchain, id, fee, abs(cast(amount1 as double)) as w from uniswap_v4_ethereum.poolmanager_evt_swapwhere evt_block_date between date '2026-09-15' and date '2026-11-23' and id in (select pool_id from pools where venue = 'uniswap 4' and blockchain = 'ethereum')union allselect 'base', id, fee, abs(cast(amount1 as double)) from uniswap_v4_base.poolmanager_evt_swapwhere evt_block_date between date '2026-09-15' and date '2026-11-23' and id in (select pool_id from pools where venue = 'uniswap 4' and blockchain = 'base')union allselect 'arbitrum', id, fee, abs(cast(amount1 as double)) from uniswap_v4_arbitrum.poolmanager_evt_swapwhere evt_block_date between date '2026-09-15' and date '2026-11-23' and id in (select pool_id from pools where venue = 'uniswap 4' and blockchain = 'arbitrum')union allselect 'bnb', id, fee, abs(cast(amount1 as double)) from uniswap_v4_bnb.poolmanager_evt_swapwhere evt_block_date between date '2026-09-15' and date '2026-11-23' and id in (select pool_id from pools where venue = 'uniswap 4' and blockchain = 'bnb')), v4s as (select blockchain, id, sum(fee * w) / nullif(sum(w), 0) as fee_vw, min(fee) as fee_min, max(fee) as fee_max, count(*) as n_swapsfrom v4s0 group by 1, 2), tokm(blockchain, address, ref, dec) as (values('ethereum', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 'ETHUSDT', 18),('ethereum', 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48, 'USDCUSDT', 6),('ethereum', 0xdac17f958d2ee523a2206206994597c13d831ec7, 'ONE', 6),('ethereum', 0x2260fac5e5542a773aa44fbcfedf7c193bc2c599, 'BTCUSDT', 8),('ethereum', 0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf, 'BTCUSDT', 8),('base', 0x4200000000000000000000000000000000000006, 'ETHUSDT', 18),('base', 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913, 'USDCUSDT', 6),('base', 0xfde4c96c8593536e31f229ea8f37b2ada2699bb2, 'ONE', 6),('base', 0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf, 'BTCUSDT', 8),('base', 0x0555e30da8f98308edb960aa94c0db47230d2b9c, 'BTCUSDT', 8),