While we were surprised by the technical change, we were surprised to find that these head DEX/AMM projects are moving towards a “one size fits all” model of evolution, like Curve V2, which is actually a direct competition to Uniswap’s universal exchange model. Shortly before this, UniV3 also formally interfered and encroached on the stable coin trading field long dominated by Curve V1 with a new mathematical model. In this article, we try to present the basic mathematical principles of Curve V2 in a reverse deconstruction way.

The basic model

In short, CurveV2 adopts a basic philosophy very similar to UniswapV3 – aggregating liquidity around an “equilibrium point”. Both of them do not rely on external predictors to reach the “equilibrium point”, but rely on the trading game within the traditional AMM system until the system equilibrium, which is called “professional market maker LP adjusts to the market changes in range” in Uni V3 and “professional market maker LP adjusts to the market changes in range” in Curve V3. In Curve V3 it is named “internal prophecy machine internaloracle”. As two of the top AMM programs, they are very respectful of any external risk. Although not dependent on external factors, both models, especially CurveV2, offer very superior solutions to a range of challenges on the road to universal exchange, such as infrequent losses, concentrated liquidity, improved capital efficiency, low slippage, dynamic fees, etc. This is of course due to its “perverse” mathematical model.

(Figure 1)

The most central part of the mathematical model is its creation of a completely new form of curve. From the visualization of the above figure, the two dashed lines are the constant product curve, the blue line is the famous Curve V1 stable coin exchange curve, and the yellow curve constructed by Curve V2 has two basic characteristics –

(1) It is in between the constant product curve and the Curve V1 curve.

(2) The tail feature of the curve has a clear constant product curve fit.

So it can solve the problem of what.

(a) It inherits the advantages of Curve V1 in terms of ultra-low slippage and aggregated mobility in the region near the “equilibrium point”.

(b) By fitting between the constant product curve and the Curve V1 curve, as well as in the middle and tail of the curve, it gains the advantage of a constant product curve that responds quickly to changes in liquidity, avoiding pool liquidity depletion and responding flexibly to rapid market changes.

Looking directly at the expression.

(Figure 2)

At first glance it looks very obscure, so here is another quote from a diagram shared by KurtBarry on twitter.

(Figure 3)

It’s a little bit clearer. Yes, the “sick” curve of CurveV2 is actually derived from the Curve V1 expression.

(Figure 4: CurveV1 expression)

When K0 tends to 1, that is, when the curve form approaches the “equilibrium point” range (compared with Figure 1 to understand), the entire Curve V2 expression will degenerate to Curve V1 expression, so that the redemption curve has the good characteristics of Curve V1.

The most complex variable introduced in the formula is gamma, which comes from the two constant product curves in Figure 1. The upper constant product curve and the Curve V1 expression together make the “equilibrium point” region of the V2 curve, while the lower constant product curve is a parametric reduction of the upper constant product curve, namely

Upper constant product curve.

The following constant product curves.

gamma is a very small positive decimal that will be more indented into the origin in the curve shape than the curve above. As mentioned earlier, CurveV2 needs to introduce such a gamma curve to make the V2 curve free from the disadvantages of the V1 curve in the middle and tail sections (liquidity depletion and rapid response to exchange rate changes), that is, to give the curve a greater curvature in the second half. Guided by this basic principle, we need to reverse to understand the composition of the expression –

As the coordinate changes keep moving to the far side of the horizontal and vertical axes, the more they converge to infinity, the more the V2 curve shape fits to the constant product curve below. That is, K0 converges to gamma, and the CurveV2 expressionreduces.

Shift items.

It is obvious that this is a new curve that is biased towards the constant product curve below.

Here, we can only start from the basic construction principle of the hybrid curve and explain the composition of the Curve V2 expression in the reverse direction, that is, by approaching to the “equilibrium” range and to the distal end of the horizontal and vertical directions respectively, the expression will be reduced to Curve V1 and constant product curve respectively. Curve, so as to achieve the purpose of Curve V2 to integrate Uniswap and Curve V1, so that this complex hybrid curve can support universal convertibility and have the advantage of better concentrated liquidity and slippage, while retaining the liquidity protection of Uniswap and the advantage of responding to sudden changes in market exchange rates.

Internal Predictor

In fact, Curve V2 has another very important innovation – the internal prognostic machine repegging mechanism. This mechanism is very beneficial for implementing better centralized liquidity and mitigating erratic losses.

For example, if there are two assets in the pool, USDT and B_token, and the balance is b=[1000,500], and the exchange rate is 1 B = 2 USDT, then the price is p=[1,2], and the final multiplication results in a scaledbalance of x=[1000,1000].

Combined with Figure 1, the elements within the scaledbalance sequence are equal at the equilibrium point (constant product property) –

CurveV2 has proposed the MarketPrice Update mechanism [1], which is a mechanism to update the market price of the market. Update mechanism [1] –

i) Exponentially moving average (EMA) price oracle

ii)profit measurement

iii)repricing algorithm (depends on i and ii)

To summarize, the system continuously captures the sequence of exchange rate movements within the system through the classical internal prophecy machine mechanism EMA, and then continuously updates a variable called profit measurement (Xcp) based on priceoracle after each trade and market making action.

This variable can be interpreted as the magnitude of each price shift from the original equilibrium point, and can be intuitively understood as the system formula will remain based on the original equilibrium point if the exchange rate does not change much, and if the exchange rate changes so much that the coordinate points are shifted significantly on the curve, then the system should rebuild the formula and replace it with a new “equilibrium point” base The variable Xcp is used to quantify the means by which the formula and equilibrium points can be changed.

As mentioned above, when Xcp breaks the threshold, the system will update the price_scale according to the oracleprice updated at this time, so as to locate the new equilibrium point position for the new formula, and subsequently update the new D-value to obtain the new expression.

In this way, the original fixed Curve V1 curve will keep changing equilibrium points with the large deviations of the field exchange rate, so that the maximum liquidity will always be available near the current rate, in time to fight against arbitrageurs and mitigate the unpredictable losses. There is a very detailed parametric definition of this mechanism in the paper, which is where the complexity of implementation comes in.

Conclusion

Michael Egorov is, as usual, reluctant to talk much, so we look at Curve V2 in a very obscure way. This paper introduces the two innovative mechanisms that lead the way in V2: the new curve and repegging. this new curve is not only statically complex, but also has dynamic properties that can respond intelligently to the system offset according to EMA and Xcp, allowing the pool liquidity to be maximally aggregated in the current exchange rate range, greatly improving the dynamic capital efficiency, which is something that can surpass Uni V3. We will eventually find that CurveV2 can be recombined with Uni V3.

Posted by:CoinYuppie，Reprinted with attribution to:https://coinyuppie.com/reverse-deconstruction-curve-v2/

Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.