kiacryptoGas used consumes by different sushi services
Updated 2022-06-08Copy Reference Fork
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 kashi_address as (
select symbol, address
from flipside_prod_db.ethereum_core.dim_contracts
where symbol like 'km%' and name like '%Kashi%'
),
txs as (
select event_name, tx_hash
from flipside_prod_db.ethereum_core.fact_event_logs, kashi_address
where event_name in ('LogAddCollateral', 'LogRemoveCollateral', 'LogAddAsset', 'LogRepay', 'LogBorrow', 'LogRemoveAsset') and contract_address = address
),
swap_tx as (
select event_name, tx_hash
from ethereum.core.ez_dex_swaps
where event_name = 'Swap' and platform = 'sushiswap'
)
select case
when event_name = 'LogAddCollateral' then 'Adding liquidity'
when event_name = 'LogRemoveCollateral' then 'Removing liquidity'
when event_name = 'LogAddAsset' then 'Adding asset'
when event_name = 'LogRemoveAsset' then 'Removing asset'
when event_name = 'LogRepay' then 'Repaying loan'
when event_name = 'LogBorrow' then 'Borrowing' end as type, avg(gas_used) as gas_per_tx
from ethereum.core.fact_transactions t, txs tx
where t.tx_hash = tx.tx_hash
group by 1
union all
select case
when event_name = 'Swap' then 'Swapping' end as type, avg(gas_used) as gas_per_tx
from ethereum.core.fact_transactions t, swap_tx tx
where t.tx_hash = tx.tx_hash
group by 1
Run a query to Download Data