# Developer docs

## Exchanging cTokens

ctokenValue = `(cTokenBalance`\* `exchangeRate / 10^18 / 10^(underlying token decimals))` \* `underlying_price`

\[<https://lineascan.build/address/0x333D8b480BDB25eA7Be4Dd87EEB359988CE1b30D#readProxyContract#F5>\\

\
<https://lineascan.build/address/0x333D8b480BDB25eA7Be4Dd87EEB359988CE1b30D#readProxyContract#F11>]\(<https://lineascan.build/address/0x333D8b480BDB25eA7Be4Dd87EEB359988CE1b30D#readProxyContract#F5&#xD;&#xA;&#xD;&#xA;https://lineascan.build/address/0x333D8b480BDB25eA7Be4Dd87EEB359988CE1b30D#readProxyContract#F11>)

## Liquidations

Liquidation happen by calling the liquidateBorrow function for the specific user, specific collateral and specific cToken.&#x20;

Liquidators are responsible to track all user's balances and to make sure the users AccountLiquidity is negative.&#x20;

There are multiple guides available to build your own liquidation bot, but it is important to consider it is a very competitive space where success is dependent on gas efficiency of the contract and latency. &#x20;


---

# 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://ionian.gitbook.io/mendi-finance/protocol/developer-docs.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.
