pouya_22Aave - 7. AAVE and stAAVE movements - Unstakes
    Updated 2022-08-08
    with unstakes as (select
    block_timestamp::date as date,
    count(distinct tx_hash) as number_of_txs,
    count(distinct origin_from_address) as number_of_unstakers,
    sum(amount_usd) as volume_usd,
    sum(amount) as volume_aave
    from ethereum.core.ez_token_transfers
    where origin_to_address = '0x4da27a545c0c5b758a6ba100e3a049001de870f5'
    and from_address = '0x4da27a545c0c5b758a6ba100e3a049001de870f5'
    and symbol = 'AAVE'
    group by 1),

    price as (select
    hour::date as price_date,
    avg(price) as price_usd
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'AAVE'
    group by 1)

    select * from unstakes join price on date = price_date
    Run a query to Download Data