TheLaughingManTop Contracts
    Updated 2022-08-09
    with base as (
    SELECT tx_receiver as contract, a.block_timestamp, tx
    from near.core.fact_actions_events a
    LEFT JOIN near.core.fact_transactions t ON t.tx_hash = a.tx_hash
    where action_name = 'DeployContract'
    ),

    refine as(
    SELECT
    DISTINCT contract
    from base
    ),

    txns as (
    SELECT COUNT(DISTINCT tx_hash) as totals,
    receiver_id as contracts
    from near.core.fact_receipts
    WHERE
    receiver_id in (SELECT * from refine)
    GROUP BY contracts
    )

    SELECT * from txns
    ORDER BY totals DESC
    LIMIT 10
    Run a query to Download Data