> For the complete documentation index, see [llms.txt](https://docs.zestprotocol.com/start/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zestprotocol.com/start/borrow-1/stacks-market-v1-smart-contracts-overview/pool-logic-v1/liquidation-manager.md).

# liquidation-manager

1. `calculate-user-global-data`: Calculates the global data of a user across all assets.
2. `liquidation-call`: Performs a liquidation call on an undercollateralized position.
3. `calculate-available-collateral-to-liquidate`: Calculates the available collateral that can be liquidated.

#### `calculate-user-global-data`

Calculates the global data of a user across all assets.

| Parameter | Type        | Description                                     |
| --------- | ----------- | ----------------------------------------------- |
| `user`    | `principal` | The user for whom the data is being calculated. |
| `assets`  | `list`      | A list of assets to include in the calculation. |

#### `liquidation-call`

Performs a liquidation call on an undercollateralized position.

| Parameter              | Type        | Description                                       |
| ---------------------- | ----------- | ------------------------------------------------- |
| `assets`               | `list`      | A list of assets involved in the liquidation.     |
| `lp-token`             | `<a-token>` | The LP token associated with the collateral.      |
| `collateral`           | `<ft>`      | The collateral asset to be liquidated.            |
| `debt-asset`           | `<ft>`      | The debt asset to be repaid.                      |
| `collateral-oracle`    | `<oracle>`  | The oracle for the collateral asset.              |
| `debt-asset-oracle`    | `<oracle>`  | The oracle for the debt asset.                    |
| `user`                 | `principal` | The borrower's address.                           |
| `debt-purchase-amount` | `uint`      | The amount of debt the liquidator wants to repay. |
| `to-receive-atoken`    | `bool`      | Whether the liquidator wants to receive aTokens.  |

#### `calculate-available-collateral-to-liquidate`

Calculates the available collateral that can be liquidated.

| Parameter                 | Type       | Description                                     |
| ------------------------- | ---------- | ----------------------------------------------- |
| `collateral`              | `<ft>`     | The collateral asset.                           |
| `principal-asset`         | `<ft>`     | The principal asset for which the debt is owed. |
| `collateral-oracle`       | `<oracle>` | The oracle for the collateral asset.            |
| `principal-oracle`        | `<oracle>` | The oracle for the principal asset.             |
| `debt-to-liquidate`       | `uint`     | The amount of debt to liquidate.                |
| `user-collateral-balance` | `uint`     | The user's balance of the collateral asset.     |


---

# 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://docs.zestprotocol.com/start/borrow-1/stacks-market-v1-smart-contracts-overview/pool-logic-v1/liquidation-manager.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.
