binhachonGas Efficiency - #4
    Updated 2022-06-05
    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