adriaparcerisasAave Biggest Liquidations
    --Anyone can check on the health of loans on Aave. When the value of collateral no longer properly covers the loan value, the position can be liquidated.

    --Addresses that trigger liquidations (liquidators) are incentivized by a small bonus. The cost of this bonus is borne by the user responsible for the unhealthy loan (it comes out the user's deposited collateral).

    --Top 10 liquidations by USD value
    --The top 10 liquidations in the past year range between 3M and 5M USD in the value of assets liquidated.

    SELECT * FROM aave.liquidations
    WHERE block_timestamp >= CURRENT_DATE - 365
    AND liquidated_amount_usd IS NOT NULL
    ORDER BY liquidated_amount_usd DESC
    LIMIT 10

    --WETH is the dominant collateral currency in the top 10 liquidations
    --WBTC and USDC follow behind. These three currencies generally reflects the most popular collateral currencies in general, across Aave (https://app.flipsidecrypto.com/dashboard/most-popular-aave-vs-compound-combos-u92Wdf).

    WITH top_10_liquidations as (

    SELECT * FROM aave.liquidations
    WHERE block_timestamp >= CURRENT_DATE - 365
    AND liquidated_amount_usd IS NOT NULL
    ORDER BY liquidated_amount_usd DESC
    LIMIT 10

    ),

    collateral as (
    SELECT collateral_token_symbol, SUM(LIQUIDATED_AMOUNT_USD) AS TOTAL_VALUE_LIQUIDATED FROM top_10_liquidations
    GROUP BY collateral_token_symbol
    )

    SELECT * FROM collateral

    --USDC is the dominant debt currency in the top 10 liquidations
    --Again, this falls in line with the most popular debt currencies across Aave - stablecoins. Stablecoins are, of course, generally stable, suggesting that the top 10 liquidations resulted from the collateral falling in price, not from debt tokens rising in price.

    Run a query to Download Data