Afonso_Diaz2023-05-11 07:51 PM
    Updated 2023-05-11
    with

    t as (
    select
    origin_from_address,
    min(block_timestamp)::date as min_date
    from polygon.core.ez_dex_swaps
    where platform like 'uniswap%'
    group by 1
    ),

    t2 as (
    select
    origin_from_address as new_user
    from t
    where min_date > current_date - interval '12 months'
    group by 1
    ),

    t3 as (
    select
    tx_hash,
    block_timestamp,
    origin_from_address as user,
    amount_in_usd as amount_usd
    from polygon.core.ez_dex_swaps
    where platform like 'uniswap%'
    and block_timestamp > current_date - interval '12 months'
    and origin_from_address in (select distinct new_user from t2)
    ),

    t4 as (
    select
    user,
    count(distinct tx_hash) as transactions,
    sum(amount_usd) as volume_usd
    Run a query to Download Data