Pmisha-bmlMdxgas total
    Updated 2022-06-08
    select
    case
    when EVENT_NAME='AddLiquidity' then 'Adding liquidity'
    when EVENT_NAME='RemoveLiquidityOne' then 'Removing liquidity'
    when EVENT_NAME='LogAddCollateral' then 'Adding an asset for lending'
    when EVENT_NAME='Borrow' then 'Borrowing '
    when EVENT_NAME='LogRemoveCollateral' then 'Removing an asset from lending'
    when EVENT_NAME='LogRepay' then 'Repaying a loan'
    when EVENT_NAME in ('Swap','swapped') then 'Swapping'
    end as events,
    count(distinct s.tx_hash) as no_txn,
    sum(d.gas_used) as total_gas,
    total_gas/no_txn as gas_per_txn
    from ethereum.core.fact_event_logs s left outer join ethereum.core.dim_labels b on s.ORIGIN_TO_ADDRESS =b.ADDRESS
    join ethereum.core.fact_transactions d on s.tx_hash=d.tx_hash
    where b.ADDRESS_NAME ilike '%sushi%'
    group by 1 having events is not null

    Run a query to Download Data