banbannardETH Removed 3c
    Updated 2022-09-16
    with base as (select date_trunc('day', block_timestamp) as day,
    sum(amount_deposited) as eth_amount,
    sum(amount_deposited) * avg(price) as eth_amount_usd
    from ethereum.maker.ez_deposits a
    join ethereum.core.fact_hourly_token_prices b
    on date_trunc('day', a.block_timestamp) = date_trunc('day', b.hour)
    where a.symbol = 'WETH'
    and b.symbol = 'WETH'
    and day >= '2022-06-01'
    group by 1),

    base2 as (select date_trunc('day', block_timestamp) as day,
    sum(amount_withdrawn) as eth_amount,
    sum(amount_withdrawn) * avg(price) as eth_amount_usd
    from ethereum.maker.ez_withdrawals a
    join ethereum.core.fact_hourly_token_prices b
    on date_trunc('day', a.block_timestamp) = date_trunc('day', b.hour)
    where a.symbol = 'WETH'
    and b.symbol = 'WETH'
    and day >= '2022-06-01'
    group by 1),

    base3 as (select a.day,
    case
    when a.day >= '2022-09-01' then '2 Weeks Prior to The Merge'
    else 'Other Days'
    end as periods,
    a.eth_amount - b.eth_amount as net_eth_deposited
    from base a
    join base2 b
    on a.day = b.day)

    select *,
    (select sum(net_eth_deposited) from base3 where periods = '2 Weeks Prior to The Merge')
    from base3
    Run a query to Download Data