> For the complete documentation index, see [llms.txt](https://cryndex-labs.gitbook.io/cryndex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cryndex-labs.gitbook.io/cryndex-docs/developers/liquidating-a-borrower.md).

# 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:

```solidity
/// @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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cryndex-labs.gitbook.io/cryndex-docs/developers/liquidating-a-borrower.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
