> For the complete documentation index, see [llms.txt](https://nest-finance.gitbook.io/nest-finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nest-finance.gitbook.io/nest-finance/products/multiply/how-it-works.md).

# How It Works

Multiply allows a user to open a leverage position where they can increase their exposure to a yield-bearing asset by borrowing the underlying asset. (eg. increase exposure to xUSDC by borrowing XRD). This is enabled by two N-Lend mechanisms: eMode and flash loans.

#### What is eMode? <a href="#what-is-emode" id="what-is-emode"></a>

Multiply vaults also take advantage of Elevation Mode (eMode), a N-Lend mechanism that allows for higher loan-to-value ratios (i.e. higher leverage) between assets that are pegged in price.For example, in a **xUSDC/XRD Multiply vault**, xUSDC is supplied, and XRD is borrowed. This position is then looped up to a target leverage amount. Typically, these assets have a 75% LTV, allowing for 4x leverage. However, with eMode, their LTV can be raised to 90%, allowing for up to 10x leverage.

#### How do I know I am earning yield? <a href="#how-do-i-know-i-am-earning-yield" id="how-do-i-know-i-am-earning-yield"></a>

As long as the yield on your yield-bearing asset is higher than the borrow APU, you will have a **positive Net APY**. While your Net APY is positive, your position's XRD balance should be increasing.

#### Where does the yield come from? <a href="#where-does-the-yield-come-from" id="where-does-the-yield-come-from"></a>

There are two sources of yield, depending on the vault you are using:

* XRD staking yield
* Market making yield, earned on nTokens via trading fees in Nest Finance liquidity vaults

Some vaults also combine these two sources (eg. nTokens like nXUSDC-XRD), thus earning staking and market making yield.

#### How do flash loans work? <a href="#how-do-flash-loans-work" id="how-do-flash-loans-work"></a>

Flash loans are a DeFi innovation that enables you to take a loan without posting collateral, given that the loan is repaid within that same transaction. In multiply, a user inputs their **deposit amount** and **target leverage** (Multiplier) amount. Using these values, the protocol can identify how much XRD needs to be borrowed in the flash loan. Then:

1. XRD is borrowed
2. XRD is swapped to target asset (eg. xUSDC)
3. Target asset is supplied in N-Lend
4. XRD is borrowed against target asset
5. Borrowed XRD is used to repay the initial flash loan
6. Position is open at target leverage

#### What are the fees? <a href="#what-are-the-fees" id="what-are-the-fees"></a>

Every action in Multiply uses the N-Lend flash loans mechanism, which incurs no fee. Users also pay the borrow APY on the debt asset in their position - note that **this is already factored into the Net APY.**

#### What about liquidations? <a href="#what-about-liquidations" id="what-about-liquidations"></a>

Coming soon..​

#### How does nToken Multiply work? <a href="#how-does-ktoken-multiply-work" id="how-does-ktoken-multiply-work"></a>

Taking a leverage position using a kToken in Multiply works very similar to a standard leverage position. The two key differences are:

1. Exposure to the price of two assets on the collateral side, instead of one
2. Exposure to market-making yield in addition to staking yield

#### Multiply Example <a href="#multiply-example" id="multiply-example"></a>

A user has 1000 XRD. They deposit their XRD into a xUSDC/XRD Multiply vault. They set an 8x Multiplier. **Now, let's say:**

* `xUSDC/XRD price ratio = 1.2`
* `xUSDC APY = 7%`
* `XRD borrow rate = 6%`

**Thus, user's position:**&#x55;ser made a 1000 XRD Deposit, with 8x leverage

* `Total XRD Exposure: 1000 * 8 =`` `**`8000 XRD collateral`**
* `Total XRD Debt = Total Exposure - Initial Deposit`&#x20;
* `Total XRD Debt = 8000 - 1000 =`` `**`7000 XRD debt`**
* `LTV: Debt / Collateral LTV: 7000 / 8000 =`` `**`87.5% LTV`**

`xUSDC APY = 7% :: 8000 * 7% = 560 XRD - Earned from Staking APYBorrow APY = 6% :: 7000 * 6% = 420 XRD - Paid in Borrow Rate`**`Net XRD Earned`**` ``= 560 - 350 = 140 XRDNet APY = Net XRD Earned / Initial Deposit = 140 / 1000 =`` `**`14%`**
