0xaimanAverage ETH Volume Deposited/Withdrawn from BendDAO reserve
    Updated 2022-09-07
    with cx as (with ax as (with a as (select tx_hash
    from ethereum.core.fact_event_logs
    where contract_address='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' and
    event_name='Deposit' and
    ORIGIN_TO_ADDRESS = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88'),

    c as (select date_trunc('week',block_timestamp) as month, origin_from_address as depositor, amount from ethereum.core.ez_eth_transfers b
    inner join a on b.tx_hash=a.tx_hash)

    select month, avg(amount) as avg_deposit_volume
    from c
    group by 1),

    bx as (with a as (select tx_hash
    from ethereum.core.fact_event_logs
    where contract_address='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' and
    event_name='Withdrawal' and
    ORIGIN_TO_ADDRESS = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88'),

    c as (select date_trunc('week',block_timestamp) as month, origin_from_address as depositor, amount from ethereum.core.ez_eth_transfers b
    inner join a on b.tx_hash=a.tx_hash)

    select month, avg(amount) as avg_withdraw_volume
    from c
    group by 1)

    select ax.month,avg_deposit_volume,avg_withdraw_volume
    from ax inner join bx on ax.month=bx.month
    ),

    dx as (select date_trunc('week',hour) as month, avg(price) as wbtc_price from ethereum.core.fact_hourly_token_prices
    where token_address=lower('0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599')
    group by 1)

    Run a query to Download Data