Product Update: Next-Gen Leveraged Yield Farming

Huacayachief
Alpaca Finance
Published in
8 min readMay 4, 2023

Dear alpacas,

As decentralized exchanges (DEXs) upgrade their automated market making logic to incorporate concentrated liquidity (CL) and shift their incentives rewards towards this new model, yield-generating protocols that build on top of DEXs, such as Alpaca Finance, will also need to evolve to continue offering high-yield products to their users.

In this article, we’ll share with the herd our thought process, various options we considered, the path we are currently pursuing, as well as the progress and expected timeline for the new leveraged yield farming (LYF) product that will integrate with CL DEXs.

Background:

First, let’s briefly go over some basics to establish a working knowledge of how the CL DEX model works.

In a nutshell, the CL model allows for liquidity to be allocated within a custom price range, as selected by the user. In the previous version of the XYK DEX, liquidity was distributed uniformly along all possible price ranges (zero to infinity). By concentrating their capital to smaller price intervals, liquidity providers (LPs) stand to earn more fees when the selected range sees higher trading volume. At the same time, traders also see deeper liquidity around the current price, resulting in a lower price impact cost.

However, there is no free lunch. These advantages come at the cost of more complex position management and higher impermanent loss (IL) for LPs. We will discuss these issues in more detail in the context of different ways of integrating with CL DEXs in the sections below.

🌌The different ways to integrate with CL DEXs

In this section, we will walk you through the different approaches we could take when integrating with a CL DEX and our analysis on each method, culminating in the ultimate approach we decided to pursue.

1️⃣Option1: Customizable, individual LYF position

One approach would be to integrate with a CL DEX in such a way that allows users to customize and open their own individual LYF positions. Users would have the freedom to select the price range, leverage, the pool to farm, and borrowed asset(s). While this setup might appear similar to the current “Farm” function in AF1.0, there are key fundamental differences and challenges:

Challenge#1: Active position management

Providing liquidity in the UniswapV2 DEX is a passive “set it and forget it” endeavor. Your assets are always active and earning yields. True, when doing an LYF, one would need to monitor price movements to safeguard a position from liquidation, but if the selected leverage level was conservative, i.e. ~2x, the chance of liquidation would be greatly reduced and the monitoring required would be limited to only when a large price movement occurred.

With a CL DEX, LPs will be required to frequently reset / adjust the range when the price moves outside the originally selected one to continue earning yields. Moreover, to earn the advertised APR% in some pairs, the price range would have to be very narrow, which then necessitates active management and frequent range adjustments.

We believe that the complexity and the level of attention required will make this product unpopular for retail users, and difficult to keep profitable given that range adjustment on positions in LYF carry swap costs.

Challenge#2: Gas Cost

CL DEX LP position’s ownership is represented as an NFT instead of a fungible token — i.e., ERC20. This means individual positions can’t be combined together into a single vault to take advantage of a more gas efficient position management. Specifically, each position’s yields from liquidity mining and trading fees must be reinvested individually and separately. Regardless of whether the transactions would be activated by a user or the protocol, it’s clear that the tx cost would greatly increase for this setup which would eat into the profitability, especially for smaller positions. (For reference, AF1.0 has thousands of active positions.)

Finally, we have observed this integration in production for over a year in another protocol with limited adoption, which further suggests that this product may not have the market fit. Given all the reasons mentioned above, we do not believe this is the optimal direction.

2️⃣Option2: Simple Position Manager

Another approach would be to create a simple position manager that aggregates users’ positions into vaults, which will reduce the management burden required by users. The Manager would perform basic functions such as re-adjusting the price range to ensure the LP is always active, reinvesting liquidity mining rewards and trading fees, among other tasks.

The hallmark of this approach is a relatively simple and deterministic set of rules to manage the vaults. At the same time, the managers will not necessarily show backtest results, actual historical performance, or promise profitability of the strategy.

Challenge#1: Impermanent Loss

Many of our readers are familiar with the concept of impermanent loss (IL), as we have discussed it in detail on many occasions. If you are new to this topic, please refer to our Docs here. With a CL DEX, impermanent loss is greatly magnified through the tighter liquidity range. If the position is not properly managed, any gains from fees and liquidity mining rewards will be offset by IL.

