adriaparcerisasdau avax cex 1.2
    Updated 2024-04-17
    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 avalanche.core.fact_transactions
    group by 1,2
    having active_days>=4
    ),
    news_receivers as (
    SELECT
    distinct origin_from_address,
    min(trunc(block_timestamp,'day')) as debut
    from avalanche.core.ez_token_transfers x
    where to_address in (select distinct address from avalanche.core.dim_labels where label_type='cex')
    group by 1
    ),
    news_senders as (
    SELECT
    distinct origin_from_address,
    min(trunc(block_timestamp,'day')) as debut
    from avalanche.core.ez_token_transfers x
    where from_address in (select distinct address from avalanche.core.dim_labels where label_type='cex')
    group by 1
    ),
    active_users as (
    select 'New users receiving from CEX' as type,* from news_receivers
    union select 'New users sending to CEX' as type, * from news_senders
    )
    select
    debut as date,type,count(distinct origin_from_address) as new_users
    from active_users
    where date>=current_date-interval '{{Months}} MONTHS' and date<trunc(current_date,'week')
    group by 1,2
    QueryRunArchived: QueryRun has been archived