MLDZMNseller
    Updated 2022-06-16
    with tb1 as (select
    date_trunc('day',hour) as day,
    avg(price) as price_USD
    from ethereum.core.fact_hourly_token_prices
    where day>='2021-09-01'
    and day<='2022-06-01'
    and SYMBOL='WETH'
    group by 1 having price_USD>=4000
    ),

    tb2 as (select
    distinct ORIGIN_FROM_ADDRESS as wallets,
    sum(AMOUNT) as stake_vol,
    count(distinct tx_hash) as number_stakes
    from ethereum.core.ez_token_transfers

    where ORIGIN_TO_ADDRESS=lower('0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84')
    and from_address='0x0000000000000000000000000000000000000000'
    and BLOCK_TIMESTAMP::date in (select day from tb1)
    group by 1),

    tb3 as (select
    USER_ADDRESS as wl,
    BALANCE
    from flipside_prod_db.ethereum.erc20_balances where BALANCE_DATE='2022-06-01' and symbol='stETH'
    )

    SELECT
    case
    when stake_vol>BALANCE then 'sell'
    when stake_vol=BALANCE then 'hold'
    when stake_vol<BALANCE then 'adding more'
    end as buckets,
    count(distinct wallets) as numbers
    from tb2
    Run a query to Download Data