We see many protocols working on this solution and there are several live products that have been around for some time. However, based on our research, we have yet to see one that we can convincingly believe will generate positive returns for users in the long run.

For one, while many of these protocols show various stats such as instantaneous APY, fees earned, historical TVL, etc. The one key info glaringly missing is the historical vault’s share price or actual vault’s return. We have not seen any protocol in this sector transparently published the historical return for their position manager like we have done with our Automated Vaults.

Alpaca Finance transparently publishes historical returns for all its AVs

Moreover, we have seen from our own experience operating AV-v1 just how difficult beating IL is. With our relatively simple rebalancing rule, it worked in a high-yield environment, but it quickly became unprofitable in a low-yield, high-volatility market. We don’t have any reason to believe that this approach would generate a positive return in a CL DEX, where IL is magnified.

Given Option#2’s simpler logic for vault management, it would require less research and development effort, allowing us to get to market faster. However, we believe it won’t generate a positive return for users in the long-term, so the product would not be sustainable.

3️⃣Option3: AV-v3

What we believe is required to create a winning and sustainable product is an AV-v3. The third iteration of our Automated Vault would build on the experience and proven success of AV-v2. However, given the differences between CL DEX and the UNIv2 DEX, we must rethink some of the design aspects from the ground up. We believe, though, that this is a good thing as we now have much more design freedom to allow AV to be more sophisticated and versatile, ultimately resulting in higher yields for users.

Some of the key questions our R&D team is working on answering are:

  • What is the optimal price range to LP under different market conditions?
  • What benefits can be gained from having multiple LP positions (different ranges) in one AV?
  • What is the optimal leverage level given the increased capital efficiency through CL?
  • How can we execute repurchasing more efficiently under the CL model?
  • What is the best way to deposit and withdraw from the vault with minimal cost to users and impact on the current vault’s exposure?
  • How to automate this product so users don’t have to do any management?

In the next section, we will discuss the current progress and timeline for AV-v3.

📆Progress and Timeline

Now that AF2.0 MM is live, getting AV-v3 to production has become our highest priority on the product side. We can think of the development of AV-v3 as having two major pieces: 1.) the smart contract to manage the positions and 2.) the logic to manage the positions profitably.

To add context, here are some of the items we are building to manage the AV positions.

  • LP share price calculation: this is crucial to ensure that users receive fair value when entering or exiting the vaults.
  • Composing/exiting LP position
  • Reinvesting trading fees and liquidity mining rewards
  • Staking/unstaking LP tokens for liquidity mining rewards
  • Logic /algorithm to allow users to zapping in and out of AVs conveniently
  • Setting/adjusting LP range
  • Repurchasing/rebalancing
  • Borrowing and debt repayment integration with AF2.0 MM

Concurrently, we are also running back tests and simulations on various logics to find the most effective way to operate AVs under the CL DEX.

To accelerate the development process, we have hired additional researchers / developers to work on these tasks. As demonstrated by AV-v2, the most important thing is to get the strategy right and sustainably profitable. Once we have that, the adoption and TVL can come very quickly given Alpaca Finance’s track record of safety and professionalism.

AV-v2’s TVL increased by 4x to $100Mn in under 2 months

To the best of our current estimate, the AVv3 should be ready in early Q3 2023 around July. We will share more details on the development and launch plan closer to the launch date.

We believe that our experience and track record in operating Automated Vaults for over 12 months makes us second to none in the industry when it comes to the knowledge, capabilities, and expertise in developing a profitable Automated Vault. We also hope that the past 2+ years have demonstrated to our community our team’s work ethic and dedication to building and delivering great products.

We strongly believe in the potential upside of this product. AV-v3 will have a larger competitive advantage in the era of CL Dexs because it may be one of the few profitable passive yield farming strategy in the market. Existing yield aggregators and simple strategy vaults will also need to evolve or they will no longer be profitable. Becoming a market leader in this category will open up many future growth opportunities for Alpaca Finance, including cross-chain expansion to offer this product on other chains with a strong CL DEX presence.

Thank you for taking the time to read this article and for your support. Please follow us on our social media channels below to stay updated on future developments.

Website | Twitter | Telegram | Discord | Youtube | Docs | Reddit | Medium

--

--