# IPrimaryLendingPlatformLiquidation

## Overview

#### License: MIT

```solidity
interface IPrimaryLendingPlatformLiquidation
```

## Functions info

### liquidate (0xb44055fc)

```solidity
function liquidate(
    address _account,
    Asset.Info memory _prjInfo,
    Asset.Info memory _lendingInfo,
    uint256 _lendingTokenAmount,
    bytes32[] memory priceIds,
    bytes[] calldata updateData,
    bytes[] memory buyCalldata
)
    external
    payable
    returns (address[] memory assets, uint256[] memory assetAmounts)
```

The function to be called when a user wants to liquidate their position. Support liquidation with hot borrowing or not.

Parameters:

| Name                 | Type              | Description                                                                                                                                                       |
| -------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \_account            | address           | The address of the borrower                                                                                                                                       |
| \_prjInfo            | struct Asset.Info | Information about the project token, including its address and type.                                                                                              |
| \_lendingInfo        | struct Asset.Info | Information about the lending token, including its address and type.                                                                                              |
| \_lendingTokenAmount | uint256           | The amount of lending tokens to be used for liquidation                                                                                                           |
| priceIds             | bytes32\[]        | An array of bytes32 price identifiers to update.                                                                                                                  |
| updateData           | bytes\[]          | An array of bytes update data for the corresponding price identifiers.                                                                                            |
| buyCalldata          | bytes\[]          | The calldata for buying the lending token from the exchange aggregator. If the calldata is empty, the liquidation will execute liquidation without hot borrowing. |

### liquidateFromModerator (0xc8359268)

```solidity
function liquidateFromModerator(
    address _account,
    Asset.Info memory _prjInfo,
    Asset.Info memory _lendingInfo,
    uint256 _lendingTokenAmount,
    address liquidator,
    bytes32[] memory priceIds,
    bytes[] calldata updateData,
    bytes[] memory buyCalldata
)
    external
    payable
    returns (address[] memory assets, uint256[] memory assetAmounts)
```

The function to be called when a user wants to liquidate their position. Support liquidation with hot borrowing or not.

Parameters:

| Name                 | Type              | Description                                                                                                                                                       |
| -------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \_account            | address           | The address of the borrower                                                                                                                                       |
| \_prjInfo            | struct Asset.Info | Information about the project token, including its address and type.                                                                                              |
| \_lendingInfo        | struct Asset.Info | Information about the lending token, including its address and type.                                                                                              |
| \_lendingTokenAmount | uint256           | The amount of lending tokens to be used for liquidation                                                                                                           |
| liquidator           | address           | The address of the liquidator                                                                                                                                     |
| priceIds             | bytes32\[]        | An array of bytes32 price identifiers to update.                                                                                                                  |
| updateData           | bytes\[]          | An array of bytes update data for the corresponding price identifiers.                                                                                            |
| buyCalldata          | bytes\[]          | The calldata for buying the lending token from the exchange aggregator. If the calldata is empty, the liquidation will execute liquidation without hot borrowing. |

### getLiquidationAmountWithUpdatePrices (0x02dfa5d4)

```solidity
function getLiquidationAmountWithUpdatePrices(
    address _account,
    address _projectToken,
    address _lendingToken,
    bytes32[] memory priceIds,
    bytes[] calldata updateData
) external payable returns (uint256 maxLA, uint256 minLA)
```

Returns the minimum and maximum liquidation amount for a given account, project token, and lending token after updating related token's prices.

Formula:

* MinLA = min(MaxLA, MPA)
* MaxLA = (LVR \* CVc - THF \* LVc) / (LRF \* LVR - THF)

Parameters:

| Name           | Type       | Description                                                            |
| -------------- | ---------- | ---------------------------------------------------------------------- |
| \_account      | address    | The account for which to calculate the liquidation amount.             |
| \_projectToken | address    | The project token address.                                             |
| \_lendingToken | address    | The lending token address.                                             |
| priceIds       | bytes32\[] | An array of bytes32 price identifiers to update.                       |
| updateData     | bytes\[]   | An array of bytes update data for the corresponding price identifiers. |

Return values:

| Name  | Type    | Description                     |
| ----- | ------- | ------------------------------- |
| maxLA | uint256 | The maximum liquidation amount. |
| minLA | uint256 | The minimum liquidation amount. |


---

# 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.fringe.fi/v2-smart-contract-documentation/interfaces/iprimarylendingplatformliquidation.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.
