YinkaActive v Inactive Address copy
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 SQL-Cat / Active v Inactive Address @ https://flipsidecrypto.xyz/SQL-Cat/q/ouI5aKxIeVmh/active-v-inactive-address
select week, activeness, count(sender) as n_address
from (with um as (select date_trunc('day', t) as week, attribute_value as sender, sum(n_txn) as tot_swap_made
from ethereum.
select date(block_timestamp) as t, attribute_value, count(tx_id) as n_txn
from
where msg_type='token_swapped' and attribute_key='sender'
group by 1,2 order by 1)
group by 1,2 order by 1),
gauge as (
select date_trunc('week', day) as week , avg(txn_per_user) as avg_txn_per_user
from (select date_trunc('day',block_timestamp) as day, count(distinct attribute_value) as n_sender , count(tx_id) as n_txn_swap, (n_txn_swap/n_sender) as txn_per_user --attribute_value,
from osmosis.CORe.fact_msg_attributes
where msg_type='token_swapped' and attribute_key='sender'
group by 1 order by 1
-- order by 4
)
group by 1 order by 1
)
select um.week, um.sender, tot_swap_made, avg_txn_per_user, case when tot_swap_made>=avg_txn_per_user then 'Active User' else 'Inactive User' end as Activeness
from gauge
Run a query to Download Data