ArioBase-Distribution of DEXs' Users based on Swap Volume copy
    Updated 2024-04-09
    -- forked from Base-Distribution of DEXs' Users based on Swap Volume @ https://flipsidecrypto.xyz/edit/queries/fe8b10d7-30f7-4af0-a85e-b045e701f5b4

    with tab1 as (
    select
    ORIGIN_FROM_ADDRESS,
    sum(AMOUNT_IN_USD) as "Swap Volume"
    from base.defi.ez_dex_swaps
    where AMOUNT_IN_USD is not null
    and platform = '{{DEX}}'
    group by 1
    )
    select
    case when "Swap Volume" < 100 then 'A: < $100'
    when "Swap Volume" >=100 and "Swap Volume" < 500 then 'B: $100-$500'
    when "Swap Volume" >=500 and "Swap Volume" < 1000 then 'C: $500-$1K'
    when "Swap Volume" >=1000 and "Swap Volume" < 5000 then 'D: $1K-$5K'
    when "Swap Volume" >=5000 and "Swap Volume" < 10000 then 'E: $5K-$10K'
    when "Swap Volume" >=10000 and "Swap Volume" < 50000 then 'F: $10K-$50K'
    when "Swap Volume" >=50000 and "Swap Volume" < 100000 then 'F: $50K-$100K'
    else 'G: >= $100K'
    end as status,
    count(distinct ORIGIN_FROM_ADDRESS) as "# of Users"
    from tab1
    group by 1
    QueryRunArchived: QueryRun has been archived