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

# 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 %}
