> For the complete documentation index, see [llms.txt](https://ordibank.gitbook.io/untitled/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ordibank.gitbook.io/untitled/ordibank-tutorials/borrowing.md).

# Borrowing

In the Ordibank protocol, users have the ability to augment their account's collateral by utilizing the `supply` function. However, this action is constrained by the market's current state a parameter designed to mitigate risk exposure to collateral assets.

The inclusion of collateral assets amplifies a user's borrowing capacity, and this augmentation is contingent upon the asset's `borrowCollateralFactor`. These factors, depicted as percentages, signify the fraction of the collateral value that is eligible for borrowing.

To initiate borrowing of the base asset, the `withdraw` function is employed. However, adherence to the borrowing collateral factor requirements is imperative. In the event that a borrowing account falls short of these criteria, it is precluded from borrowing additional assets until it either fortifies its collateral by supplying more assets or reduces its borrow balance using the `supply` function.

Account balances for the base token are represented as signed integers. A positive balance signifies that the base asset has been supplied, while a negative balance indicates that the base asset has been borrowed.&#x20;

Internally, Ordibank utilizes dB to store account balances as principal values, also manifested as signed integers. The principal value, synonymous with the day-zero balance, denotes the balance an account would have at T0 to equate to the present account balance after interest accrual.

The global indices for supply and borrow operate as unsigned integers, progressively increasing over time to accommodate interest accrual on each side. Whenever an account engages with the protocol, the indices undergo updates and are persistently saved. Developers can calculate an account's present balance using the current index with the provided formulas:

$$\[Principal > 0]Balance=Principal×BaseSupplyIndex\[Principal > 0]$$

$$\[Principal < 0]Balance=Principal×BaseBorrowIndex\[Principal < 0]$$

This intricate system ensures precise tracking of collateral and borrowing activities in the Ordibank platform, enhancing developer control and user transparency within the cBTC money market.<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://ordibank.gitbook.io/untitled/ordibank-tutorials/borrowing.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
