superflyUntitled Query
Updated 2022-10-20Copy 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
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with min as (select
tx_hash,block_timestamp
from near.core.fact_actions_events
where action_name = 'DeployContract'),
min1 as (select
function_call.tx_hash as tx_hash,
function_call.block_timestamp as block_timestamp
from near.core.fact_actions_events_function_call function_call
join min deploy on (function_call.tx_hash = deploy.tx_hash
and function_call.block_timestamp = deploy.block_timestamp)
where method_name = 'new'),
minii as (select
tx.tx_receiver,tx.block_timestamp
from near.core.fact_transactions tx
join min1 contract
on tx.tx_hash = contract.tx_hash
and tx.block_timestamp = contract.block_timestamp),
deploy_contract_transactions_all_deploy_contract as (
select tx_receiver,block_timestamp,
row_number() over(partition by tx_receiver order by block_timestamp) as row_num
from minii),ggg as (select *
from deploy_contract_transactions_all_deploy_contract
where row_num = 1 ),
top_10_contract as (select tx.tx_receiver,
sum(transaction_fee) as spen_transaction_fee
from near.core.fact_transactions tx
join ggg contract
on tx.tx_receiver = contract.tx_receiver and tx.block_timestamp >= contract.block_timestamp
where contract.block_timestamp::date >= '2022-07-01'
and contract.block_timestamp::date < '2022-10-28' ------90 days
group by 1
order by spen_transaction_fee desc limit 10)
select block_timestamp::date as days,tx_receiver,
count(distinct tx_hash) as number_of_tx,
sum(transaction_fee) as spen_transaction_fee
from near.core.fact_transactions
Run a query to Download Data