Performing a Liquidation
Now, we'll execute the script to perform the liquidation.
1. Identify Liquidatable Accounts
The script contains a list of accounts that are eligible for liquidation. You can get these accounts through this API on the testnet:
The "Liquidatable Accounts API" for the Hedera mainnet will be made available soon.
2. Configure the Liquidation Parameters
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.
3. Execute the Script
Run the script using Hardhat:
4. Monitor the Output
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.
Last updated