Updated 2022-07-09
    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 is not null 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 event_name, 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 event_name, avg(gas_used) as gas_per_tx
    from ethereum.core.fact_transactions t, swap_tx tx
    where t.tx_hash = tx.tx_hash
    AND BLOCK_TIMESTAMP>'2022-01-01'
    group by 1
    Run a query to Download Data