jackguynear_contract_1
    Updated 2023-03-24
    with top10 as (
    select
    TX_RECEIVER as contract,
    count(DISTINCT TX_SIGNER) as users,
    count(DISTINCT TX_HASH) as transactions
    from near.core.fact_transactions
    WHERE block_timestamp > '2023-01-01'
    AND TX_RECEIVER in (
    SELECT
    tx_receiver
    FROM (
    SELECT
    tx_receiver,
    min(block_timestamp) as first_day
    FROM near.core.fact_transactions
    GROUP BY 1
    )
    WHERE first_day > '2022-12-01'
    )
    --AND not id is NULL
    group by 1
    ORDER by 2 DESC
    LIMIT 10
    )
    SELECT
    date_trunc('day', block_timestamp) as day,
    tx_receiver as contract,
    count(DISTINCT TX_SIGNER) as users,
    count(DISTINCT TX_HASH) as transactions
    FROM near.core.fact_transactions
    WHERE tx_receiver IN (SELECT contract FROM top10)
    GROUP BY 1,2
    HAVING NOT day is NULL
    AND NOT contract is NULL
    AND NOT users is NULL
    Run a query to Download Data