Liquidating a Borrower

Liquidations are vital for Cryndex, as they protect the protocol's integrity if a loan becomes undercollateralised. Liquidators are motivated by bonus tokens obtained from borrowers. Each collateral token offers a unique bonus incentive. You can check the bonus for each collateral token by using the getLiquidationBonus(address token) on the treasury.

In order to liquidate a borrower, a liquidator must use the liquidate function on the treasury:

/// @notice Computes liquidation parameters and updates debt position
/// @param token Collateral token to seize
/// @param asset Debt asset to repay
/// @param debtToCover Amount of asset to repay
/// @param account Account to liquidate
/// @return Amount Liquidated
function liquidate(
    address token,
    address asset,
    uint256 debtToCover,
    address account
) external returns (uint256);

A liquidator can pay back a maximum of 50% of a borrower's debt in exchange for a 1:1 ratio of the borrowers collateral. A borrower can only be liquidated if their health factor drops below 1, you can check the health factor of a borrower by using the calculateHealthFactor(address account) function on the treasury.

If you want to check the collateral balance of an account you can use the getCollateralBalance(address account, address token) function and to check the debt balance you can use the getDebtBalance(address account, address asset) function. Both of these functions exist on the treasury.

Last updated