select
BLOCK_TIMESTAMP::date as "Day",count(1) as "TX count",sum("TX count") over(order by "Day") as "Total TX Count",sum(FEE) as "Daily Fee", sum("Daily Fee") over(order by "Day") as "Total Fee","Total Fee"/"Total TX Count" as "Average Generated Fee"
from terra.core.fact_transactions
where
TX_SUCCEEDED = true
and tx:body:messages[0]:"@type"='/cosmwasm.wasm.v1.MsgExecuteContract'
and tx:body:messages[0]:contract = 'terra1j8hayvehh3yy02c2vtw5fdhz9f4drhtee8p5n5rguvg3nyd6m83qd2y90a'
group by "Day"
order by "Day"