hbd19942023-05-15 05:15 AM
    Updated 2023-05-16
    with uniswap_first_dates as (
    select
    ORIGIN_FROM_ADDRESS as uni_users,
    min(BLOCK_TIMESTAMP) as first_swap_date
    from ethereum.core.ez_dex_swaps
    where PLATFORM ilike '%uniswap%'
    group by 1
    order by 2
    ),
    ethereum_new_users as (
    select
    FROM_ADDRESS as eth_users,
    min(BLOCK_TIMESTAMP) as first_tx_date
    from ethereum.core.fact_transactions
    where status = 'SUCCESS'
    group by 1
    order by 2
    ),
    uniswap_new_users_desired_period as (
    select *
    from uniswap_first_dates
    where first_swap_date::date > current_date - {{Days_From_Now}}),

    ethereum_new_users_desired_period as (
    select *
    from ethereum_new_users
    where first_tx_date::date > current_date - {{Days_From_Now}}),

    uniswap as (select
    first_swap_date::date as "Date",
    count(distinct uni_users) as "Uniswap Unique Users",
    sum("Uniswap Unique Users") over (order by "Date") as "Cumulative Uniswap Unique Users"
    from uniswap_new_users_desired_period a
    join ethereum_new_users b on uni_users = eth_users and first_swap_date=first_tx_date
    Group by 1
    order by 1),
    Run a query to Download Data