adriaparcerisasdau base swaps 2
    Updated 2023-08-07
    WITH
    daus as (
    SELECT
    distinct from_address as users,
    trunc(block_timestamp,'week') as weeks,
    count(distinct trunc(block_timestamp,'day')) as active_days
    from base.core.fact_transactions
    where origin_function_signature in ('0xfe029156','0x5c11d795','0x7ff36ab5')
    group by 1,2
    having active_days>=4
    ),
    active_users as (
    SELECT
    distinct from_address as user,
    min(block_timestamp) as debut
    from base.core.fact_transactions
    where from_address in (select users from daus)
    and origin_function_signature in ('0xfe029156','0x5c11d795','0x7ff36ab5')

    group by 1
    )
    select
    trunc(debut,'week') as date,
    count(distinct user) as new_DAUs,
    sum(new_DAUs) over (order by date) as "Total new DAUs"
    from active_users
    where date>=current_date-interval '{{Months}} MONTHS'
    and date<current_date
    group by 1
    order by 1 asc