SELECT
'Active Contracts' as "Type",
count(DISTINCT (message_value:contract)) as counter,
counter/count(DISTINCT date_trunc('day', block_timestamp)) as "Average Number of Contracts per Day"
from terra.core.ez_messages
where block_timestamp >= '2023-01-01'
and message_type LIKE '%Contract%'
UNION
SELECT
'New Contracts' as "Type",
count(DISTINCT (attributes:instantiate:_contract_address)) as counter,
counter/count(DISTINCT date_trunc('day', block_timestamp)) as "Average Number of Contracts per Day"
from terra.core.ez_messages
where block_timestamp >= '2023-01-01'
and message_type LIKE '%Contract%'