select block_timestamp::Date as date,
action,
case when block_Timestamp < '2023-03-11' then 'Before USDC Depeg'
when block_timestamp >= '2023-03-11' and block_timestamp < '2023-03-14' then 'USDC Depeg'
else 'USDC Repeg' end as timespan,
count (distinct tx_id) as TX_Count,
count (distinct sender) as Senders_Count,
count (distinct recipient) as Recipients_Count,
sum (amount/1e6) as Volume,
avg (amount/1e6) as Average_Volume
from osmosis.mars.ez_redbank_actions
where tx_succeeded = 'TRUE'
and currency = 'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858'
and block_timestamp >= '2023-03-01'
and action = 'repay'
group by 1,2,3
order by 1