MoeHold or Sale 1
    Updated 2022-06-15
    with tot as(with nov as ( SELECT
    distinct EVENT_INPUTS:to as address,
    sum(EVENT_INPUTS:value/1e18) as staked_amount
    FROM ethereum.core.fact_event_logs
    WHERE TX_STATUS = 'SUCCESS'
    and EVENT_INPUTS:from = '0x0000000000000000000000000000000000000000'
    AND
    CONTRACT_ADDRESS = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
    and BLOCK_TIMESTAMP::date between '2021-11-05' and '2021-11-15' --eth price was 4670 $
    GROUP by 1 ORDER by 2 desc
    )

    select
    USER_ADDRESS,
    balance-staked_amount as situation

    from
    flipside_prod_db.ethereum.erc20_balances b,nov n where b.USER_ADDRESS = n.address
    and BALANCE_DATE = '2022-05-10' --after a sharp drop in price
    and symbol = 'stETH'
    and USER_ADDRESS in (select address from nov) )

    select
    case
    when situation > 0 then ' inflow'
    when situation = 0 then ' didnt change'
    when situation < 0 then ' outflow'
    END AS groups,
    count (USER_ADDRESS) from tot
    group by 1




    Run a query to Download Data