Afonso_DiazGrouping Contracts by active days
Updated 2025-02-12
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
main as (
select
tx_hash,
block_timestamp,
origin_from_address as user,
origin_to_address as contract_address
from
ronin.core.fact_event_logs
where
tx_succeeded
),
contracts as (
select
contract_address,
count(distinct tx_hash) as transactions,
count(distinct block_timestamp::date) as active_days,
count(distinct user) as users
from
main
group by 1
)
select
case
when active_days = 1 then 'a. 1 day active'
when active_days <= 7 then 'b. 1 - 7 day active'
when active_days <= 14 then 'c. 7 - 14 day active'
when active_days <= 21 then 'd. 14 - 21 day active'
when active_days <= 28 then 'e. 21 - 28 day active'
when active_days <= 35 then 'f. 28 - 35 day active'
when active_days <= 42 then 'g. 35 - 42 day active'
else 'h. More than 42 day active'
end as type,
QueryRunArchived: QueryRun has been archived