DEV Community

Ryan Lee
Ryan Lee

Posted on • Edited on • Originally published at rlee.dev

Leveraged Yield Farming on Alpha Homora Explained

Introduction

For the past couple of months, I've been getting my head deep inside of Alpha Homora V1, a platform for leveraged yield farming on Ethereum. Alpha Homora is a game changer for the Decentralized Finance (DeFi) ecosystem because you can leverage an undercollaterized position to earn high yields in a liquidity pool.

In this post, I'll provide a brief overview of yield farming, and then I'll go into the mechanics of how Alpha Homora works, what the quirks are, and how you can use Alpha Homora to maximize your position.

Be warned none of this should be considered financial advice. Do this at your own risk!

What are Liquidity Pools?

Before we get into Alpha Homora, lets get into the basics about yield farming, and more specifically, liquidity pools.

Liquidity pools are smart contracts that allow people to swap one token for another with a small fee attached. Liquidity pools are core components of DeFi because they are permissionless and do not require a centralized exchange to operate.

For liquidity pools to operate, they need well... liquidity! For example, if you want to swap Bitcoin (BTC) for Ethereum (ETH), the pool must have enough Ethereum to give you for that Bitcoin.

Hence, when we talk liquidity pools, we must also talk about the liquidity providers (LPs).

Who are Liquidity Providers?

LPs are those who supply tokens to a liquidity pool. For example, a LP provides liquidity to a ETH-WBTC pool by depositing an equal amount (based on market price) of Ethereum and Wrapped Bitcoin into the pool. In return, liquidity providers are given LP tokens that represents their ownership of the pool.

The benefits of being an LP are the fees that you earn for every swap. In a protocol like Uniswap, the pool takes a 0.30% cut; if you owned 1% of the tokens in the pool, then you would receive 1% of the 0.30% cut, i.e. 0.003%.

In addition, LPs benefit from farming pools that are incentivized by DeFi governance tokens issued by DeFi protocols and platforms. For example, if you farm an incentized pool on Sushiswap, you earn a fixed amount of SUSHI per day (based on your position), regardless of the number of swaps that occur.

A common strategy for liquidity providers is once they have accumulated a certain amount of a governance token, is to dump it on the market and trade it for more tokens to increase their position. However there is a tradeoff; the cost of gas for multiple transactions to makes it expensive to reinvest:

  • One Txn to claim the governance token
  • Two Txns to swap the governance token for the tokens in your pool
  • One Txn to swap the tokens for an LP token
  • One Txn to stake the LP token into the pool

In today's high gas fee world, compounding your position on platforms like Sushiswap or Uniswap are only worth it if you're position is so large that the amount of yield you earn makes the gas insignificant. High gas costs is whats causing people to other L1 chains like Binance Smart Chain (BSC) or L2 Decentralized Exchanges (DEXs) like Loopring due to their low fees.

The Risks of Yield Farming

If yield farming was free money, then everybody would be doing it right? Obviously there must be risks; one such being the smart contract being hacked but the other being what is known as impermanent loss or divergence loss.

Divergence loss is the loss you incur relative to if you had simply held your tokens. It occurs when an arbitrager takes advantage of the change in the price ratio of the assets in the pool. The more the price ratio diverges from the ratio at which you put your assets in, the worse your loss will be; this loss increases exponentially rather than linearly. Divergence loss is also referred to as impermanent loss because the loss can be reserved if the original price ratio is restored.

inpermenant-loss-graph

This post isn't about divergence loss, so if you want a deeper understanding of divergence loss, check out the Binance Academy article on it.

Yield Farming on Alpha Homora

Now that you understand the basics of yield farming, lets talk about yield farming on Alpha Homora!

The problem Alpha Homora solves is the lack of leveraged yield farming opportunities in today's DeFi market. If you wanted to take a leveraged position on ETH/WBTC on Sushiswap, you would first need to deposit some collateral in another platform like Aave, Compound, or the Iron Bank (CREAM Finance) and then borrow the token(s) you want to farm with. Then make another set of transactions to farm it. Alpha Homora makes it easy for you by bundling this all of this into a single transaction while also more efficient gas-wise.

Another benefit Alpha Homora provides is single-sided liquidity. Previously, I mentioned that if you wanted to farm an ETH/WBTC pool, you would need to hold 50% ETH and 50% WBTC to deposit. Alpha Homora gives the option to enter and exit a position with only ETH; the swap for WBTC happens inside of the contract.

