Afonso_DiazSwapper Breakdown
    Updated 2025-05-11
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    nvl(amount_in_usd, amount_out_usd) as amount_usd,
    origin_from_address as swapper,
    symbol_in,
    symbol_out,
    regexp_replace(platform, '-v.*', '') as platform
    from
    avalanche.defi.ez_dex_swaps
    where
    origin_to_address = '0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31' -- metamask: swap router
    ),

    swappers as (
    select
    swapper,
    count(distinct tx_hash) as swaps
    from
    main
    group by 1
    )

    select
    case
    when swaps = 1 then 'One-Time Swapper'
    when swaps <= 3 then 'Occasional Swapper (2-3 Swaps)'
    when swaps <= 7 then 'Regular Swapper (4-7 Swaps)'
    when swaps <= 15 then 'Engaged Swapper (8-15 Swaps)'
    when swaps <= 30 then 'Heavy Swapper (16-30 Swaps)'
    else 'Elite Swapper (30+ Swaps)'
    end as type,
    count(distinct swapper) as swappers
    QueryRunArchived: QueryRun has been archived