-- smart contract deployment patterns
with smart_contracts as (
select
address,
created_tx_hash
from ethereum.core.dim_contracts
)
select
date_trunc('month', block_timestamp) as month,
sum(gas_used * gas_price/(power(10,9))) as tx_fee
from ethereum.core.fact_transactions tx
inner join smart_contracts sc on tx.tx_hash = sc.created_tx_hash
group by 1