RayyykAave
    Updated 2022-09-16
    with deposit as (select date_trunc('day', block_timestamp) as day,
    sum(issued_tokens) as eth_deposited
    from ethereum.aave.ez_deposits
    where block_timestamp >= current_date - 30
    and symbol = 'WETH'
    and issued_tokens > 0
    group by 1),

    withdraw as (select date_trunc('day', block_timestamp) as day,
    sum(withdrawn_tokens) as eth_withdrew
    from ethereum.aave.ez_withdraws
    where block_timestamp >= current_date - 30
    and symbol = 'WETH'
    and withdrawn_tokens > 0
    group by 1)

    select a.day,
    case
    when a.day >= '2022-09-15 00:00:00.000' then 'Merged'
    when a.day >= '2022-09-08 00:00:00.000' and a.day < '2022-09-15 00:00:00.000' then 'One Week Before Merge'
    when a.day < '2022-09-08 00:00:00.000' then 'One Month Before Merge'
    end as merge,
    eth_deposited,
    eth_withdrew,
    eth_deposited - eth_withdrew as net_eth
    from deposit a
    join withdraw b on a.day = b.day
    order by 1
    Run a query to Download Data