mo115Gas copy
Updated 2023-04-26
999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
-- forked from Gas @ https://flipsidecrypto.xyz/edit/queries/b8c2383f-650e-42d0-83e2-40908ce952c5
(With Arbitrum as (with arbitrum_fees as
(select
date_trunc('day',BLOCK_TIMESTAMP) as date,
FROM_ADDRESS as address,
sum (TX_FEE) as gas_paid
from arbitrum.core.fact_transactions
where FROM_ADDRESS = lower('{{ADDRESS}}')
group by 1,2),
ETH as (select date_trunc ('day',HOUR) as date, avg(PRICE)as price
from ethereum.core.fact_hourly_token_prices
where SYMBOL = 'WETH'
group by 1)
select a.date, address,gas_paid as gas_paid_ETH, (gas_paid*price) as gas_paid_USD
from arbitrum_fees a left join ETH e on a.date=e.date)
select 'Arbitrum' as network , sum(gas_paid_ETH)as Token , sum(gas_paid_USD)as USD, (USD/Token) as Average_Price
from Arbitrum)
UNION
(With optimism as (with optimism_fees as
(select
date_trunc('day',BLOCK_TIMESTAMP) as date,
FROM_ADDRESS as address,
sum (TX_FEE) as gas_paid
from optimism.core.fact_transactions
where FROM_ADDRESS = lower('{{ADDRESS}}')
group by 1,2),
ETH as (select date_trunc ('day',HOUR) as date, avg(PRICE)as price
from ethereum.core.fact_hourly_token_prices
where SYMBOL = 'WETH'
group by 1)
select a.date, address,gas_paid as gas_paid_ETH, (gas_paid*price) as gas_paid_USD
from optimism_fees a left join ETH e on a.date=e.date)
select 'Optimism' as network, sum(gas_paid_ETH)as Token , sum(gas_paid_USD)as USD, (USD/Token) as Average_Price
Run a query to Download Data