SocioCryptoUntitled Query
    Updated 2022-06-08
    SELECT ACTION,
    avg(d.tx_fee) as total_tx_fee
    from
    (SELECT a.tx_hash,
    CASE WHEN event_name = 'LogAddCollateral' then 'borrow'
    WHEN event_name in ('LogRemoveCollateral' ,'LogRepay') then 'repay'
    WHEN event_name = 'Swap' then 'swap'
    WHEN event_name in ('LogDeposit', 'Deposit') then 'deposit'
    WHEN event_name in ('LogWithdraw', 'Withdraw', 'Withdrawal') then 'deposit'
    ELSE '' end as action
    FROM flipside_prod_db.ethereum_core.fact_event_logs a
    LEFT JOIN ethereum.core.dim_labels b
    ON a.origin_from_address = b.address or a.origin_to_address = b.address
    WHERE b.label = 'sushiswap'
    AND block_timestamp >= '2022-01-01'
    AND action != '')c
    LEFT join ethereum.core.fact_transactions d
    ON c.tx_hash = c.tx_hash
    GROUP by action
    Run a query to Download Data