Aave Liquidation call Learning


I’m currently trying to learn about Liquidation call. so far I managed to perform deposit, withdraw, borrow and repay successfully using Aave protocol app on Koven testnet, on coming to getting liquidated. How do I perform self liquidation. If i want to perform liquidation call what should i have to do, how can I participate on liquidation any path to learn and perform liquidation call that would be useful, thanks.

Answers 2

Well for testing Aave liquidation, you will have to simulate collateral price drop i.e. get HF < 1 . The best way to that is by impersonating admin account to update price in hardhat fork. Aave sandbox is designed specifically for such integrations https://github.com/aave/aave-sandbox

For more details on liquidation cal, refer guide here

To get liquidated, you need have a loan out from Aave and be undercollateralized. Meaning, you need to have a healthFactor that is below 1. Your health factor decreases as the value of your collateral decreases.

Because of this, liquidiation is difficult to practice on Kovan, since you'd have to manipulate the price of the Chainlink oracles. This would be easier to do on a local fork of the chain.

Once the price of your collateral is low enough, you'll call:

liquidationCall(address collateral, address debt, address user, uint256 debtToCover, bool receiveAToken)

collateral: address of the collateral reserve debt: address of the debt reserve user: address of the borrower debtToCover: amount of asset debt that the liquidator will repay receiveAToken: if true, the user receives the aTokens equivalent of the purchased collateral. If false, the user receives the underlying asset directly.

You can learn more from the Aave docs