granadohoUniswap and Sushiswap Total and Average Gas Fee
Updated 2022-02-02
99
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
›
⌄
with get_tx_id as (
select
tx_id,
from_label,
block_timestamp
from ethereum.udm_events
where (from_label = 'sushiswap' or from_label = 'uniswap') and date(block_timestamp) > DATEADD(month, -2, current_date)
), joined as (
select
a.tx_id,
b.from_label,
b.block_timestamp,
a.gas_price,
a.success
from ethereum.transactions a
inner join get_tx_id b
on b.tx_id = a.tx_id
), filtered as (
select
*
from (
select
*,
ROW_NUMBER() OVER (PARTITION by tx_id order by block_timestamp desc) col
from joined
where success = 'TRUE'
) a
where a.col = 1
)
select
from_label,
SUM(gas_price/POW(10,18)) as total_gas_fee,
AVG(gas_price/POW(10,18)) as average_gas_fee
from filtered
Run a query to Download Data