Sbhn_NPdaily new users sushi
    Updated 2023-03-04
    with top_5 as (SELECT
    pool_name,
    sum(amount_in_usd) as swap_volume_usd
    FROM ethereum.core.ez_dex_swaps
    WHERE platform LIKE 'sushiswap'
    GROUP BY 1
    having swap_volume_usd>0
    ORDER BY 2 DESC
    LIMIT 5),

    neww_users as ( select
    origin_from_address,
    min(block_timestamp) as min_date
    from ethereum.core.ez_dex_swaps
    where platform like 'sushiswap'
    and pool_name in (select pool_name from top_5)
    group by 1
    )

    select date_trunc('day',min_date) as date,
    count(DISTINCT origin_from_address) as new_users,
    sum(new_users) over (order by date) as total_users
    from neww_users
    where date>= CURRENT_DATE -180
    group by 1
    Run a query to Download Data