with fees as (select
date_trunc('hour', block_timestamp) as hour,
avg(tx_fee) as avg_tx_fee
from avalanche.core.fact_transactions
where block_timestamp >= '2022-6-20'
group by hour),
avax_price as (select hour, price
from ethereum.core.fact_hourly_token_prices
where hour >= '2022-6-20'
and token_address = lower('0x85f138bfee4ef8e540890cfb48f620571d67eda3')),
joined as (select * from fees
left join avax_price using (hour))
select *, avg_tx_fee * price as avg_fee_usd
from joined