tiloyeNumber of users
    Updated 2024-09-20
    with raw_swaps as (
    select
    block_timestamp::date as day,
    tx_hash,
    pool_name,
    symbol_in,
    symbol_out,
    amount_in_usd,
    amount_out_usd,
    sender,
    origin_from_address
    from ethereum.defi.ez_dex_swaps
    where block_timestamp >= current_date - 90
    and contract_address = '{{pool_address}}'
    ),

    swap_tx_count as (
    select
    origin_from_address,
    count(distinct tx_hash) as swap_count
    from raw_swaps
    group by 1
    )

    select
    case
    when swap_count = 1 then 'a. 1'
    when swap_count > 1 and swap_count <= 10 then 'b. 2 - 10'
    when swap_count > 10 then 'c. >10'
    end as swap_count_category,
    count(origin_from_address) as number_of_users
    from swap_tx_count
    group by swap_count_category
    QueryRunArchived: QueryRun has been archived