with table1 as (
select mindate::date as day,
count (distinct depositor_address) as New_Users
from (
select depositor_address, min(block_timestamp) as mindate
from ethereum.aave.ez_deposits group by 1)
group by 1)
select block_timestamp::date as date,
case when date >= '2022-11-08' then 'After FTX Collapse'
else 'Before Collapse' end as timespan,
new_users,
count (distinct tx_hash) as TX_Count,
count (distinct depositor_address) as Users_count,
sum (supplied_usd) as Volume
from ethereum.aave.ez_deposits t1 join table1 t2 on t1.block_timestamp::Date = t2.day
where block_timestamp >= CURRENT_DATE - 14
group by 1,2,3