Query editor
with arbitrum_data as (select *, (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, 'arbitrum' as name from ethereum.transactionswhere "from"=0xC1b634853Cb333D3aD8663715b08f41A3Aec47cc and to=0x1c479675ad559DC151F6Ec7ed3FbF8ceE79582B6order by 1 desc),optimism_data as (select *, (cast(gas_used as double) * (cast(gas_price as double) / 1e18)) as gas_spent, 'optimism' as name from ethereum.transactionswhere "from"=0x6887246668a3b87F54DeB3b94Ba47a6f63F32985 and to=0xFF00000000000000000000000000000000000010order by 1 desc),arbitrum as (selectdate_trunc('day',block_time) as day,name,sum(gas_spent) as gas_spent_ethfrom arbitrum_data group by 1,2),optimism as (selectdate_trunc('day',block_time) as day,name,sum(gas_spent) as gas_spent_ethfrom optimism_data group by 1,2),final_data as (select * from arbitrumunion allselect * from optimism),prices as (selectdate_trunc('day', minute) as time,max_by(price, minute) as last_pricefrom prices.usd where symbol='ETH' group by 1),final_data_usd as (select *, last_price as price from final_data left join prices on day=time)select *, gas_spent_eth*last_price as gas_spent_usd from final_data_usd