BlockTrackerAave-deposit and withdraw
    Updated 2023-06-05
    -- forked from Aave-deposit @ https://flipsidecrypto.xyz/edit/queries/4dc4f264-5b26-4e3f-95fa-05f41e6528d4

    --deposit and withdraw Aave tokens

    SELECT *,
    sum(transfers) over (PARTITION BY method ORDER BY date) as cum_total_transfers,
    sum(unique_users) over (PARTITION BY method ORDER BY date) as cum_unique_users,
    sum(vol) over (PARTITION BY method ORDER BY date) as cum_volume
    FROM (
    SELECT
    'deposit' as method,
    date_trunc('{{interval}}',block_timestamp) as date,
    count(tx_hash) as transfers,
    count(DISTINCT depositor_address) as unique_users,
    sum(supplied_usd) as vol
    FROM ethereum.aave.ez_deposits
    WHERE Aave_token = '0xffc97d72e13e01096502cb8eb52dee56f74dad7b'
    AND date < current_date-1
    GROUP BY 2
    UNION
    SELECT
    'withdraw' as method,
    date_trunc('{{interval}}',block_timestamp) as date,
    count(tx_hash) as transfers,
    count(DISTINCT depositor_address) as unique_users,
    sum(WITHDRAWN_USD) as vol
    FROM ethereum.aave.ez_withdraws
    WHERE Aave_token = '0xffc97d72e13e01096502cb8eb52dee56f74dad7b'
    AND date < current_date-1
    GROUP BY 2
    )
    ORDER BY date DESC


    Run a query to Download Data