From AMM to Leverage Yield Farming

Francium
8 min readDec 20, 2021

AMM

An automated market maker (AMM) is the underlying protocol that powers all decentralized exchanges (DEXs).

When liquidity is low in centralized exchanges, slippages tend to occur. That means the price of an asset at the point of executing trade shifts considerably before the trade is completed. Centralized exchanges rely on professional traders or financial institutions called Market Makers to provide liquidity for trading pairs.

DEXs replace order matching systems and order books with autonomous protocols called AMMs. In essence, users are not technically trading against counterparties — instead, they are trading against the liquidity locked inside smart contracts. These smart contracts are often called liquidity pools.

If you wanted to become a liquidity provider for an ETH/USDT pool, you’d need to deposit a certain predetermined ratio of ETH and USDT.

When ETH is purchased by traders, they add USDT to the pool and remove ETH from it. This causes the amount of ETH in the pool to fall, which, in turn, causes the price of ETH to increase. This is how AMM works and how traders interact with liquidity pools.

Examples of AMMs include Uniswap, Balancer, and Raydium.

Profit and Risk

What’s the profit and risk of being Liquidity Providers(LPs)?

As you see, AMMs require liquidity to function properly. To mitigate slippage, AMMs encourage users to deposit digital assets in liquidity pools so that other users can trade against these funds. As an incentive, the protocol rewards liquidity providers (LPs) with a fraction of the fees, paid when transactions are executed in the pool. In addition to this, AMMs also issue governance tokens to LPs. This is called Yield Farming. So the profit of providing Liquidity is Trading Fee + Farming Rewards.

One of the risks associated with liquidity pools is impermanent loss(IL). This occurs when the price ratio of pooled assets fluctuates. An LP automatically incurs losses when the price ratio of the pooled asset deviates from the price at which he deposited funds. The higher the price change, the higher the loss incurred. Impermanent losses commonly affect pools that contain volatile digital assets. However, this loss is impermanent because there is a probability that the price ratio will revert. The loss only becomes permanent when the LP withdraws the said funds before the price ratio reverts. Also, note that the potential earnings from transaction fees and LP token staking can sometimes cover such losses. The risk of providing liquidity is impermanent loss.

Leveraged Yield Farming

Leverage

In leveraged yield farming, users can borrow tokens to strengthen their farming positions and therefore, enjoy additional farming yields. The process is simple: in a leveraged yield farming protocol, users initially deposit any proportion of the two tokens. Users could deposit one of the two or a combination of both.

To set leverage, farmers can borrow one of the tokens up to the maximum leverage offered by Francium. 1x leverage means without leverage, such as with standard yield farming. 2x leverage means borrowing as much as you deposited as collateral, and 3x means borrowing two times more than you deposited. Let’s suppose you have deposited 10 USDC as collateral, in this case 1x leverage is also 10 USDC indicating that you have borrowed nothing.

To maximize your gains you may opt to borrow 10 USDC more, this is farming with 2x leverage. In this way, you’ll be able you enjoy yields resulting from 20 USDC, even though your collateral was only 10 USDC. If you borrow 20 USDC instead (2 times more than your collateral) you’ll enjoy a yield from 30 USDC (Your collateral: 10USDC + Borrowed assets: 20 USDC), this is known as leverage yield farming with 3x leverage.

Once you’ve selected your leverage and opened a position, the protocol would then use an integrated DEX to convert all deposited and borrowed tokens into a 50:50 proportion, adding them as liquidity into the DEX’s pool, and staking the received LP tokens in the subsequent farm. Yet, all of that happens at the backend. For you, it’s one simple click when opening a leveraged yield farming position.

Farmers earn yield farming rewards which equal to:

leveraged(farming rewards “plus” trading fees “minus” impermanent loss)“minus” borrowing interest

Although using leverage can bring greater profits, it also carries a greater risk of Impermanent loss.

Long/Short/Neutral Position

There are different methods by the virtue of which you can enjoy profits(besides the profit introduced above). In this lesson we will teach three basic concepts namely longing, shorting, and hedging of a position. It’s essential to understand the concept as it’ll help you to determine which assets you should borrow in a particular situation

