Leveraged Yield Farming with Apricot
A hands-on guide with pros and cons
As promised, here is a tutorial on leveraged yield farming and what are the risks associated with, get ready, I will try to be concise although try to not miss any nuance.
For the sake of this example I will use the Solana blockchain together with Apricot Finance a recently created lending-protocol that I really like as they allow cross-margining (will explain more in detail later). I will farm on the @orca_so pool on the SOL/USDC pair.
This is how my initial “balance sheet” looks like, “My Deposit” (Assets) on the left, and “My Borrow” (Liabilities) on the right. Both are zero right now.
In order to leverage you will need equity that you can use as collateral. Apricot allows me to use mSOL (staked Solana from @MarinadeFinance) as collateral, so let’s deposit 50 mSOL (around 10k $ at time of writing).
Reward APY is currently at 0% but will probably be higher (IMHO around 5–10%) once the Apricot token goes live. Supply APY is 0.33% which is the interest rate we receive on our mSOL and at the same time mSOL accrues another 6–7% APY of staking rewards.
Once deposited the 50 mSOL, “My Deposit” shows the equivalent dollar value. Note that the “My Borrow” side is still at zero. Now click on X-Farm to see all available farms, for example how do you read the image below?
This is the SOL-USDT pool on Orca, a 50:500 AMM style pool. “LP Farming” refers to the reward rate, “Borrowing Interest” refers to how much we pay in interest to borrow SOL and USDT. “Net APY” is simply the sum of the two previous terms. “Final Net APY” shows the average APY of your portfolio, I would put this number somewhere to make the UI easier to read. Click on “Farm”
Here there are many useful information, starting from the top you can see how much SOL-USDT you can farm, basically your notional exposure to the pool and if you divide your farm exposure by the equity deposited you will get a measure of your portfolio leverage.
Once you click on “Start Farming” what happens in the background is the following:
-Borrow $10,041.91 SOL and $10,058.09 USDT at most
-Deposit the above into Orca to obtain $20,000 worth of SOL-USDT LP token
-Deposit the LP token back into your apricot account
Let’s get those yields!
Let’s see how our “Balance Sheet” has changed. Now “My Deposits” is sitting at 30’251$ and “My Borrow” at 19’989$, we have effectively leveraged the mSOL we deposited below, borrowed SOL and USDT and used the two to provide liquidity on Orca. Cool eh? Also we now have slightly more than 50 mSOL, this is thanks to continuous compounding of interest.
However, all that glitters is not gold, what are the risks associated with this strategy? There are three major risks in leveraged yield farming:
- INTEREST RATE risk
- IMPAIRMENT LOSS risk
- TECHNICAL risk
INTEREST RATE This is the most evident one and it’s easy to monitor. When you are paying more to borrow than what you are making in the farm you are losing money. To monitor, just check that APY on “My Borrow” are less than those on “My Deposits”. The old joke says that if you borrow at 3%, lend at 6% you will be playing gold by 3pm. Bankers humor eh
IMPAIRMENT LOSS This is very subtle and requires some financial knowledge. When you deposit capital to a pool you must always provide 50% of asset A and 50% of asset B to get the LP tokens. When you withdraw your LP tokens from the AMM pool, if the price of asset A w.r.t. to asset B is different, you will get back a different quantity of asset A and B compared to the one deposited initially.
The difference is NOT in your favor and this loss is generally called impairment loss, the higher the price change the higher the impairment loss. See the chart below to see how the $pnl is impacted by relative price changes in asset A and B.
Basically when entering a farm you are betting that price will NOT move, if you are familiar with derivatives you will realize that this is exactly the definition of a short Vol position which is usually achieved by short selling an ATM call and put.
When providing liquidity in a farm you can see that the downside is much steeper on the left side, a similar payout can be replicated in a option portfolio by selling a higher number of puts. Useless to say, short selling volatility (and options) is a very risky strategy that has unlimited downside and requires constant hedging to manage the positions. Only for PRO!
Last but not least, the TECHNOLOGY risk. When doing levered yield farming you are exposed to multiple protocols and each of them might hide bugs that could result in a complete wipe-out of your and everybody’s else funds. Ouch!
To recap, there are a lot of risks and it is not all rainbows and butterflies in the leveraged yield farming world. Your “farm” requires constant monitoring and care, only then you will see the fruits of your hard work.
@ApricotFinance has a very nice function called “Assist” that will automatically deleverage your portfolio when the borrow limit is above the triggering level. I have not had the chance to see it in action yet, although I want to look more into it.