keshanETH Staked
    Updated 2022-06-13
    -- null_address = 0x0000000000000000000000000000000000000000
    -- stETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84

    with daily_new_stakes as (select block_timestamp::date as date, sum(raw_amount/pow(10, 18)) as daily_steth from ethereum.core.EZ_TOKEN_TRANSFERS
    where block_timestamp >= DATEADD('MONTH', -3, CURRENT_DATE)
    and FROM_ADDRESS='0x0000000000000000000000000000000000000000'
    and CONTRACT_ADDRESS = lower('0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84')
    group by date),
    daily_sum as (select block_timestamp::date as date, max(cum_steth) as daily_balance
    from (select block_timestamp, sum(raw_amount/pow(10, 18)) over (order by block_timestamp) as cum_steth
    from ethereum.core.EZ_TOKEN_TRANSFERS
    where FROM_ADDRESS='0x0000000000000000000000000000000000000000'
    and CONTRACT_ADDRESS = lower('0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84'))
    where block_timestamp >= DATEADD('MONTH', -3, CURRENT_DATE)
    group by date)

    select b.date, daily_steth as "New ETH staked", daily_balance as "ETH staked so far"
    from daily_new_stakes
    left join daily_sum b using(date)