binhachonGas Efficiency - #4
Updated 2022-06-05
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 pool_address as (
select
pool_address
from flipside_prod_db.ethereum_core.dim_dex_liquidity_pools
where platform like '%sushi%'
),
kashi_pair as (
select
address,
symbol
from flipside_prod_db.ethereum_core.dim_contracts
where symbol like '%km%'
and symbol like '%/%-%'
),
txs as (
select
case
when event_name = 'Mint' then 'Adding liquidity'
when event_name = 'Burn' then 'Removing liquidity'
else 'Swapping' end
as type,
tx_hash
from flipside_prod_db.ethereum_core.fact_event_logs
where contract_address in (select pool_address from pool_address)
and event_name in ('Burn', 'Mint', 'Swap')
group by 1, 2
union all
select
case
when event_name = 'LogAddCollateral' then 'Adding an asset for lending'
when event_name = 'LogRemoveCollateral' then 'Removing an asset from lending'
when event_name = 'LogBorrow' then 'Borrowing'
else 'Repaying a loan' end
as type,
tx_hash
from flipside_prod_db.ethereum_core.fact_event_logs
Run a query to Download Data