SleepyDaily unique contracts usage
    Updated 2023-03-23
    -- forked from 596beb9d-2782-41c5-a24f-93c95d58d1a7

    with hachathon_created_contracts as(
    select
    event_data:address,
    event_data:contract,
    replace(event_data:address,'0x','A.') || '.' || event_data:contract contract_address
    from flow.core.fact_events
    where block_timestamp::date between '2023-02-21' and '2023-02-28'
    and event_type = 'AccountContractAdded'
    ),
    interactions_with_new_contracts as(
    select
    *
    from flow.core.fact_events
    where block_timestamp::date >= '2023-02-21'
    and event_contract in (select contract_address from hachathon_created_contracts)
    )


    select
    date_trunc('day', interactions_with_new_contracts.block_timestamp) day,
    count(distinct event_contract) unique_contracts_usage
    from interactions_with_new_contracts
    group by day
    order by day



    Run a query to Download Data