misaghlbDaily Active User
Updated 2022-10-17
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 stats AS (
SELECT
tx_from as address,
count(distinct tx_id) as tx_counts,
min(date(block_timestamp)) as first_tx,
max(date(block_timestamp)) as last_tx,
count(distinct date(block_timestamp)) as days_active,
count(distinct date_trunc('week', block_timestamp)) as weeks_active,
count(distinct date_trunc('month', block_timestamp)) as months_active,
datediff('day', first_tx, CURRENT_DATE) as age_day,
datediff('week', first_tx, CURRENT_DATE) as age_week,
datediff('month', first_tx, CURRENT_DATE) as age_month,
case when age_month * 0.9 <= months_active then 1 else 0 end as active_every_month,
case when age_week * 0.9 <= weeks_active then 1 else 0 end as active_every_week,
case when age_day * 0.9 <= days_active then 1 else 0 end as active_every_day
FROM osmosis.core.fact_transactions
group by 1
),
active_tbl as (
SELECT
address
FROM stats
where active_every_week = 1
),
tx_event AS (
select
distinct tx_id as tx_id_event, 'Superfluid Staking' as event from osmosis.core.fact_superfluid_staking
where TX_CALLER_ADDRESS in (SELECT address from active_tbl)
union
select distinct tx_id, 'Staking' as event from osmosis.core.fact_staking
where TX_CALLER_ADDRESS in (SELECT address from active_tbl)
union
Run a query to Download Data