ArioDaily DEX Users - Base copy
    Updated 2023-12-17
    -- forked from Daily DEX Users - Base @ https://flipsidecrypto.xyz/edit/queries/8542173d-999b-49ad-a43d-862fc315b2f0

    with tab1 as (
    select
    ORIGIN_FROM_ADDRESS as User_address,
    min(BLOCK_TIMESTAMP) as min_date
    from base.defi.ez_dex_swaps
    where platform = '{{DEX}}'
    group by 1
    )
    select
    *,
    sum(New_users) over(order by date) as Total_Users
    from(
    select
    date_trunc(day, min_date) as date,
    count(DISTINCT User_address) as New_users,
    count(DISTINCT ORIGIN_FROM_ADDRESS) as All_Users,
    All_Users - New_users as Retained_users
    from tab1 a join base.defi.ez_dex_swaps b on a.min_date::date = b.BLOCK_TIMESTAMP::date
    where b.platform = '{{DEX}}'
    group by 1
    )


    Run a query to Download Data