vendetta6are copy
    Updated 2023-02-23
    -- forked from f41a85c2-e709-442d-9121-f3a45bd9da95

    with new_users_first_currency_transfer as (select sender as first_user ,project_name as first_project , min(block_timestamp) as first_date
    from osmosis.core.fact_transfers inner join osmosis.core.dim_labels
    on currency=address
    group by 1,2)
    , new_users_first_currency_swapin as (select TRADER as first_user ,project_name as first_project , min(block_timestamp) as first_date
    from osmosis.core.fact_swaps inner join osmosis.core.dim_labels
    on from_CURRENCY=address
    group by 1,2)
    , new_users_first_currency_swapout as (select TRADER as first_user ,project_name as first_project , min(block_timestamp) as first_date
    from osmosis.core.fact_swaps inner join osmosis.core.dim_labels
    on to_CURRENCY=address
    group by 1,2)

    , results as
    (
    select first_user, first_project, first_date from (
    select first_user, first_project, first_date, ROW_NUMBER() OVER (PARTITION BY first_user ORDER BY first_date) as row_num from (
    select * from new_users_first_currency_transfer
    UNION
    select * from new_users_first_currency_swapin
    UNION
    select * from new_users_first_currency_swapout
    )) where row_num=1)

    select count(*) , first_project from results
    group by 2
    order by 1 desc
    limit 10


    Run a query to Download Data