bertaPolygon new users
    Updated 2022-05-23
    with polygon_users as (
    select from_address, min(block_timestamp) as join_date
    from flipside_prod_db.polygon.transactions
    group by 1
    having year(join_date)=2022
    ),
    txs as (
    select *,
    case
    when (to_address = '0x0319000133d3ada02600f0875d2cf03d442c3367' or to_address = '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506')
    then 'sushi_users'
    else 'non_sushi_users'
    end as type,
    ROW_NUMBER() OVER (partition by from_address order by block_timestamp asc) as rank
    from flipside_prod_db.polygon.transactions
    where from_address in (select from_address from polygon_users)
    qualify rank = 2
    )
    select date_trunc('month',block_timestamp) as month,
    count(case when type = 'sushi_users' then 1 end) as source_users_sushi,
    count(case when type = 'non_sushi_users' then 1 end) as source_users_others
    from txs
    group by 1
    -- )

    Run a query to Download Data