> For the complete documentation index, see [llms.txt](https://docs.francium.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.francium.io/product/what-is-leveraged-yield-farming-lyf.md).

# 💡 What is Leveraged Farming?

Imagine this scenario

Alice is a happy farmer. She earns a good return by planting and selling wheat. Alice wants to farm more wheat, but has a limited amount of money. She knows her neighbor Bob has money and makes him an offer.

Alice asks Bob if she can borrow money to buy more seeds, and in return, she’ll pay Bob part of the harvest.

Now let’s apply Leveraged Yield Farming (LYF) to this example. Imagine Alice having $1,000 USDC to start with. Therefore, she borrows 1,000 USDC from Bob. Now Alice has $2,000 and buys wheat seeds for farming.

Alice pays Bob 10% interest for the $1,000 she borrowed from him. But Alice earns an income from $2,000, and this is farming with 2x leverage.

Investment returns are not guaranteed. When Alice offered to borrow $1,000 USDC from Bob, he understood the risk. If he does not lend Alice $1,000 USDC, his money is safe. If he lends Alice $1,000 USDC, he earns 10% ($100 USDC) interest every year. But if Alice fails to plant wheat or if the price of wheat drops, she might not be able to repay either the principal or interest.

Bob wants to limit his risk when lending money, so he and Alice reach an agreement. If the value of Alice’s wheat declines to a certain amount, Alice will liquidate all of the wheat and return Bob’s $1,000 USDC. This is an example of Leveraged Yield Farming with a liquidation.

But what if Alice borrows wheat instead of USDC from Bob? And what if the value of Alice’s assets is not only dependent on wheat?&#x20;

**Longing, Shorting & Hedging LP tokens with LYF:**

The above example illustrates a common use of Leveraged Yield Farming (LYF). LYF can increase the income of the farm by borrowing or longing specific assets.

Providing liquidity for two tokens (LP) is the most common use case in Decentralized Finance or DeFi. To understand the performance of LYF, let’s create a stable coin model.

There are two tokens in this model: Token A & Stable Coin USDC. Let’s take **P** as the price of A, using the amount of USDC as a unit. Initially, Charlie holds **N** USDC, and the price of A is **P₀**. When he participated in LYF with leverage **Y**:

1. **N(Y-1)** USDC were borrowed from the lending pool.
2. **NY/2** USDC (half of total USDC) will be swapped for A.
3. Deposit A & USDC for LP tokens.
4. Stake LP tokens into the farming pool.

When closing the position, the following steps are followed:

1. Redeem all LP tokens for A & USDC.
2. Sell all A for USDC.
3. Repay **N(Y-1)** USDC.
4. You get the remaining USDC.

Based on the AMM formula, when **P** changes, the amount of USDC we can withdraw by redeeming the LP token is:

![](https://miro.medium.com/max/72/1*SsyvwJ-Tp2BrczyVZfb-tQ.gif)

So when you close the position, the profit you get is:

![](https://miro.medium.com/max/116/1*_B5QEPdgWYcHM3bL73xhyA.gif)

In traditional longing, the profit we can get by longing **X** A is **X(P-P₀)**. Without losing generality, let’s make the initial price **P₀=100.** The performance of longing with different leverage is illustrated below:

![USDC Profits on 1x/2x/3x Margin VS Traditional 1x](https://miro.medium.com/max/700/0*zQTxSf9BCcPhU0iE)

But the role of LYF is not only that. If you are a keen trader, you may think that if the price of a certain token falls within a certain period of time, the best way to make a profit from it is to go short this token. The usual steps are: when token A's price is **P₀**, borrow **X** token A, sell **X** token A for **Y** token B immediately, and when token A's price drops to **P**, buy **X** token A back. By doing so, the profit you get is **X\*(P₀-P)** token B-borrowing interest. With LYF, there is a little difference. If you are holding **X** token A and open a **3X** leverage position, you will automatically borrow **2X** token A from the lending pool, and half of total token A, **1.5X** of A will be swapped to token B immediately, and **0.5X** of token A short exposure is generated instantly. With traditional shorting, you can only earn a profit from a price drop, but with yield farming, you can also earn LP tokens apart from the price drop. It’s a safer method to short a certain asset since the LP price and the token price have a square-root relationship. You might doubt whether it is a good method to short, so next we will show you the performance of shorting with LYF by using the same model.

Initially, Charlie holds **M** A, whose initial price is **P₀**, when he participated in LYF with leverage **Y**:

1. **M(Y-1)** A are borrowed from the lending pool.
2. **MY/2** A (half of total A) will be swapped for B.
3. Deposit A and B for LP tokens.
4. Stake LP tokens into the farming pool.

When closing the position, it follows the next steps:

1. Redeem All LP tokens for A\&B
2. Sell all B for A
3. Repay **M(Y-1)** A
4. You get the remaining A

Based on the AMM formula, when P changes, the amount of A we can withdraw by redeeming an LP token is:

![](https://miro.medium.com/max/75/1*UR75qQ31FwOn3eDKdKSX0A.gif)

The total worth of LP tokens are:

![](https://miro.medium.com/max/85/1*pS9TEWzjb0T6C6Ilw5aNfQ.gif)

When you the close position, the profit you get is:

![](https://miro.medium.com/max/134/1*5dIyI1m7VbJGX-yvhdvR9A.gif)

In traditional shorting, the profit we can get by shorting is:

![](https://miro.medium.com/max/87/1*eBtinoVuNGIWOOvYIBnf0Q.gif)

Without losing generality, let’s make the initial price **100.** (Due to the similarity solution, you can get the same performance at other initial prices)

![Token A 1x/2x/3x Margin Profit, with USDC as Principal
](https://miro.medium.com/max/700/0*cbTYqSxqb83DRg08)

![Token A 1x/2x/3x Margin Profit, with Token A as Principal](https://miro.medium.com/max/700/0*N_bhJEPeNpMqTy2S)

From the above figures, you can see the LYF curve is smoother. When the leverage is equal, long & shorting with LYF can reduce the risk when the price is going up/down. When the leverage reaches twice that of the traditional short, it begins to suppress the profit of traditional longing and shorting within a certain range, but the cost is higher when prices fall or rise, or when capital usage is higher. It may look like a simple long/short strategy, but there is an important factor we haven’t taken into account: farming yield, or maybe what we can call self-adjusting leverage. Because our LP tokens keep earning rewards and those rewards are reinvested into our LP tokens, the borrowed tokens are going to take a lower and lower proportion relative to the capital, so we have decreasing leverage. For example, if token A is not likely to fluctuate within a short time, LYF longing/shorting can make it more resistant to market volatility in the future. In a constant APR auto-compound model, the profit can be demonstrated as below:

![Illustration of the auto-compound model](https://miro.medium.com/max/700/1*hH8-Tt1ZleR-DVrZ76n35A.gif)

{% embed url="<https://francium-defi.medium.com/francium-explained-what-is-leveraged-yield-farming-lyf-5a203a0d649>" %}


---

# 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://docs.francium.io/product/what-is-leveraged-yield-farming-lyf.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.
