# Borrowing

As established in the AMM section,

*(or***X***) refers to the supplied asset of a pool.***Y****Z***refers to the interest per second of the pool. Depending on the spot price of the assets and the transition price of the pool,**can be the borrowable asset and***X***the collateral asset, or vice versa, in any case, the borrowable asset will always be either***Y***or***X***(but not both of them).***Y***(or*

**ΔY***)*

**ΔX***represents the borrower's locked collateral.*

*represents the change in the pool's reserve of the total interest.*

**ΔZ*d***(or*

**ΔX***)*

**ΔY***represents the change in the pool's reserve for the borrowable asset (i.e., the principal amount borrowed by borrowers).*

Borrowers lock the collateral asset and takes the borrowable asset from the pool, while paying interest upfront in the form of the collateral asset.

In other words, borrowers add

*to the AMM and remove***Z*d***(or***X***)***Y***from the AMM. Note that the collateral asset**(or***Y***)***X****is completely isolated from the pool.**A borrow transaction is denoted by the following formula:

$(X + Y - ΔX - ΔY)(Z + ΔZ) = K$

The borrowed amount along with their interest is represented by an ERC-1155 token (called the Collateral Claim Token, CCT). CCT represents the locked collateral and borrowing position.

A borrowing transaction increases the pool's interest rate for the next transactions. The larger the borrowed size relative to the available liquidity of the pool, the higher the interest rate for the next transactions will be. This is known as

**price impact**. However, note that this does not affect the interest rate of borrowers/lenders prior to this transaction.**The exact calculations of the new interest rate (after a borrowing transaction) is as follows:**

$I = (Z +ΔZ)/(X+Y-ΔX-ΔY)$

*Where,*

**Z***represents the original reserves of interest per second in the AMM***ΔZ***represents the change in interest per second (w.r.t. the AMM),**which in this scenario, is positive***X***represents the original reserves of Token A in the AMM***ΔX***represents the change in Token A (w.r.t. the AMM),**which in this scenario, is negative***Y***represents the original reserves of Token B in the AMM,**which in this scenario, is zero***ΔY***represents the change in Token B (w.r.t. the AMM),**which in this scenario, is zero*

**Thus,**

**t****he pool's interest rate increases as more borrowing happens.**

At maturity, the CCT held by borrowers will be worthless as it could not be used to claim the locked collateral anymore. The locked collateral is forfeited and distributed to lenders and LPs.

Hence, borrowers have to repay their debts before maturity in order to claim their locked collateral.

When repaying their debts, borrowers add

*(or***X***) to the AMM, while removing***Y***from the AMM and unlocking their locked collateral. As a result, after closing a borrow position, the pool's interest rate will decrease.***Z*d**Note that closing their borrowing positions early does not charge interest in a pro-rated manner. The variables determining how much interest a borrower has to pay to close their debts (before maturity) are: 1) how long the borrower has been borrowing for, 2) the interest rates at entry and exit, and 3) the amount of liquidity available at exit.

The longer the borrower has been borrowing for, and the higher the interest rate at exit (relative to entry), the higher the proportion of the interest rate the borrower has to pay. Additionally, there is price impact based on the available liquidity.

Borrowers have to repay their debts before maturity, else their collateral will be forfeited.

The CCTs held by borrowers will be worthless at maturity and the forfeited collateral will be distributed to lenders and LPs.

Last modified 30d ago