# Overview

## Summary

The BAMM is a borrowing/lending module built on top of Fraxswap. Unlike other borrowing lending modules, the BAMM does not need an outside oracle or external liquidity to function safely. This is because the needed liquidity is provided by the lenders. With the BAMM we can create borrowing lending services for pairs that were previously impossible, because they did not have a solid oracles or sufficient liquidity. Borrowers rent liquidity provided by lenders to automatically leverage up and down, such that they can stay solvent even in the case of high volatility. This means borrowers can not experience sudden liquidations, so there is also no need to pay high liquidation fees to liquidators, creating a better deal for both borrowers and lenders. Each BAMM pool is build on top of a single Fraxswap pool that holds two tokens. Borrowers can safely long and short each token without fear of sudden liquidation.

<figure><picture><source srcset="/files/NCEqDfLKg9qmWNTq4sfJ" media="(prefers-color-scheme: dark)"><img src="/files/SMKr8XIHQ9KVufe6xM2V" alt=""></picture><figcaption><p>Chart - 1 : BAMM Protocol Action Flow</p></figcaption></figure>

**Lenders**&#x20;

Lenders lend their full range liquidity LP tokens from Fraxswap to the BAMM lending pool. The amount lent is calculated used the following formula: sqrt(X×Y) / LP total supply. Where X and Y are the number of the two tokens in the pool. Lenders earn trading fees from Fraxswap and interest rate from borrowers that rent their liquidity.

<figure><picture><source srcset="/files/o9Ad1GbXg2lR5jrrMNrY" media="(prefers-color-scheme: dark)"><img src="/files/x8mjfktp5JcirPxjEPnR" alt=""></picture><figcaption><p>Chart - 2 : BAMM Protocol Lender's Action Flow</p></figcaption></figure>

**Borrowers**&#x20;

Each borrower has its own vault where they put in their collateral, rent liquidity from the liquidity pool and withdraw tokens. Rented liquidity LP tokens are burned when rented and the underlying tokens are put in the users vault to act as collateral. The user can also withdraw tokens from their vault, but they must remain solvent. A user is solvent when the rented liquidity amount is less than 98% of the sqrt(X×Y) of their vault. Note that for both the amount of the rented LP and the assets in the vault, the sqrt(X×Y) is used to calculate solvency. These values are unchanged when there are price movements, so the borrower can not get insolvent when prices change. The borrowers debt, denominated in sqrt(XxY), slowly increases over time due to interest rate payments, so borrowers should periodically check their position to avoid liquidation. The interest rate for the rented liquidity is calculated using a dynamic interest rate model that is used in Fraxlend as well.

<figure><picture><source srcset="/files/ynLdsuIJUCu9zVhdpmlC" media="(prefers-color-scheme: dark)"><img src="/files/uqIZir0pH8efDjagX0gc" alt=""></picture><figcaption><p>Chart - 3 : BAMM Protocol Borrower's Action Flow</p></figcaption></figure>


---

# 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.frax.finance/bamm/overview.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.
