How to Solana — Chapter 4: Yield Farming & Yield Aggregators
Yield farming is perhaps the main activity that kicked off the entire Decentralized Finance (DeFi) narrative.
Yield farming is the practice of staking or lending crypto assets on a protocol in order to generate high returns or rewards in the form of additional cryptocurrency. Capital is allocated by users to DeFi protocols which then provide services to end-users, the protocols incentivize this liquidity by offering rewards, e.g. a percentage of transaction fees, interest from lenders or a governance token etc. Protocols need this liquidity to execute their services (AMMs need pools to form exchange pairs, lending protocols need pools to lend/borrow). Fees are sometimes charged for this service and are shared between the capital providers (yield farmers) and the protocol. In addition, protocols sometimes provide incentives for yield farmers in the form emissions of their native token in order to bootstrap growth for the protocol.
Early users of DeFi found this concept of earning steady income on their capital extremely attractive and it quickly gained traction as many projects and protocols started participating in this strategy. However, there are risks involved in yield farming which we will go through in this chapter where we outline how to navigate the yield opportunities within the Solana ecosystem.
How to Yield Farm
This guide assumes that you have already installed a Solana wallet (Phantom / Sollet / Coin98 / etc are good choices) and are ready to do some yield farming. In this example we will use one of the earliest and biggest protocols for yield farming — Raydium.
Step 1 — Find your farm
- Access https://raydium.io/farms/
- Upon landing, connect your Solana wallet
- Browse the available farms and choose the one that you would like to farm.
- You will need to provide liquidity on Raydium in order to receive an equivalent amount of Liquidity Provider (LP) tokens that signifies your share of the pool. These LP tokens can be staked in the farms in order to receive additional yield in the form of incentivized tokens that are emitted by the protocol.
Step 2 — Provide liquidity as a Liquidity Provider (LP)
- For this example, we’ll choose RAY-SOL LP, which here will provide 40.51% APR
- First we will need to acquire RAY-SOL LP tokens.
- For LP tokens, most protocols will generally require you to have a 50/50 ratio for the pairs used in the farm in the amount of liquidity you would like to provide (with a few exceptions that use other ratios such as 80/20 and so on). In this case, we will first need to either swap or already have a 50/50 ratio of RAY and SOL available in order to provide liquidity.
- This can easily be achieved via any swaps as shown in Chapter 2.
- Once you have obtained a 50/50 ratio, just click on the Liquidity tab or head to https://raydium.io/liquidity/.
- For the Inputs, click the pairs you would like to LP with. In this case, SOL and RAY.
- Then, input the amount of capital you would like to LP in at a 50/50 ratio.
- Click “Supply” and approve the transaction on your wallet.
- When you see that the transaction has been confirmed, you’ll have successfully provided liquidity and received LP tokens to signify your share of the pool.
- Now that you have provided liquidity, you are automatically receiving a portion of all fees from every swap transaction in the liquidity pool (On raydium, 0.25% of every transaction is charged as fee; 0.22% is given to Liquidity Providers and 0.3% is given to RAY stakers).
Step 3 — Staking LP Tokens for additional yield
- Head back to https://raydium.io/farms/
- Click Stake LP
- Click Confirm and approve your transaction
- Once your transaction is confirmed, you will have successfully staked your LP tokens and started yield farming. Your yield will start to accrue and you can harvest it whenever you like.
Step 4 — Harvesting your yield
- Click Harvest and approve the transaction
- Your yield will be sent to your wallet automatically.
- In this example, the farm yields RAY — by harvesting, you will receive RAY tokens.
Step 5 — (Optional) Compounding your yield
- Some yield farmers opt to compound their yield by harvesting and providing liquidity to receive LP tokens to stake again.
- This is an effective strategy to increase the amount of yield receive over time.
- This step can be automated using Yield Aggregators (explained below)
Step 6 — Exiting the yield farm
- Click the “-” button
- Click Confirm and approve the transaction
- When it is confirmed, you will have successfully unstaked your LP Tokens.
- Now, you need to remove your liquidity from the pool
- Head back to https://raydium.io/liquidity/
- You will be able to view the liquidity that you have provided here
- Click Remove
- Select Max to remove all liquidity
- Click Confirm and Approve the transaction
- Once it has been confirmed, the underlying tokens will be sent to your wallet. In this case, it will be RAY and SOL tokens.
Risks involved in Yield Farming
Yield farming is lucrative, but what are the risks? Throughout your DeFi journey you will come across many projects and protocols that offer high amounts of yield, to the tune of 4,5 or even 8 figure APYs. We would advise caution and deep research to understand the mechanics behind yield farming before attempting to allocate your capital into such farms.
Here are the two main risks you should be aware of:
Smart Contract Risk
- Smart Contract risk is present in all projects with yield farming being no exception. Some projects have bad actors who seek to steal or “rug” users who interact with the smart contract. This can be especially dangerous for new and unknown projects that promote high APYs.
Impermanent Loss Risk
- Impermanent Loss refers to the temporary or permanent loss of funds due to volatility leading to divergence in price between token pairs provided by liquidity providers. Arbitrageurs change the ratio of assets in the pool to reflect the price disparity, meaning that when you withdraw the percent of liquidity you provided to the pool, after factoring in yield your profit may not be as much as if you just HODL’d the tokens directly.
Yield aggregators essentially create farming strategies and automate the compounding process that would otherwise be done manually by users. Yield aggregators achieve efficiency by deploying capital into various yield farms and optimizing the compounding period and gas fees for its users. If a user were to compound by themselves, the compounded value of the yield vs cost of gas fees might be economical enough to compound that often as the gas fees would make the strategy suboptimal. However, when everyone stakes their LP tokens together in a yield aggregator, the value of the yield harvested goes up and it becomes more efficient to compound more frequently, thus increasing the total APY generated.
For this example we will be using Tulip Protocol, one of the earliest yield aggregators on Solana.
Step 1 — Find your yield aggregator
- Access https://tulip.garden/vaults/
- Upon landing, connect your Solana wallet
- Look through the available farms and find one that you would like to farm.
Step 2 — Provide liquidity and stake
- Click the link next to the farm and it will take you to the respective yield farm for you to add liquidity to acquire your LP tokens.
- Once you have successfully done that, you can deposit your tokens in the vault
- Approve the transaction and you are done! The yield aggregator will automatically compound your yield into LP tokens and increase the yield* gained over time.
*watch out for the performance fees, different yield aggregators charge different fees and this will affect overall yield.
- Orca — Orca is the easiest way to exchange cryptocurrency on the Solana blockchain. Here, you can exchange tokens with minimal transaction fees and lower latency than any DEX on Ethereum, all while knowing that you’re getting a fair price.
- Mercurial — Mercurial is building new liquidity systems to maximize the utility and yield of stable assets on Solana. As the DeFi ecosystem on Solana grows, there will be many different variants of collateralized, wrapped, and synthetic assets in the space. Our most immediate objective is to provide the best liquidity for all the major stable and pegged assets on Solana, which we started with our Mainnet beta.
- Raydium — Raydium is an automated market maker (AMM) platform built on Solana where users can swap, trade and provide liquidity to earn yield on digital assets. However, unlike other AMM platforms, Raydium’s AMM provides on-chain liquidity to Serum’s central limit order book, meaning that Raydium’s users and liquidity pools have access to the order flow and liquidity of the entire Serum ecosystem, and vice versa.
- Saber — Saber is the leading cross-chain stablecoin exchange on Solana, providing the liquidity foundation for stablecoins, or a cryptocurrency whose value is pegged to another asset. As Solana’s core cross-chain liquidity network, Saber facilitates the transfer of assets between Solana and other blockchains. Market makers deposit crypto into a Saber liquidity pool to earn passive yield from transaction fees, token-based incentives, and eventually automated DeFi strategies.