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

```
GET https://docs.zestprotocol.com/start/borrow-1/stacks-market-v1-smart-contracts-overview/pool-logic-v1/liquidation-manager.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
