misaghlbThe Law Offices of NEAR
    Updated 2022-07-31
    with contracts_data as (
    SELECT * from (
    SELECT
    RECEIVER_ID, min(a.BLOCK_TIMESTAMP) as created_date
    from near.core.fact_actions_events a
    join near.core.fact_receipts b on a.TX_HASH = b.TX_HASH
    where ACTION_NAME= 'DeployContract'
    -- where TX_HASH = '7SepTbpq3yQkgynvytEoWzkQLJQG3STtB9fE7WXpi1Yr' -- sample deploy
    GROUP by RECEIVER_ID
    )
    where created_date >= CURRENT_DATE - 30
    )

    SELECT TX_RECEIVER, COUNT(DISTINCT TX_HASH) as tx_count
    from near.core.fact_transactions
    where date(BLOCK_TIMESTAMP) >= CURRENT_DATE - 30
    and TX_RECEIVER in (SELECT RECEIVER_ID from contracts_data)
    GROUP by TX_RECEIVER
    ORDER by tx_count DESC
    limit 10

    Run a query to Download Data