with stablejackt as (
select '0x013b34dba0d6c9810f530534507144a8646e3273' as address,
union all
select '0x0363a3debe776de575c36f524b7877db7dd461db' as address
union all
select '0x698c34bad17193af7e1b4eb07d1309ff6c5e715e' as address,
union all
select '0xabe7a9dfda35230ff60d1590a929ae0644c47dc1' as address
),
mintable as (
select origin_from_address,
min (block_timestamp) as mindate
from avalanche.core.ez_decoded_event_logs
group by 1)
select date_trunc (week,t1.block_timestamp) as date,
case when t1.block_timestamp = mindate then 'New To Chain' else 'Not New To Chain' end as type,
count (Distinct t1.origin_from_address) as Users,
sum (Users) over (partition by type order by date asc) as Cumulative_Users
from avalanche.core.ez_decoded_event_logs t1 join stablejackt t2 on t1.origin_to_address = t2.address
join mintable t3 on t1.origin_from_address = t3.origin_from_address
group by 1,2
order by 1 desc