Sbhn_NP2023-09-13 12:20 PM
    Updated 2023-12-13
    with base as (select address
    from avalanche.core.dim_labels
    where project_name ilike '%benqi%'),

    new_users as (
    select origin_from_address ,
    min(block_timestamp::date) as min_date
    from avalanche.core.ez_decoded_event_logs
    where origin_to_address in (select address from base)
    group by 1
    ),

    unique_users as (
    select origin_from_address,
    block_timestamp
    from avalanche.core.ez_decoded_event_logs
    where origin_to_address in (select address from base)
    )

    select 'New Users' as type,
    date_trunc('day',min_date) as date,
    count(DISTINCT origin_from_address) as users
    from new_users
    where date >= '2023-08-01'
    group by 1,2

    union all

    select 'Unique Users' as type,
    date_trunc('day',block_timestamp) as date,
    count(DISTINCT origin_from_address) as users
    from unique_users
    where date >= '2023-08-01'
    group by 1,2

    Run a query to Download Data