gokcin2023-03-25 05:28 AM
    Updated 2023-03-25
    with main as ( select
    receiver_id,
    min(a.block_timestamp) as min_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'
    group by
    1
    having min_date >= CURRENT_DATE - {{time_interval}}),
    rendered as (
    select
    date_trunc('day', block_timestamp) as date,
    count(DISTINCT TX_SIGNER) as users,
    count(DISTINCT TX_HASH) as txs,tx_receiver as receivers,
    row_number () over (partition by receivers order by txs desc) as rank

    from near.core.fact_transactions
    where date >= CURRENT_DATE - {{time_interval}} and tx_receiver in (select receiver_id from main)
    group by 1,receivers)

    select * from rendered
    having rank <=10
    Run a query to Download Data