tiloyepool market share
    Updated 2024-09-20
    with top_5_pools as (
    select
    contract_address,
    pool_name,
    sum(iff(amount_in_usd is null, 0, amount_in_usd)) as usd_vol
    from ethereum.defi.ez_dex_swaps
    where platform = 'uniswap-v3'
    and contract_address != '{{pool_address}}'
    and block_timestamp >= current_date - 90
    group by contract_address, pool_name
    order by usd_vol desc
    limit 5
    ),
    v3_pools as (
    select *,
    iff(
    (contract_address != '{{pool_address}}') and (contract_address not in (select contract_address from top_5_pools)),
    'other', pool_name
    ) as pool_name_adj
    from ethereum.defi.ez_dex_swaps
    where platform = 'uniswap-v3'
    and block_timestamp >= current_date - 90
    )

    select
    block_timestamp::date as day,
    -- split(pool_name_adj, ' ')[0] as pool_name_adj,
    pool_name_adj,
    sum(amount_in_usd) as usd_vol
    from v3_pools
    group by day, pool_name_adj
    order by usd_vol asc
    QueryRunArchived: QueryRun has been archived