select
block_timestamp::date as day,
sum(tx_fee) as Fee_in_eth,
(sum(gas_used/pow(10,9)) * avg(price)) as Fee_in_usd,
avg(price) as eth_price
from optimism.core.fact_transactions inner join ethereum.core.fact_hourly_token_prices p
on hour::date = block_timestamp::date and hour(p.hour) = hour(block_timestamp)
where block_timestamp > CURRENT_DATE - 31
and status = 'SUCCESS'
and symbol = 'WETH'
group by day