Providing Liquidity and Yield Farming in DeFi: Process, Benefits and Risks

9 min readJan 31, 2022

The crypto space has been evolving at an amazing pace. One of the more interesting evolutions, in my opinion, is DeFi (Decentralized Finance). Anyone who participates in DeFi is really searching for yield on their assets. Yield doesn’t come without risk (‘there is no free lunch’… TradFi saying), and I do believe some yields are more sustainable than others (check out my piece on sustainable yields in DeFi). There are currently 4 major ways to get yield in in DeFi (see below), but I want to focus this article on Providing Liquidity and Yield Farming.

  • Lending — You can lend out your digital assets to different protocols, which is nice because your yield is paid back in the asset you lend (though that’s not always the case…).
  • Single Asset Staking — You can go to specific protocols and stake your tokens with that protocol. These protocols reward you with more of that token.
  • Yield Farming — You can provide liquidity to Liquidity Pools, and then depositing those LP tokens in Yield Farms. Yield farming can provide some really juicy yields, but most times these yields are based on emissions from the protocol and are paid in the specific token trying to bootstrap liquidity.
  • Decentralized Option Vaults (DOVs) — You can deposit tokens into DOVs strategies (like Covered Calls and Cash Covered Puts, check out these articles) and earn yield by having these strategies sell options on your behalf. This ‘short volatility’ (short gamma) strategy can earn sustainable yields paid in the deposit tokens, but risks token loss when prices swing against you drastically. I would not recommend anyone doing these strategies on their own unless you are well versed in options trading and theory. Please use a DOV instead (and please understand the risks you are taking, no yield is free!).

So what is Providing Liquidity

If you have ever swapped tokens on a Decentralized Exchange (DEX), there is a good chance you used an Automated Market Maker (AMM). AMM’s create liquidity pools for a pair of tokens so that users can swap 1 of those tokens for the other, and back. Uniswap (Ethereum),

(Solana), Pancakeswap (BSC) are 3 AMMs. The most common setup for a AMM is a constant product market maker, and many use a 50/50 split. What this means is that the value of token A = the value of token B (that’s the 50/50) within the pool. The setup is usually supply A * supply B = k. And that k cannot change. (i.e. we know that Supply B = k / Supply A = Supply A * Price A / B). So as the price of A increases, the supply of A decreases relative to the initial supply of A, so that the formula’s balance. This is the setup we will use in the example below. Note there are other ways to set this up (doesn’t have to be 50/50), and there are different models out there other than constant product, along with more than 2 tokens in a pool (like Balancer). But this setup is the most common currently.

These AMMs need to have large pools in order to satisfy the demand for users to swap, and to not have large slippage in the swap price within the liquidity pool relative to the prices in the open market. To do this, they need to incentivize liquidity providers to provide their tokens to the pool. There are 2 ways to provide yield to the liquidity providers. First, the AMM can give a portion of the fees collected to liquidity providers (ex. AMM chargers 0.3% to swap and gives 0.25% to liquidity providers). But this may not be enough to incentivize liquidity, especially on new tokens. So many new projects try to bootstrap liquidity in their token by providing yield farming incentives.

Here is an example of different supply of tokens that keep a 50/50 AMM in balance (this is from the example below).

Different combinations of Supply of Tokens A and B that keep the Constant Product AMM at a 50/50 Ratio

So what is Yield Farming

When you provide liquidity to an AMM (let’s say equal value of tokens A and B), you receive back an LP token. This LP token represents your share of the Liquidity Pool. If a protocol is trying to bootstrap liquidity for their token, they may be providing extra incentive for those LP providers, in the form of token emissions, i.e. the yield in yield farming. Token emissions can be seen the the tokens ‘tokenomics’. Token emissions are coins set aside for liquidity providers; they usually have set schedules and end at some point.

To yield farm, you need to take your LP tokens, then deposit them into a farm. Many AMMs (like

) have “Farms” tabs within the dApp already. So you can stay within 1 dApp to provide liquidity, and yield farm. Yield farm rewards are paid over time, and they need to be harvested. That means your rewards are not in your wallet until you harvest them, and these rewards are not compounding. In order to compound your rewards (turn an ‘APR’ into an ‘APY’), you need to:

  1. harvest your farming rewards (usually paid in the token trying to bootstrap liquidity)
  2. Swap 1/2 of the rewards into the other token
  3. Deposit both tokens (in that 50/50 value split) into the Liquidity Pool
  4. Take your new LP tokens and deposit into the farm

This seems like a lot of work to compound rewards. Luckily, there are protocols out there that do this for you! My favorite is

on Solana.

What are the Risks?

The biggest risk is just the price risk of holding both tokens. We will go through an example below. But the most important point here is that you have price risk on both tokens you provide to the LP. If a price goes to 0, your position goes to 0.

Another big risk is Platform Risk/Smart Contract Risk/Protocol Risk. Basically the risk that you get rugged by the dApp that you are using to provide liquidity, or they get hacked, or a token or pool is faked, etc. You may even have multiple layers of this risk. In the case of an auto-compounder (like

), you have Platform risk at the Tulip level and at the AMM level ( for example).

