Five minutes to understand Charm Alpha Vault: Uniswap V3 LP minimalist operation strategy

0
16

 1,565 total views

Alpha Vault has achieved twice the profit of Uniswap V2 LP in actual operation, to understand its working mechanism from a technical point of view.

Recommended reading: ” Selected Links | Understanding Uniswap V3: AMM Liquidity A New Era

Written by: Tian Shaogu Shao

As I mentioned in a previous article ” Uniswap v3 Features Explained in Depth “, the operation strategy of liquidity providers (LP) and LP NFT aggregation are becoming the blue ocean for emerging startups in the field of decentralized finance (DeFi).

Explore the holy grail of v3 LP investment strategy. Source: uniswap.org & charm.fi

Today, we will study the first Uniswap v3 LP strategy to be launched (the first one as far as I know):

Charm.fi is an anonymous team that has created two DeFi products: Cube Tokens and Options .

Two days after Uniswap v3 was released on May 5th, Charm deployed its third product: Uniswap v3 LP operation strategy- Alpha Vault , and it has proven to be a very successful product: the profit is more than twice the LP of v2 !

It is no wonder that many people have entered the game, and their first ETH/USDC machine gun pool capital is all in place, even if there is an obvious warning message on its website: the code of the project has not been audited.

Now let’s dive into Alpha Vault’s strategy and its code base!

Passive rebalancing

The understanding and explanation of this article comes from the official announcement article , its Github code base and my chat with Charm developer mxwtnb .

Since their article has explained the product well, I will only repeat it when necessary.

The price of token pairs in the machine gun pool is constantly changing, which means that the current price will not always be in the middle of the LP’s liquidity range. Therefore, a well-designed rebalancing mechanism is the core of any strategy.

Alpha Vault’s method is very simple and effective: when two assets become unbalanced and cannot be put into the machine gun pool, Vault first puts the maximum available amount of the two assets into the machine gun pool, and then uses one asset with a balance Place another range order.

Let us take an example. (If you are not clear about the following explanation of price changes and asset exchange rules, please check this article first to understand the basic mechanism of Uniswap v3.)

Initially, 50% of our assets are ETH, and the other 50% are USDC. One day later, as the price of ETH fell, we got more ETH and USDC decreased.

  • ETH price = 3000 USD: (50% ETH, 50% USDC)
  • ETH price = 2500 USD: (70% ETH, 30% USDC) -> All assets are withdrawn

Now, suppose we can enter the two maximum amounts of the machine gun pool within the current price range as 30% ETH and 30% USDC.

Vault’s job is to first withdraw all liquidity, and then drop 30% ETH,
A basic order consisting of 30% USDC and a limit/rebalancing order consisting of 40% ETH, 0 USDC.

  • Basic order: (30% ETH, 30% USDC) -> place an order according to the current price range
  • Price limit/rebalance order: (40% ETH, 0 USDC) -> The price range of the order ≥ the current price, for example: (2500, 2600), so that when the price increases, ETH can be converted into USDC.

Allow me to shamelessly borrow a picture from their article:

Five minutes to understand Charm Alpha Vault: Uniswap V3 LP minimalist operation strategy If ETH has a balance, invest in ETH at an interval value higher than the current price. Source: https://medium.com/charmfinance/introducing-alpha-vaults-an-lp-strategy-for-uniswap-v3-ebf500b67796

Similarly, if we have USDC balance, put the balance of USDC into the range of price ≤ current price, so that when the price drops, USDC can be exchanged for ETH.

The function of price limit/rebalancing orders is to avoid direct swapping (converting 20% ​​ETH to 20% USDC). Doing so will result in a transaction fee of 0.1~1% being charged. Instead, swapping occurs naturally by providing liquidity. In this way, it does not cost a penny for handling fees, and even transaction fees can be earned.

This is the reason for the “passive” rebalancing mechanism.

But in the above example of ETH with a balance, there is an assumption: the limit order will only be honored when the price of ETH rises-this is obviously the opposite of the reason for the imbalance of our assets: the latter is because the price of ETH has fallen from $3,000 to 2500 dollars.

However, this assumption is very realistic, because there will always be a consolidation in the market.

Let’s take a look at the real market price of ETH: there were several green bars/pull up for a period of time, but they always followed the red bars/consolidation.

Five minutes to understand Charm Alpha Vault: Uniswap V3 LP minimalist operation strategy There are price corrections at any time. Source: tradingview.com

Well, what if the price keeps falling?

Conditional rebalancing

If prices continue to fall, then Vault may not do anything, which means: failure to achieve rebalancing.

If the LP of Uniswap v3 adopts the wrong LP operation strategy, it may suffer greater impermanence loss compared with v2.

Therefore, in some cases it is better not to take any measures, which is very reasonable.

In AlphaStrategy.sol, rebalance() has two condition checks (require()) to determine whether it is necessary to rebalance.

Five minutes to understand Charm Alpha Vault: Uniswap V3 LP minimalist operation strategy Source: https://github.com/charmfinance/alpha-vaults-contracts/blob/main/contracts/AlphaStrategy.sol

  • Extreme price movements that should never happen
  • The price fluctuates too much -> Avoid market price manipulation before rebalancing or rebalancing during extreme market conditions

In addition to these two conditions, there is another condition (at the time I started writing this article):

价格变动不大-> 避免重复花费Gas

