1,351 total views
The leading AMM project seems to be moving towards an evolutionary model of “Great Unity and Unity” that gathers liquidity.
Original title: “Reverse Deconstruction Curve V2”
Written by: Bytom Chain Research Institute
I thought that Uniswap V3 had opened the pinnacle of AMM universal exchange, but I didn’t expect Curve V2 to be a more difficult “Mount Kailash”. While we were pleasantly surprised by the technological changes, we were even more surprised to find that these head DEX/AMM projects are moving towards an evolutionary model of “university and unity”. Just like the Curve V2 we are going to talk about today, it is actually a direct Competing with Uniswap’s universal exchange model, and shortly before this, Uniswap V3 also officially brought a new mathematical model to interfere and cannibalize the stable currency trading field that Curve V1 has long occupied. This article attempts to present the basic mathematical principles of Curve V2 in a reverse deconstruction.
To put it simply, Curve V2 adopts a basic philosophy that is very similar to Uniswap V3-to gather liquidity around an “equilibrium point”. Both of them do not rely on external oracles to reach the “equilibrium point”, but rely on the trading game in the traditional AMM system until the system is in equilibrium. In Uniswap V3, it is called “professional market maker LP adjusts the range closely following market changes.” It is named “internal oracle internaloracle” in Curve V3. As the two top AMM projects, it can be seen that they are in awe of any external risks. Although they do not rely on external factors, these two models, especially CurveV2, present a series of difficult problems such as impermanent loss, concentrated liquidity, improved capital efficiency, low slippage, and dynamic costs on the road of universal exchange. solution. This is of course due to its “abnormal” mathematical model.
The core part of the mathematical model is that it creates a new curve. Intuitively from the above figure, the two dashed lines are constant product curves, the blue line is the famous Curve V1 stable currency exchange curve, and the yellow curve constructed by Curve V2 has two basic characteristics——
So what problems can it solve:
Inherit the advantages of Curve V1 with ultra-low slippage and concentrated liquidity in the vicinity of the “equilibrium point”;
By fitting between the constant product curve and the Curve V1 curve, and fitting to the constant product curve in the middle and tail of the curve, the constant product curve can quickly respond to changes in liquidity, avoid the exhaustion of the liquidity of the pool, and respond flexibly to the fast market Variety.
Look directly at the expression:
At first glance, it looks very obscure, here is another picture shared by KurtBarry on twitter:
It suddenly dawned on me a little bit. That’s right, the “abnormal” curve of CurveV2 is actually born out of the expression of Curve V1.
Figure 4: CurveV1 expression
When K0 approaches 1, that is, when the curve shape is approaching the “equilibrium point” range (compare with Figure 1), the entire Curve V2 expression will degenerate into the Curve V1 expression, so that the exchange curve has the excellent characteristics of Curve V1 .
The most complicated variable introduced in the formula is gamma, and its origin is from the two constant product curves in Figure 1. The upper constant product curve and the Curve V1 expression jointly create the “equilibrium point” area of the V2 curve, while the lower constant product curve is a parameterized reduction of the upper constant product curve, that is
Constant product curve above:
The constant product curve below:
Gamma is a small positive decimal, which will be more indented from the origin in the shape of the curve than the upper curve. As mentioned earlier, CurveV2 needs to introduce such a gamma curve to make the V2 curve get rid of the disadvantages of the V1 curve in the middle and the end (liquidity exhaustion and rapid response to exchange rate changes), which means that the curve has a greater curvature in the second half. Under the guidance of this basic principle, we need to reversely understand the composition of expressions-
When the coordinate changes continuously move to the far side of the abscissa and ordinate axis, the closer it is to infinity, the more the shape of the V2 curve will fit the constant product curve downward. That is, K0 approaches gamma, CurveV2 expression reduction:
Obviously, this will be 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 for the time being, and explain the reason for the formation of the Curve V2 expression in the reverse direction, that is, to approach the “equilibrium point” range and the horizontal and vertical ends with the idea of limit, the expression It will be reduced to Curve V1 and a constant product curve respectively, in order to achieve the purpose of Curve V2 to integrate Uniswap and Curve V1, so that this complex hybrid curve can support universal exchange, and has better concentrated liquidity and slippage advantages. At the same time, Uniswap retains the advantages of protecting liquidity and responding to sudden changes in market exchange rates.
In fact, Curve V2 also has a very important innovation-the internal oracle repegging mechanism. This mechanism is very beneficial for implementing better centralized liquidity and mitigating impermanent losses.
Curve V2 introduces a price_scale price measurement. For example, there are two assets: USDT and B_token in the pool. The balance is b=[1000,500], and the exchange rate is 1 B = 2USDT, so the price is p=[1,2], Finally, multiply to obtain a scaledbalance as x=[1000,1000].
Combined with Figure 1, at the equilibrium point, the elements in the scaledbalance sequence are equal (constant product characteristic)——
With the change of market exchange rate, the occurrence of exchange, and the influence of LP market making behavior, the coordinate point of the system will gradually deviate from the original “equilibrium point”. If the curve shape is not corrected, it will not only cause the aggregation of liquidity to weaken, but also bring about Come impermanence loss.
CurveV2 proposes the MarketPrice Update mechanism for this :
In a nutshell, the system will continuously capture the movement sequence of the exchange rate in the system through the classic internal oracle mechanism EMA, and then continuously update a variable called profit, Xcp, according to priceoracle after each transaction and market making behavior. .
This variable can be understood as the magnitude of each price deviation from the original equilibrium point. It can be intuitively understood as if the exchange rate change is not large, the system formula will still be based on the original equilibrium point. If the exchange rate changes very large, the coordinate point is If the deviation on the curve is large, the system should rebuild the formula and replace the basis of a new “equilibrium point” in order to reduce the impermanence loss and re-aggregate liquidity. The variable Xcp is used to quantify the appropriate means of changing formulas and equilibrium points.
As mentioned above, when Xcp breaks through the threshold, the system will update price_scale according to the updated oracleprice at this time to locate a new equilibrium point position for the new formula, and then update the new value of D to obtain a new expression.
In this way, the originally fixed Curve V1 curve will continuously change its equilibrium point along with the large deviation of the exchange rate on the market, so that it will always have the maximum liquidity near the current exchange rate, timely fight against arbitrageurs, and reduce impermanent losses. There is a very detailed parameterized definition of this mechanism in the paper, which is also the complexity of the implementation.
to sum up
Michael Egorov, as always, is reluctant to say more, so we look at Curve V2 very obscure. This article introduces the two leading innovation mechanisms of V2: the new curve and repegging. This new curve is not only static and complex, but also has dynamic properties. It can be offset according to the EMA and Xcp intelligent response system, so that the liquidity of the pool can be maximized within the current exchange rate range, which greatly improves the efficiency of dynamic capital. Beyond Uni V3. We will eventually find that CurveV2 can be combined with Uni V3.
Disclaimer: As a blockchain information platform, the articles published on this site only represent the author’s personal views, and have nothing to do with the position of ChainNews. The information, opinions, etc. in the article are for reference only, and are not intended as or regarded as actual investment advice.
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.