But the best part about Alpha Homora V1 (not V2 since they removed it), is the gas-free compounding of the governance token you receive from farming. The way it works is you need to get one person (or bot) to reinvest on behalf of everyone else in the pool. That person will need to pay the gas fee but they will get a greater cut of the reinvestment as an incentive to do it. Usually, the pool will need to accumulate a large amount of the governance token before it beocmes profitable for somebody to reinvest; however the reality is there are a lot of stupid bots out there that do it at a loss. So in other words, its free money for you; QED.

Choosing a Leverage Ratio

Alpha Homora offers different leverage ratios for different pools. For example, you can take at most 1.75x leverage on an ETH/DPI pool and 2.5x leverage on a WBTC/ETH pool. Each pool also has a maximum debt ratio; if your position reaches this debt ratio, you will be liquidated. Likewise for ETH/DPI, the maximum debt ratio is 60% and for WBTC/ETH, the maximum debt ratio is 80%.

If you want to compute your initial debt ratio based on your leverage, its easy. The formula is (LEVERAGE-1.0)/LEVERAGE. So for example, if I take 1.75x leverage, my debt ratio will be 0.75/1.75 = ~0.4286. Similarity, if I take 2.5x leverage, that means my debt ratio will be 1.5/2.5 = 0.6.

The most important thing to understand when choosing a debt ratio is that your debt is dominated in ETH. This means you are shorting ETH relative to the other token in the pool. But the impact ETH going up relative to the other token in the pool on your debt ratio changes depending on your current leverage; this is due to the mechanics of liquidity pools.

The Mechanics and Dangers of Leveraged Yield Farming

To understand the mechanics of leverage yield farming, I will outline a basic example.

Lets assume you opened an ETH/DPI position at 1.75x leverage with 10 ETH and we will also assume there were no gas or slippage costs to keep the numbers nice. Lets also assume the price ratio between ETH:DPI is 1:4.

Your debt will be 7.5 ETH since you took 1.75x leverage. You will have 8.75 ETH (17.5/2) and you will have 35 DPI (8.75*4). Which means your real ETH is actually 1.25.

So although the pool is a 50/50 pool, your ETH/DPI exposure is actually 12.5/87.5, which looks more like a Balancer pool.

Lets assume the price of ETH goes up 10% relative to DPI. Naively, you would think this would bring our debt ratio up to 47% from the initial 42%, based on this computation: (0.75*1.10)/1.75. But you also need to consider what happens to your assets when there is a price fluctuation (i.e impermanent loss); when the price of ETH goes up relative to DPI, your position in the pool will sell ETH and buy DPI to restore the 50/50 ratio. This means you debt ratio will rise even higher because you:

  • Own less ETH (you receive less benefit from ETH going up)
  • Have more DPI (which devalued against ETH)
  • Have a debt stayed the same (the value of your debt increased)

If the price of ETH were to continue going up, you can reach the point where you have net negative ETH (which is what you start with when you take on 2.5x leverage on the ETH/WBTC pool). Having negative ETH isn't necessarily a bad thing but you need to be careful because even though your position compounds based on trading fees and dumping governance tokens, your debt will also compound based on the borrow interest rate. Luckily, Alpha Homora gives you the ability to refill ETH in order lower your debt ratio when it gets too high.

Maximizing Exposure

Alpha Homora V1 is the perfect yield farming platform if you want to expose yourself heavily to one type of asset. This is not financial advice, but lets say you want to follow this guy's advice (I don't know this guy, nor do I follow him), and divide your portfolio into 50% ETH, 20% BTC, 30% DPI.

A normal yield farm allocation for this portfolio would be 20/20 ETH/WBTC and 30/30 ETH/DPI. If ETH/BTC and ETH/DPI performs relatively the same, you suffer minimal impermanent loss and make excellent gains! But we don't know what will happen so you can look at some alternative strategies.

For example, you can put 20% of your portfolio into a ETH/WBTC position and 30% into a ETH/DPI position, both at maximum leverage. You get basically get full exposure to both assets while earning high yields at the same time. The rest of your portfolio is just ETH which you can deposit as Interest Bearing ETH (IbETH) on Alpha Homora and savour it if you ever need to refill.

This strategy is pretty noob friendly and you can also rebalance your positions every month if you so please. Whether it will outperform the former strategy or is even a good strategy at all, is beyond me.

Conclusion

Leveraged Yield Farming on Alpha Homora is a great product for maximizing your exposure to one asset. It comes with many risks especially because you are shorting ETH, but as long as you don't get liquidated, you should receive some handsome returns.

But please remember this is not financial advice. I'm just a software engineer exploring cool tech. I actually have no idea what I'm doing. Listen to me at your own peril.

Also if you're looking for a software engineer to join your crypto startup, DMs on Twitter and my email are open!


Happy Yield Farming!

Top comments (0)