adriaparcerisasnear smart contracts over time
    Updated 2023-09-16
    SELECT
    date_trunc('day', call.block_timestamp) as date,
    case when split(split(rc.status_value,':')[0],'{')[1] ilike '%Failure%' then 'Fail execution'
    else 'Successful execution' end as type,
    COUNT(DISTINCT tr.TX_RECEIVER) as smart_contracts,
    sum(smart_contracts) over (partition by type order by date) as cum_smart_contracts
    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'
    AND date >=CURRENT_DATE-INTERVAL '1 MONTH'
    group by 1,2 order by 1 asc,2 desc
    Run a query to Download Data