Afonso_Diaz2023-04-24 09:59 PM
Updated 2023-04-25
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 t as (
select
tx_hash,
block_timestamp,
signer_id,
case
when exists (select * from near.core.fact_actions_events_function_call b where a.tx_hash = b.tx_hash and (b.receiver_id = 'contract.main.burrow.near' or b.args::string like '%contract.main.burrow.near%')) then 'Burrow'
when exists (select * from near.core.fact_actions_events_function_call b where a.tx_hash = b.tx_hash and (b.receiver_id = 'quizchain.near' or b.args::string like '%quizchain.near%')) then 'Quizchain'
when exists (select * from near.core.fact_actions_events_function_call b where a.tx_hash = b.tx_hash and (b.receiver_id = 'spot.spin-fi.near' or b.args::string like '%spot.spin-fi.near%')) then 'Spin-Finance'
when exists (select * from near.core.fact_actions_events_function_call b where a.tx_hash = b.tx_hash and (b.receiver_id = 'v1.jumbo_exchange.near' or b.args::string like '%v1.jumbo_exchange.near%')) then 'Jumbo Exchange'
when exists (select * from near.core.fact_actions_events_function_call b where a.tx_hash = b.tx_hash and (b.receiver_id = 'v1.orderbook.near' or b.args::string like '%v1.orderbook.near%')) then 'Orderbook'
when exists (select * from near.core.fact_actions_events_function_call b where a.tx_hash = b.tx_hash and (b.receiver_id = 'v2.ref-finance.near' or b.args::string like '%v2.ref-finance.near%')) then 'Ref-Finance'
end as platform
from near.core.fact_actions_events_function_call a
where receiver_id = 'aurora'
and platform is not null
),
t2 as (
select
tx_hash,
block_timestamp,
signer_id,
platform
from t
qualify row_number() over (partition by tx_hash order by block_timestamp) = 1
)
select
date_trunc('month', block_timestamp)::date as month,
platform,
count(distinct tx_hash) as transactions,
count(distinct signer_id) as users,
sum(transactions) over (partition by platform order by month) as cumulative_transactions
from t2
group by 1, 2
Run a query to Download Data