MoeETH TO STETH
    Updated 2022-06-15
    with st as ( SELECT

    distinct EVENT_INPUTS:to as stakers

    FROM ethereum.core.fact_event_logs
    WHERE TX_STATUS = 'SUCCESS'
    and EVENT_INPUTS:from = '0x0000000000000000000000000000000000000000'
    AND
    CONTRACT_ADDRESS = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' )

    ,t2 as ( select
    SENDER,
    AMOUNT_OUT,
    AMOUNT_IN,
    AMOUNT_IN-AMOUNT_OUT as profit_eth,
    case
    when profit_eth > 0 then 'gain'
    when profit_eth < 0 then 'lose'
    end as result
    from ethereum.core.ez_dex_swaps
    where SYMBOL_IN ilike 'steth' and SYMBOL_OUT ilike 'weth'
    and sender in (select stakers from st ))
    select
    result,
    count(*) as countt,
    sum(profit_eth) as total_profit_losS
    from t2 group by 1


    Run a query to Download Data