Performing a Liquidation
Last updated
Last updated
Now, we'll execute the script to perform the liquidation.
The script contains a list of accounts that are eligible for liquidation. You can get these accounts through this API on the testnet:
In the script, the liquidate
function is set up to liquidate a specific user. Update the parameters accordingly.
user
: The address of the user to liquidate.
collateralReserve
: The address of the collateral asset.
debtReserve
: The address of the debt asset.
borrowed
: The amount of debt to cover (in wei).
Replace the placeholders with the actual values based on the user's positions.
Run the script using Hardhat:
The script will output the progress of the liquidation:
If the liquidation is successful, you'll see a confirmation message. If there are errors, the script will output the error details.