Afonso_Diazcategorized by active days
    Updated 2024-10-27
    with

    transactions as (
    select
    contract_address,
    tx_hash,
    block_timestamp,
    tx_fee,
    from_address as user
    from
    blast.core.fact_event_logs
    join
    blast.core.fact_transactions using (tx_hash, block_timestamp)
    where
    tx_status = 'SUCCESS'
    ),

    contracts as (
    select
    contract_address,
    count(distinct block_timestamp::date) as active_days,
    count(distinct tx_hash) as transactions,
    count(distinct user) as users
    from
    transactions
    where
    block_timestamp::date between '{{ start_date }}' and '{{ end_date }}'
    group by 1
    )

    select
    case
    when active_days <= 7 then 'a. 1 days - 1 week'
    when active_days <= 14 then 'b. 1 week - 2 weeks'
    when active_days <= 30 then 'c. 2 weeks - 1 month'
    when active_days <= 90 then 'd. 1 month - 3 months'
    QueryRunArchived: QueryRun has been archived