KaskoazulNEAR City - FunctionCall
Updated 2022-07-06
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 active_users as (
select tx_signer as users,
max (block_timestamp::date) as last_day
from flipside_prod_db.mdao_near.transactions
group by users
),
active_users_last_days as (
select users, last_day
from active_users
where last_day > CURRENT_DATE - {{last_day}}
),
raw_txs_active_users as (
select t.block_timestamp::date as fecha,
t.tx_receiver,
t.tx_signer as users,
t.txn_hash
from flipside_prod_db.mdao_near.transactions t
join active_users_last_days a
on t.tx_signer = a.users
left join flipside_prod_db.mdao_near.actions_events e
on t.txn_hash = e.txn_hash
where e.action_name = 'FunctionCall'
),
final as (
select fecha,
tx_receiver,
count (txn_hash) as txs,
rank () over (partition by fecha order by txs desc) as daily_rank,
case
when daily_rank <= 5 then tx_receiver
when daily_rank > 5 then 'other'
else 'unknown'
end as top_ranking
Run a query to Download Data