# Peridottroller

The **Peridottroller** is the main contract responsible for controlling protocol-wide operations, managing collateral settings, borrowing rules, market management, and enforcing liquidation logic.

***

### 🛠️ Key Functions & Parameters

#### &#x20;`enterMarkets(address[] calldata pTokens)`

Allows a user to use specified markets' assets as collateral.

* **Parameters:**
  * `pTokens`: Array of pToken addresses the user wishes to enter as collateral.

***

#### `exitMarket(address pToken)`

Removes a market's asset from user's collateral.

* **Parameters:**
  * `pToken`: Address of the market token the user wishes to exit from collateral.

***

#### `getAccountLiquidity(address account)`

Calculates the user's current account liquidity.

* **Parameters:**
  * `account`: Address of the user.
* **Returns:**
  * User's liquidity and shortfall status (excess collateral or shortfall amount).

***

#### `liquidateBorrow(address borrower, uint repayAmount, address pTokenCollateral)`

Allows liquidation of an undercollateralized borrower's position.

* **Parameters:**
  * `borrower`: Address of the borrower to liquidate.
  * `repayAmount`: Amount of debt to repay on behalf of the borrower.
  * `pTokenCollateral`: The collateral token to seize.

***

#### `markets(address pToken)`

Returns market details (collateral factor, listed status, etc.) for a specific token market.

* **Parameters:**
  * `pToken`: Market token address.
* **Returns:**
  * Struct containing market configuration, collateral factors, and status.


---

# 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://peridot-finance.gitbook.io/peridot-protocol/technical-architecture/evm/core-contracts/peridottroller.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.
