FatemeTheLadyTop 10 Addresses copy
    Updated 2023-05-05
    -- forked from Top 10 Addresses @ https://flipsidecrypto.xyz/edit/queries/411acc29-0e3d-407c-9060-1ba7c5c4f884

    with top_ as
    (select
    origin_from_address as address,
    count(distinct tx_hash) as swaps
    from
    avalanche.core.ez_dex_swaps
    where block_timestamp::date between '{{StartDate}}' and '{{EndDate}}'
    group by 1
    order by 2 desc
    )

    select
    date_trunc('{{Interval}}',block_timestamp) as "TimeStamp",
    count(distinct tx_hash) as "Swaps",
    count(distinct origin_from_address) as "Active users",
    sum("Swaps") over(order by "TimeStamp" asc) as "cumulative swaps",
    sum("Active users") over(order by "TimeStamp" asc) as "cumulative active users"
    from
    avalanche.core.ez_dex_swaps
    where origin_from_address in (select address from top_)
    and block_timestamp::date between '{{StartDate}}' and '{{EndDate}}'
    group by 1
    order by 1 asc