> For the complete documentation index, see [llms.txt](https://ionian.gitbook.io/mendi-finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ionian.gitbook.io/mendi-finance/protocol/developer-docs.md).

# 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;
