Madigas creation
    Updated 2023-04-13
    select
    date_trunc('{{Period}}', BLOCK_TIMESTAMP) as date,
    sum(GAS_USED) as sum_GAS_USED,
    sum(fee) as sum_fee,
    count(DISTINCT tx_id) as count_tx,
    sum_GAS_USED/count_tx as avg_gas_used_per_tx,
    sum_fee/count_tx as avg_fee_used_per_tx,
    sum (sum_fee) over (order by date) as "Cumualtive sum",
    sum (sum_GAS_USED) over (order by date) as "Cumualtive gas"
    from terra.core.fact_transactions
    where tx_id in (select DISTINCT tx_id from terra.core.ez_messages where MESSAGE_TYPE = '/cosmwasm.wasm.v1.MsgInstantiateContract' and TX_SUCCEEDED = 'TRUE')
    and date >= CURRENT_DATE - {{DaysAgo}}
    group by 1
    Run a query to Download Data