select
date_trunc('day', block_timestamp)::date as "Week",
count(distinct tx_id) as "Creation Contracts Count",
count(distinct message_value:sender) as "Creation Senders Count",
sum(fee) as "Total Creation Fee",
avg(fee) as "Average Creation Fee",
sum("Creation Contracts Count") over (order by "Week" asc) as "Comulative Creation Contracts Count",
sum("Creation Senders Count") over (order by "Week" asc) as "Comulative Creation Senders Count",
sum("Total Creation Fee") over (order by "Week" asc) as "Comulative Creation Fee"
from terra.core.fact_transactions a
join terra.core.ez_messages b
using (tx_id)
where message_type = '/cosmwasm.wasm.v1.MsgInstantiateContract'
and tx_succeeded = 1
group by 1
order by 1