lagandispensernew users over time by protocols copy
Updated 2024-04-15Copy 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
›
⌄
-- forked from saeedmzn / new users over time by protocols @ https://flipsidecrypto.xyz/saeedmzn/q/FrYEkWLy2L-U/new-users-over-time-by-protocols
-- forked from new users over time by contract type @ https://flipsidecrypto.xyz/edit/queries/8a60746e-200c-4709-8161-d32bc3950b7d
with New_users as (
select TX_FROM ,
min (BLOCK_TIMESTAMP) ::date min_date
from sei.core.fact_transactions
group by 1 having min_date >= current_date - 30
),
transactions as (
select TX_ID , TX_FROM
from sei.core.fact_transactions
where TX_FROM in (select TX_FROM from New_users )
),
labels as (
select ADDRESS ,
LABEL,
LABEL_TYPE
from sei.core.dim_labels
),
msg as (
select ATTRIBUTE_VALUE ADDRESS , *
from sei.core.fact_msg_attributes join transactions using (tx_id)
where ATTRIBUTE_VALUE in (select ADDRESS from labels )
and BLOCK_TIMESTAMP::date >= current_date - 30
)
select BLOCK_TIMESTAMP ::date daily ,
LABEL ,
count (DISTINCT tx_id) num_transactions ,
count (DISTINCT tx_from ) num_users ,
sum (num_transactions) over (partition by LABEL order by daily) cum_transactions
from msg join labels using (ADDRESS)
group by 1, 2
QueryRunArchived: QueryRun has been archived