elsinaDistribution of User Transactions
    Updated 2025-05-15
    with base as (
    SELECT
    block_timestamp,
    origin_from_address,
    tx_hash,
    pool_name,
    CASE
    WHEN amount_in_usd IS NOT NULL AND amount_out_usd IS NOT NULL THEN (amount_in_usd + amount_out_usd) / 2
    ELSE COALESCE(amount_in_usd, amount_out_usd)
    END AS amount
    from
    avalanche.defi.ez_dex_swaps
    where
    platform = 'pangolin' and
    amount_in_usd IS NOT NULL OR amount_out_usd IS NOT NULL
    ),


    per_user as (
    SELECT
    origin_from_address as user,
    count(distinct tx_hash) as tx_count
    from base
    group by user
    )

    select
    case
    when tx_count < 2 then 'A. 1'
    when tx_count < 4 then 'B. 2-3'
    when tx_count < 8 then 'C. 4-7'
    when tx_count < 16 then 'D. 8-15'
    when tx_count < 32 then 'E. 16-31'
    when tx_count < 64 then 'F. 32-63'
    when tx_count < 128 then 'G. 64-127'
    else 'H. more than 128' end as dis,
    QueryRunArchived: QueryRun has been archived