Moepos mrg 6
    Updated 2022-09-25
    with base as (select date_trunc(day,block_timestamp) as days,* from ethereum.aave.ez_withdraws
    where symbol ilike 'weth'),
    --Moe
    price as (
    select
    date_trunc(days,hour)::date as days,
    avg (price) as price
    from
    ethereum. core.fact_hourly_token_prices
    where
    symbol ilike 'weth'
    group by 1
    ),
    --Moe
    base2 as (select
    b.*,price,WITHDRAWN_TOKENS*price as AMOUNT_WITHDRAWN from base b, price p where b.days = p.days)


    SELECT
    --Moe
    date_trunc('day', block_timestamp) as dYs,
    case when block_timestamp >= '2022-09-15' then 'post merge' else 'pre merge' end as type,
    avg(price) price,
    count(DISTINCT tx_hash) as num_txs,
    COUNT(DISTINCT DEPOSITOR_ADDRESS) as num_users,
    sum(AMOUNT_WITHDRAWN) as total_withdraw_usd,
    avg(AMOUNT_WITHDRAWN) as avg_withdraw_usd
    FROM base2
    WHERE 1=1
    and block_timestamp between '2022-09-06' and CURRENT_date - 1
    and symbol ILIKE 'WETH'
    GROUP BY 1,2


    Run a query to Download Data