# Market Trait

{% hint style="info" %}
Purpose: Interface definition for market contracts. Defines core lending protocol operations.
{% endhint %}

## market-trait

Interface implemented by `market.clar` for core lending operations.

### Trait Definition

#### market-trait

Interface implemented by market.clar for core lending operations.

Functions:

**collateral-add**

Add collateral to position.

{% code title="Signature" %}

```
```

{% endcode %}

Parameters:

* ft: Asset token
* amount: Amount to add
* price-feeds: Optional Pyth feed updates (up to 3)

Returns:

* Updated collateral amount

***

**collateral-remove**

Remove collateral from position.

{% code title="Signature" %}

```
```

{% endcode %}

Parameters:

* ft: Asset token
* amount: Amount to remove
* receiver: Optional recipient (defaults to caller)
* price-feeds: Optional Pyth feed updates

Returns:

* Remaining collateral amount

***

**borrow**

Borrow assets against collateral.

{% code title="Signature" %}

```
```

{% endcode %}

Parameters:

* ft: Asset to borrow
* amount: Amount to borrow
* receiver: Optional recipient (defaults to caller)
* price-feeds: Optional Pyth feed updates

Returns:

* Success or error (boolean and code)

***

**repay**

Repay borrowed debt.

{% code title="Signature" %}

```
```

{% endcode %}

Parameters:

* ft: Asset to repay
* amount: Amount to repay
* on-behalf-of: Optional account to repay for (defaults to caller)

Returns:

* Actual amount repaid

***

**liquidate**

Liquidate unhealthy position.

{% code title="Signature" %}

```
```

{% endcode %}

Parameters:

* borrower: Position to liquidate
* collateral-ft: Collateral to seize
* debt-ft: Debt to repay
* debt-amount: Amount of debt to repay
* min-collateral-expected: Minimum collateral (slippage protection)
* receiver: Optional recipient
* price-feeds: Optional Pyth feed updates

Returns:

* Debt repaid and collateral received

***

**liquidate-multi**

Batch liquidate multiple positions.

{% code title="Signature" %}

```
```

{% endcode %}

Parameters:

* positions: List of liquidation specs

Returns:

* List of results per position

{% hint style="warning" %}
Note: Price feeds are not supported in batch mode (liquidate-multi).
{% endhint %}


---

# 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/stacks-market-v2-smart-contracts-overview/v2-contracts/market-contracts/market-trait.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.
