NatThe Law Offices of NEAR 4
Updated 2023-04-13Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
›
⌄
with contracts as (select
events.block_timestamp as date,
receiver_id as receiver,
row_number() over (partition by receiver_id order by events.block_timestamp asc) as nums
from near.core.fact_actions_events events
join near.core.fact_receipts rec
on rec.tx_hash = events.tx_hash
where date_trunc('day', events.block_timestamp) >= CURRENT_DATE - 60
and action_name ilike '%DEPLOYCONTRACT%'
group by receiver, date
qualify nums = 1)
select
count(distinct tx_hash) as transactions,
tx_receiver as contract_address
from near.core.fact_transactions tr
join (select date, receiver, nums
from contracts) as contract
on contract.receiver = tr.tx_receiver
where tr.BLOCK_TIMESTAMP::date >= CURRENT_DATE - 60
group by tx_receiver
order by transactions desc
limit 10
Run a query to Download Data