jackguyThe Law Offices of NEAR 3
    Updated 2023-04-12
    SELECT
    CASE WHEN transactions BETWEEN 1 and 10 then '1-10 transactions'
    WHEN transactions BETWEEN 10 and 100 then '10-100 transactions'
    WHEN transactions BETWEEN 100 and 1000 then '100-1,000 transactions'
    WHEN transactions BETWEEN 1000 and 10000 then '1,000-10,000 transactions'
    ELSE 'over 10,000 transactions' END,
    count(*) as contracts

    FROM (
    select
    PERMISSION:FunctionCall:receiver_id as id,
    min(block_timestamp) as min_day,
    count(DISTINCT TX_HASH) as transactions
    from near.core.fact_actions_events_addkey
    WHERE id in (
    SELECT id from (
    select
    PERMISSION:FunctionCall:receiver_id as id,
    min(block_timestamp) as min_day,
    count(DISTINCT TX_HASH) as transactions
    from near.core.fact_actions_events_addkey
    WHERE tx_hash in (
    SELECT
    DISTINCT tx_hash
    FROM near.core.fact_actions_events
    WHERE ACTION_NAME = 'DeployContract'
    )
    group by 1
    )
    )
    group by 1
    )

    GROUP BY 1
    Run a query to Download Data