Ali3NDistribution of Swappers By Their AVAX Balance (Avalanche Pangolin)
    Updated 8 hours ago
    with timetable as (
    select case when '{{TimeFrame}}' = 'Last 7 Days' then 7
    when '{{TimeFrame}}' = 'Last 30 Days' then 30
    when '{{TimeFrame}}' = 'Last 60 Days' then 60
    when '{{TimeFrame}}' = 'Last 90 Days' then 90
    when '{{TimeFrame}}' = 'Last 180 Days' then 180
    when '{{TimeFrame}}' = 'Last 365 Days' then 365
    when '{{TimeFrame}}' = 'All Time' then 5000
    else 5000 end as timeframe),

    maintable as (
    select origin_from_address,
    count (distinct tx_hash) as Swaps_Count
    from avalanche.defi.ez_dex_swaps t1
    join timetable
    where platform = 'pangolin'
    and block_timestamp >= CURRENT_DATE - timeframe
    group by 1),

    receivetable as (
    select to_address as receiver,
    sum (amount) as Received_Volume
    from avalanche.core.ez_native_transfers
    where to_address in (select distinct origin_from_address from maintable)
    group by 1),

    sendtable as (
    select from_address as sender,
    sum (amount) as sent_volume
    from avalanche.core.ez_native_transfers
    where from_address in (select distinct origin_from_address from maintable)
    group by 1),

    balancetable as (
    select sender as AVAX_Holder,
    sum (received_volume - sent_volume) as Avax_Balance
    Last run: about 8 hours agoAuto-refreshes every 12 hours
    TYPE
    COUNT (DISTINCT AVAX_HOLDER)
    1
    < 1 $AVAX880410
    2
    1 - 10 $AVAX154565
    3
    10 - 100 $AVAX36243
    4
    100 - 1000 $AVAX5357
    5
    > 1000 $AVAX826
    5
    118B
    34s