SELECT
date_trunc('day', block_timestamp) as date,
case when date <= '2023-01-01' then 'Before 2023' else '2023'
END as "Time",
count(DISTINCT (message_value:contract)) as "Number of Actives"
from terra.core.ez_messages
where block_timestamp >= CURRENT_DATE - INTERVAL '60 days'
and message_type LIKE '/cosmwasm.wasm.v1.MsgExecuteContract'
GROUP BY 1
order by 1