According to the developer, the reason why this condition is not included in the current smart contract design is that the condition has now been moved off-chain.

The choice between on-chain or off-chain depends on whether the condition should always be strictly observed: if it is, it is on-chain; if “no”, considering that the strategy is still in its early stages, keep it off-chain Can provide better development flexibility.

Gas cost is low

According to the above-mentioned developers, this feature was developed only recently, so it is not consistent with the ETH/USDC Vault already deployed on the mainnet.

Investors who have tried to put liquidity into the v3 machine gun pool must already know that the cost of this process is not cheap.

Five minutes to understand Charm Alpha Vault: Uniswap V3 LP minimalist operation strategy The cost of random trading gas that invests liquidity into the Uniswap v3 fund pool is 431,134. Source: https://etherscan.io/tx/0x06a01a31692fd74057caccebdf7c0449d2fbf0bcec4c67108dbaac1ef76ff642

What is the gas cost of depositing into Alpha Vault? Because of the logic of Vault, will it be more expensive than adding liquidity to v3?

The answer is: it is much cheaper than adding liquidity to the v3 pool of funds!

Five minutes to understand Charm Alpha Vault: Uniswap V3 LP minimalist operation strategy The random gas cost of investing liquidity in Alpha Vault is 180,573. Please note that this transaction is in Ropsten and provided by the developer. Source: https://rinkeby.etherscan.io/tx/0x73a20b35c1598e2e891d85ab19e431251558165d13dfa166ac773505072d8fb4

why? The reason is that depositing USD in Alpha Vault will not lead to increased liquidity on v3.

Changes in liquidity will only happen when rebalancing, which means that individual users do not need to pay high gas fees to increase and remove liquidity. Currently, the team’s own Keeper has recently performed rebalancing responsibilities at a frequency of twice a day.

Gas is low cost and sounds great! But does this also mean that the funds deposited by users in the fund pool will not be used until the next rebalance? Yes it is. But increasing liquidity is not like buying a 10x leveraged perpetual contract; it is usually a long-term or at least medium-term investment.

If users plan to provide them with liquidity for months, losing a few hours of capital efficiency is not a big deal. In addition, the cost of Gas is lower!

Tip: If you want to deposit funds to Alpha Vault, please check Vault’s smart contract to see if the rebalancing has just happened. If it is, then you don’t have to rush, you can wait for a lower gas price!

Therefore, combined with the description in Chapter 2: Conditional Rebalancing, under extreme market conditions, is it possible that the funds deposited by users will be idle for several days?

The answer is still “yes”, but this is precisely the reason for setting conditions on whether Vault should be rebalanced: in order to protect users.

Minimalism

  • Liquidity can only be used when rebalancing
  • Rebalance only when needed
  • Realize token swap by providing liquidity instead of directly swapping

Before their Github code base was opened, I could hardly imagine that the v3 LP strategy only required about 700 lines of code.

Obviously the team is making every effort to minimize the complexity of this strategy, which is why I call Alpha Vault a “minimalist LP strategy”!

More strategies will definitely be introduced, and it is expected that many strategies will also use Alpha Vault’s technology, such as passive rebalancing techniques to avoid transaction fees.

Let’s wait and see if there is another project that can achieve the same level of performance and simplicity as Alpha Vault!

Apes 🙈, be careful

With the above understanding of the project, it sounds like it’s time to follow suit (these free-rider investors are also known as “apes”)… but please wait.

Since the code of this project has not yet been audited (in progress ), two emergency buttons are prepared for special situations (for example, a serious error is found).

Five minutes to understand Charm Alpha Vault: Uniswap V3 LP minimalist operation strategy Source: https://github.com/charmfinance/alpha-vaults-contracts/blob/main/contracts/AlphaVault.sol

In AlphaVault.sol, since the contract has not been finalized, the governance/project owner has the right to use emergencyBurn() and emergencyWithdraw() instructions, which means that they can withdraw liquid funds from the fund pool and then transfer them to the governing party.

Therefore, if the team is one day ready to finalize the smart contract (finalized value is set to true), it may be that after the code audit is passed, people no longer need to worry about this issue.

It is common practice to reserve privileges for emergencies in the early stages of the project, but please keep these risks in mind and think twice before investing your life savings, especially Charm is an anonymous team.

I mentioned this not to prevent people from using this product, but just to remind people that putting funds into smart contracts is always risky. After all, no matter how many audit reports support the product, smart contracts may still be hacked.

Personally, I have read their code, love the simplicity of their strategy, and will definitely try it after the contract is finalized! But I still have to repeat the sentence: Never invest more than the amount of loss you are willing to bear.

to sum up

This is almost all the features of Charm’s Alpha Vault. I didn’t expect such a simple strategy, right?

If you are eager to use Alpha Vault, they will launch another ETH/USDT machine gun pool on May 24th.

The last thing I want to say is: All Charm products are built by a developer. The vitality is super strong and powerful! I am a big fan now 😆

Disclaimer: The content of this article does not constitute any investment advice.

Disclaimer:

Blockcast.cc does not endorse any content or product on this page. While we aim at providing you all important information that we could obtain, readers should do their own research before taking any actions related to the company and carry full responsibility for their decisions, nor can this article be considered as investment advice or recommendations. Every investment and trading move involves risk, you should conduct your own research when making a decision.