select avg(price) * sum(gas_used/1e9) / count(distinct block_number) as Average_block , hour(block_timestamp)
from optimism.core.fact_hourly_token_prices inner join optimism.core.fact_transactions
on hour::date=block_timestamp::date
where
TOKEN_ADDRESS ='0x4200000000000000000000000000000000000042'
and hour::date > current_date - interval '30 days'
and block_timestamp::date > current_date - interval '30 days'
group by 2