Query editor
WITH smart_contracts_list AS (select distinct addressfrom sonic.traceswhere "type" like 'create%'and address is not nulland successand code != 0x and code is not null), distinct_days_per_user AS (SELECT "from", COUNT(distinct(block_date)) as distinct_daysFROM sonic.transactionsWHERE successand block_date >= date('2024-12-16') -- Sonicand "from" NOT IN (SELECT address FROM smart_contracts_list)GROUP BY 1)SELECT trans_cat,COUNT(DISTINCT("from")) as total_usersFROM (SELECT "from",CASE WHEN distinct_days = 1 then '1 Day'WHEN distinct_days between 1 and 3 then '1-3 Days'WHEN distinct_days between 3 and 5 then '3-5 Days'WHEN distinct_days between 5 and 7 then '5-7 Days'WHEN distinct_days between 7 and 14 then '7-14 Days'WHEN distinct_days between 14 and 20 then '14-20 Days'ELSE '20+ Days'END as trans_cat,CASE WHEN distinct_days = 1 then 1 --for ordering lolWHEN distinct_days between 1 and 3 then 2WHEN distinct_days between 3 and 5 then 3WHEN distinct_days between 5 and 7 then 4WHEN distinct_days between 7 and 14 then 5WHEN distinct_days between 14 and 20 then 6ELSE 7END as trans_orderFROM distinct_days_per_user) GROUP BY trans_cat,trans_orderORDER BY trans_order