jackguyThe Law Offices of NEAR 7 copy
    Updated 2023-03-27
    -- forked from d59aa870-a646-4f75-a821-85eafe13afe3

    with top25 as (
    select
    PERMISSION:FunctionCall:receiver_id as id,
    count(DISTINCT TX_HASH) as transactions
    from near.core.fact_actions_events_addkey
    --WHERE block_timestamp > CURRENT_DATE - 90
    where not id is NULL
    group by 1
    ORDER by 2 DESC
    LIMIT 25
    ), tab2 as (
    select
    date_trunc('day', block_timestamp) as day,
    count(DISTINCT TX_HASH) as transactions
    from near.core.fact_actions_events_addkey
    --WHERE block_timestamp > CURRENT_DATE - 90
    where not PERMISSION:FunctionCall:receiver_id is NULL
    group by 1
    ), tab3 as (
    SELECT
    day,
    amount as new_contracts
    FROM (
    select
    min_day as day,
    count(*) as amount
    from (
    select
    PERMISSION:FunctionCall:receiver_id as id,
    min(date_trunc('day', block_timestamp)) as min_day
    from near.core.fact_actions_events_addkey
    WHERE tx_hash in (
    SELECT
    DISTINCT tx_hash
    Run a query to Download Data