AVv3 Progress Update

Huacayachief
Alpaca Finance
Published in
6 min readJun 28, 2023

--

Dear alpacas,

In this article, we will share the development progress of AVv3. For more background information on AVv3, you can also refer to our previous article.

⚙️Development Progress

  • We’ve successfully deployed the relevant AVv3 smart contracts on BNB Chain’s Mainnet. The code has been reviewed internally and we’re now currently testing all the different key functions for AVv3 management (deposit, withdraw, add LP, remove LP, borrow, repay, reinvest fees, etc.) in a live environment.
  • Concurrently, we have explored numerous vault management strategies, and ran many variations of backtests to find the most promising ones. Preliminary runs of some strategies showed promising results (e.g., figure below.) Once all the functions are tested to satisfaction, we will start running real vault management strategies to compare the actual performance vs. backtest results, and try to uncover any potential points of improvement in operations. We will continue to iterate and optimize the strategies as we approach actual launch.
Example backtest run. The yellow line represents the simulated vault’s PnL, and the shaded blue area is the liquidity price range
  • We have started setting up the infrastructure to run the vault management operations, which is improved from our AVv2 ops.
  • We have finalized the UI/UX for the AVv3 product pages. It builds off the previous AVv2 UI, while adding more info about the vaults such as the current and historical LP range. The investment and withdrawal process will continue to be simple and straightforward, as users have become familiar with in AVv2.

🎨Design Considerations

We know the herd loves details. So in this section, we will share some key design decisions and insights we’ ve gained from developing AVv3 to fit with the framework of concentrated liquidity (CL) DEX.

Modular Design

We have designed AVv3 to be much more modular; each transaction is now separated into its own function. In AVv2, when an investor makes a deposit into the vault, there are actually many actions that get bundled and executed together in the background, such as:

  1. The vault’s share token gets minted
  2. The vault borrows the necessary amount
  3. The assets are deployed into the DEX’s liquidity pool

Similarly, reinvest and withdraw functions also bundle several actions within them. However, this framework does not work well for AVv3 given that CL DEXs require a more complicated LP strategy.

For example, depending on where the price sits in the LP range, the composition of assets held in the LP could be very off-balance (vs. 50/50 on UNIv2 LP.) This means the ratio of assets required to be added into LP could look very different at different times and could necessitate a swap in certain situations. This dynamic is not ideal and would impact the performance of the pool and the transaction cost to users (swap cost, etc.)

After much brainstorming and discussions, we found a better approach would be to separate all actions into their own functions. With this approach, we will have the flexibility to only execute the necessary actions when required. For example, assets will no longer need to be deployed into an LP position at the same moment they are deposited. They can now be deployed in batches at a more appropriate time based on the vault’s logic.

The Role of Vault’s Manager vs. Smart Contract

Note: The term Vault’s Manager here refers to a set of off-chain logic and code that operates the vault. It does not refer to a human manager that makes discretionary decisions.

As alluded to in the section above, the Manager would have much more authority in managing the vault. The role of the smart contracts would be to act more as a container to facilitate the execution of strategies, and check that the managers’ actions fall within the acceptable risk parameters and guardrails. For example, Managers can decide to borrow more assets at any time as long as the vault leverage would not exceed the threshold (e.g., 10x). Another example would be checking that a transaction such as a swap or rebalance would not result in a vault’s equity loss above the allowed threshold (e.g., 0.5%).

This new framework will also mean that in the future, AVv3 could become a platform that supports vetted 3rd party managers (e.g., professional marketing making firms). These managers would only need to focus on running profitable strategies for their funds while Alpaca Finance would provide all the infrastructure and liquidity to run their strategies. Moreover, the codebase can be reused to support deployment strategies beyond UNIv3. So in the future, if there are next-gen DEXs or other non-DEX platforms that can generate yields, we will be able to integrate our AV with them without having to create everything again from scratch. This design direction allows for a much higher potential growth and composability of the product.

Variable Leverage

In AVv2, we can set a fixed target leverage for a vault — i.e., 3x and 8x. However, in AVv3, this might no longer be the best approach given the nature of concentrated liquidity DEX. This is best explained by an example.

Imagine a scenario where the asset price has moved towards the edge of the price range, but the signal/logic expects the price to revert back into the range. Instead of rebalancing the position/resetting the LP range, which would incur higher cost, the Manager could “extend the range” by borrowing more of the required asset. This method could be a more efficient management strategy, but would increase the overall leverage of the vault.

Illustrative Example: The LP range is extended on the upper side by borrowing additional BNB, effectively increasing the vault’s leverage by 1x

The example above is just one potential scenario. But there are also more situations where it’s more effective to allow for flexible leverage and not retarget the vault’s leverage based on a simple rule (as we did in AVv2).

Given that providing liquidity on a CL DEX is already achieving improved capital efficiency, the leverage on AVv3 can also be lower than AVv2 while still achieving the same level of yields.

Repurchasing

With AVv2, we have devised a way to create a fixed-price swap with a discount through the repurchasing method. However, with the AVv3, we will perform necessary swap directly on the DEX. This change is due to several factors:

  • With concentrated liquidity, the swap becomes more efficient and has much less price impact, so the benefit of repurchasing is lower.
  • Some major pools such as BNB-USDT use a 0.01% fee tier, which is even lower than CEXs. (Binance has stopped support for the 0% trade fee on BUSD pairs.)
  • Transparency and safety from an operational perspective prefers keeping everything on-chain, especially with recent developments on the regulatory front.

💡Closing Thoughts

The development is on-track to be completed in mid to late July. In the next update, we will share more details on our management strategies, backtest results, and the launch plan. We thank all you alpacas for your continued support and patience as we work on this major initiative. We believe that AVv3 will have a strong product-market fit, and serve as a massive future growth vector for Alpaca Finance. We’ re excited and hope you are too, so stay tuned for future updates!

--

--