permarydead-red
    Updated 2024-10-10
    --aave deposits
    with
    aave_deposits as (
    select
    date_trunc('day',block_timestamp) as date,
    'aave' as protocol,
    sum(supplied_usd) as total_deposits
    from ethereum.aave.ez_deposits
    where block_timestamp >= current_date - interval '3 months'
    group by date
    ),

    --aave borrows
    aave_borrows as (
    select
    date_trunc('day',block_timestamp) as date,
    'aave' as protocol,
    sum(borrowed_usd) as total_borrows
    from ethereum.aave.ez_borrows
    where block_timestamp >= current_date - interval '3 months'
    group by date
    ),

    --aave repayments
    aave_repayments as (
    select
    date_trunc('day',block_timestamp) as date,
    'aave' as protocol,
    sum(repayed_usd) as total_repayments,
    from ethereum.aave.ez_repayments
    where block_timestamp >= current_date - interval '3 months'
    group by date
    ),

    -- aave withdrawals
    aave_withdrawals as (
    QueryRunArchived: QueryRun has been archived