Query editor
--Uniswap routers breakdown by volume traded over timeSELECTCASE--v2--https://docs.uniswap.org/contracts/v2/reference/smart-contracts/router-01--https://docs.uniswap.org/contracts/v2/reference/smart-contracts/router-02WHEN tx_to = 0xf164fC0Ec4E93095b804a4795bBe1e041497b92a then 'UniswapV2 - Router01'WHEN tx_to = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D then 'UniswapV2 - Router02'--v3--https://docs.uniswap.org/contracts/v3/reference/deployments/ethereum-deploymentsWHEN tx_to = 0xE592427A0AEce92De3Edee1F18E0157C05861564 then 'UniswapV3 - SwapRouter'WHEN tx_to = 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 then 'UniswapV3 - SwapRouter02'--universal router - aggregates across v2, v3 and v4--https://github.com/Uniswap/sdks/blob/main/sdks/universal-router-sdk/src/utils/constants.tsWHEN tx_to = 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD then 'UniversalRouterVersion.V1_2'WHEN tx_to = 0x66a9893cc07d91d95644aedd05d03f95e1dba8af then 'UniversalRouterVersion.V2_0'--UniswapX data not included in this table--WHEN tx_to = 0x00000011f84b9aa48e5f8aa8b9897600006289be then 'V2 Dutch Order Reactor'--WHEN tx_to = 0x6000da47483062A0D734Ba3dc7576Ce6A0B645C4 then 'V1 Exclusive Dutch Order Reactor'ELSE 'Pool Contract Interaction'END AS router,date_trunc('week', block_date) AS "week",sum(amount_usd) as volume,count(tx_hash) as tx_countFROMdex.tradesWHEREblockchain = 'ethereum'and project = 'uniswap'and version != '1'--and tx_to in (0xf164fC0Ec4E93095b804a4795bBe1e041497b92a,0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D,-- 0xE592427A0AEce92De3Edee1F18E0157C05861564,0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45,-- 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD,0x66a9893cc07d91d95644aedd05d03f95e1dba8af)GROUP BY1,2