Long position: When you believe that the price of a certain commodity will increase with time, so you buy that commodity at less price, and as its price increase you sell it out and earn a profit, this is a called long position. You came to know that the price of wheat will rise in near future, so you borrow USDC and purchased wheat of 10kg, at the price of 10 USDC. After a few days, the price of wheat (10kg) raised from 10 USDC to 12 USDC. Upon selling it to the market, you’ll return the borrowed USDC, have a profit of 2 USDC (Your own:10 USDC+ Profit: 2USDC, not count in interest).

Short Position: When you believe that the price of a certain commodity will decrease with time, so you borrow that commodity from the owner with the promise to return it to him and sells it to the market. As expected, its price dropped, you purchase the same commodity with a lesser price and return it to the owner, hence earning profit.

You borrowed 10kg wheat of a total worth 10USDC (1USDC/kg) sold it in the market, and now you have 10 USDC. With time price of wheat drops to 8USDC, at that time to buy wheat and return it to the owner. Your earning is 2USDC with the borrowed wheat.

Neutral Position: As explained earlier, Some profit would generate in a Long Position if the price of an asset increases; but some loss would be generated in the same position if the price decreases. What if you just want to get mining revenue and try to avoid the impact of price fluctuations on the value of your position? Setup a Neutral Position. This kind of position doesn’t sell or buy any volatile tokens while splitting to a 50:50 proportion.

In the scenario of normal yield farming without using leverage, only one fixed position setup could be selected — 50% of the position has Long exposure of the fluctuating token. But with leveraged yield farming, long/short/neutral potion setup could be selected and the size of long or short exposure could also be set up.

Farming on Francium

Long Position: You decided to farm with Francium, you have 10 USDC in your wallet, and you realize that the price of SOL will increase with time. For instance, now 1SOL=1USDC, and after a week: 1SOL=2USDC. Select SOL/USDC farming pair on Francium, and decide you use 10USDC as collateral (you can use one/both the assets as collateral).

As you believe that the price of SOL will rise so long SOL, and short USDC (if you borrow an asset it means you’re shorting that asset, which is USDC in this case )

Here we introduce the concept of leverage as if you set leverage of 2x (2*10), your total asset position value has assets worth 20 USDC (10USDC+0.0559 SOL based on the current SOL price). You’ll enjoy yield from assets worth 20 USDC despite investing 10 USDC only. (Total asset position value may differ when using the same assets, leverage, and principal due to price fluctuations)

Farming Flow:

Your yield farming rewards will be displayed in the “Farmed” column of your existing position. Apart from yield, you’ll also enjoy trading fee income and the number would be accumulated into the “Equity Value” column directly.

Equity Value: The estimated value you can get if you close your position (farmed value is already added to your equity)

Debt Value: Debt value of your position

Total Position: Total value of your position: Debt Value + Equity Value

Short Position: You decided to farm with Francium, you have 10 USDC in your wallet, and this time you realize that the price of SOL will decrease with time. For instance, now 1SOL=1USDC, and after a week: 2 SOL= 1USDC. So, select SOL/USDC farming pair on Francium, and decide you use 10USDC as collateral (you can use one/both the assets as collateral).

As you believe that the price of SOL will drop so you long USDC, and short SOL.

This time you decided to set leverage of 3x (3*10), your total asset position value will have assets worth 30 USDC (15USDC+0.0853 SOL). You’ll enjoy yield from assets worth 30 USDC despite investing 10 USDC only.

Neutral Position:

You decided to farm with Francium, you have 10 USDC in your wallet, and this time you want to create one neutral position. You could set up a 2x leveraged ratio, and choose to borrow SOL. This setup would not buy or sell SOL while splitting to 50:50 proportion. This is a relatively stable and low-risk farming strategy.

Note that this kind of position doesn’t sell or buy any fluctuating and borrowed tokens while splitting to a 50:50 proportion. Those positions whose setup matches this point(rule) would be neutral in nature. “Leverage Ratio = 2x, borrow fluctuating token” is one kind of setup which matches this rule.

You must be wondering what if I set leverage more than 2x, so, if the leverage ratio is 2.5 or 3 (anywhere between them) the user must borrow more than one kind of asset to match these key rules. If you set the leverage ratio to be 3x, you can borrow two kinds of assets hence forming another kind of neutral position. We will teach you about that in the upcoming lessons of our series.

For mathematical formulas related to LYF please visit: https://docs.francium.io/product/what-is-leveraged-yield-farming-lyf

Social Networks:

--

--

Francium

Francium is a leveraged yield farming protocol that supports diverse yield strategies. Discord: http://discord.gg/francium