Finally, another risk is Impermanent Loss (IL). IL is a feature of providing liquidity to a constant product Automated Market Maker. Basically, IL is the opportunity cost of providing liquidity to an AMM instead of holding both tokens. This happens because as the price of Token A (relative to token B) goes up, the amount of token A you get back (if you redeem your LP tokens) goes down relative to the initial amount of token A you supplied. In that case, it would have been better to just hodl token A instead of supplying it to the LP. The complete opposite happens when the price of token A (relative to token B) goes down. We all hope that yields are larger than IL, but many have been burned by it.

Stylized Example Showing Impermanent Loss and Yield


You want to provide Liquidity to a pair with a volatile token A and a stable token B. You want to provide to a 50/50 AMM.

  • Token A is priced at 100 USD, token B is priced at 1 USD (and never changes)
  • You initially supply 10 tokens A and 1000 tokens B, for a total 100 * 10 + 1000 * 1 = 2000 USD
  • The AMM charges 30 bps per trade (that is the AMM fee) and the total yield you receive is 20% annualized

Let’s see what happens after holding that LP for 30 days and them redeem your LP tokens back for the initial tokens A and B.

Token A Price Doubles

Lets say price doubles from 100 to 200.

  • You would have 7.06 tokens A and 1416.33 tokens B.
  • Your total value of the LP position would be $2868.12 and the total value of hodling would have been $3000 (1000 of token A * 200 + 1000 of token B * 1).
  • Your gain is 43.4%, but you could have been up 50%, so you missed out on $131.88 of gains.
  • Your IL + Yield would be (2868.12- 3000) / 3000 = -4.39%.

Token A Price Halves

Lets say price halves from 100 to 50.

  • You would have 14.12 tokens A and 708.17 tokens B.
  • Your total value of the LP position would be $1442.28 and the total value of hodling would have been $1500 (1000 * 50 + 1000) .
  • Your loss is -27.89%, but you could have only lost 25%, so you had an extra loss of -$57.72 .
  • Your IL + Yield would be (1442.28- 1500) / 1500= -3.85%.

Token A Price Doesn’t Move

Lets say price doesn’t move and stays at 100.

  • You would have 9.99 tokens A, 1001.5 tokens B (it changes only because of fees)
  • Your total value of the LP position would be 2032.88 and the total value of hodling would have been 2000.
  • Your gain is 1.64%, that would have been 0% if you did not provide liquidity, so you had an extra gain of $32.88.
  • Your IL + Yield would be (2032.88–2000) / 2000 = 1.64%
P&L from Hodling the initial supply of both tokens (Orange) versus Providing Liquidity & Yield Farming (Blue)
The difference between Hodling both tokens vs Providing Liquidity (orange minus blue above)

You can start to see that you are essentially short volatility (similar to DOVs Covered Calls and Cash Covered Puts) when providing liquidity. You lose out, relative to hodling, through Impermanent Loss when the price ratio of the tokens exhibits volatility. You really need to be compensated for a higher volatility pair through token emissions. But that comes with its own risks. Unfortunately, it seems like people jump into a farm, then quickly jump out and dump tokens, creating a negative feedback loop for prices. See the quote and articles below.

“Here’s what might be a more interesting statistic: A whopping 42% of yield farmers that enter a farm on the day it launches exit within 24 hours. Around 16% leave within 48 hours, and by the third day, 70% of these users would have withdrawn from the contract.” (

Also check out the “ROI is the new APY” section of this Friktion Article

How Do I Provide Liquidity and Yield Farm (Solana Example)

Let’s give a quick example of the full set of steps to yield farming. Let’s say you want to provide RAY-SOL liquidity and farm it on

. Say you want to provide $100 worth of liquidity, you only hold SOL, SOL = $100 and RAY = $5 currently (and nofees or transaction costs…) .

  1. Take 0.5 SOL and swap it for 10 RAY (= $50 worth of SOL into $50 worth of RAY) (I would recommend checking out for all swapping needs on Solana)
  2. Take 0.5 SOL and the new 10 RAY and supply it to the RAY-SOL LP
  3. Take you new RAY-SOL LP Tokens and deposit them in the RAY-SOL LP Farm
  4. Wait until you have some RAY token rewards
  5. Harvest your RAY Rewards
  6. Swap half of your RAY rewards back into SOL
  7. Repeat steps 3:7

OR instead of the previous step 3, move over to

3. Take your new RAY-SOL LP Tokens and deposit it into the Tulip RAY-SOL LP Vault

4. Enjoy watching your LP position grow!

My favorite thing to do is use DeFi Aggregators. These allow you to have best in class swapping rates, lending rates, yield farming, and DOVs all in one dApp. They do this by partnering with multiple other protocols and hosting them all on one dApp. I am looking forward to using

in the Solana Ecosystem for this!

I hope this explains what providing liquidity and yield farming is, and the risks, rewards, and how-to!

About the Author

For full disclosure I mostly use Solana for DeFi, because I don’t have enough assets to justify Ethereum gas fees. I have a little bit in Algorand, Cardano and Polkadot DeFi. I am actively involved in multiple

volts and a contributor in their Discord, and am beta testing .

I am invested in SOL, ADA, ETH, DOT, ALGO, MIOTA along with plenty of other tokens.

This is not Financial Advice!




TradFi background (CFA/CFP), DeFi Degen. Love ETH, ADA, ATOM, KUJI, SOL, DOT, NEAR,