SocioAnalyticaNew contracts
    Updated 2024-03-25
    -- forked from SocioCrypto / New contracts @ https://flipsidecrypto.xyz/SocioCrypto/q/HBMWH9wLjzxU/new-contracts

    -- credit to https://app.flipsidecrypto.com/dashboard/near-meta-analysis-ZMxhbA by @adriaparcerisas-zZ024F

    SELECT date_trunc('{{interval}}', st_txn) as date,
    COUNT(contract) as "Number of New Contracts",
    sum("Number of New Contracts") over (order by date) as "Total Number of Contracts"
    FROM
    (SELECT tr.TX_RECEIVER as contract,
    min(call.block_timestamp) as st_txn
    FROM near.core.fact_actions_events_function_call call
    INNER JOIN near.core.fact_transactions tr
    ON call.TX_HASH = tr.TX_HASH
    INNER JOIN near.core.fact_receipts as rc
    ON tr.TX_HASH=rc.TX_HASH
    WHERE ACTION_NAME = 'FunctionCall'
    AND METHOD_NAME <> 'new'
    GROUP by contract)
    WHERE date >= '2024-01-01'
    group by date
    ORDER BY date DESC


    QueryRunArchived: QueryRun has been archived