
Original author: @observerdq
Original editor: @HeiyuXiaodou
Original source: BuilderDAO
Author's note
About a year ago, I spent some time participating in Uni V3's LP and had a great time. Around that time, there was a saying that being an LP in Curve Tricrypto Pool was a relatively stable and profitable mainstream asset allocation method. This intrigued me to read the Curve V2 white paper. I started to develop a vague understanding of the differences between Uni and Curve. Uni pursues a more free market approach, while Curve has some elements of planned economy.
To delve deeper into this line of thought, it was necessary to fully understand the technical details of Curve V2. So a few months ago, I began studying Curve V2 meticulously. As the founder of Curve, Michael, who was formerly a researcher in the field of physics, effortlessly combines various mathematical formulas in the white paper. As a non-mathematical reader, I struggled to grasp the core elements that were crucial but not immediately intuitive, such as Xcp and related concepts like D and Virtual Price.
Through this research process, I also realized that even for experts, mastery is not achieved overnight. Curve V2 is a more complex and generalized version based on V1. To have a clearer grasp of the design principles, it is important to first understand Curve V1. So I'm retracing the steps of the experts from back in the day.
In V1, the main characters are A and D. A parameter may seem simple at first glance - the larger the value of A, the more liquidity is allocated around the price of 1. But when reviewing the records from that time (Discord/governance forum/Telegram), countless questions revolving around A kept arising. There were technical aspects, as well as issues related to protocol governance. The discussions were diverse and rich. This is why I decided to dedicate a section specifically to the A parameter. The following is a part of it. We first explore the impact of A as a unique parameter for a single DEX on the overall market. When a parameter carries significant influence, its management becomes an important issue. The subsequent portion discusses the technical details of regulating A.
Although focusing on the minute details of the A parameter, I have not forgotten the original intention and interest in comparing the temperaments of Uni and Curve. I still find myself pondering whether these details reveal a fundamental difference in ideology.
— dq
I. Relationship between the A parameter and the overall market price
On September 4th, 2020, Andre Cronje posted a proposal on the Curve governance forum, suggesting to adjust the A parameter of the yPool from 2000 to 1000. This sparked some discussion and received some opposing views, but a few days later, it was calmly approved through voting. It seemed like a topic of little significance compared to the extensive debates on various matters in many other DeFi projects that followed.
It is the mathematical complexity of Curve that raises the discussion threshold, masks the importance of certain issues, and even hinders the understanding of the essence of Curve. This series of articles focuses on parameter A and goes back to ancient times to examine several historical events, attempting to simplify the mathematics and reveal the truly important propositions about Curve. This article, the first in the series, starts with the AC proposal.
Can the A parameter affect market prices? AC and opposing statements
Returning to the AC proposal, in late August and early September, the yETH vault experienced rapid expansion (the operation of the yETH vault involves absorbing ETH, minting DAI, depositing into the yDAI vault, which is essentially depositing into the Curve y Pool for LP, earning CRV rewards, selling them for ETH, and thus achieving ETH-based returns).
Coincidentally, this coincided with a rapid decline in ETH prices, which increased the demand for DAI. The share of DAI in the y Pool rapidly declined, reaching as low as about 2%.
AC believes that the A parameter for the y Pool is too high (A = 2000), causing the y Pool to supply a much larger amount of DAI than it should at such a low price. Here is an example of his argument:
The opposing voices mainly revolve around two angles, one of which is related to the selling pressure brought about by continuous selling of CRV in the yETH vault, which I will not delve into here.
What interests me is another angle related to the price determination mechanism.
For example, @iamaloop's view: "There is no such thing as Cheap DAI, arbitrageurs will equalize prices everywhere. The A parameter only affects the imbalance of the coin percentages in the Curve y Pool once the price is in line with the market price."
There is a similar sentiment from @sjlee. @angelangel0v also suggests that arbitrageurs cannot obtain lower prices just because of a high A parameter.
In summary, the views of these three individuals are: The price of DAI is determined by market supply and demand, and the A parameter can only determine the depth of the Curve y Pool at different DAI price points and cannot determine market prices.
The confrontation between the two viewpoints actually raises a question: What is the relationship between the A parameter and market supply and demand?
The significant impact of the A parameter on the supply side
In certain situations, the A parameter has a significant impact on the supply side and is therefore one of the most important variables determining price.
Before discussing the supply and demand curve, let's first address some important assumptions and basic factors.
Firstly, Curve operates in Passive LP mode. In my assessment, as a supply side, Passive LP is relatively stable, meaning its trading frequency is lower when faced with changing market conditions (when I say "trading," I'm referring to the balanced accessing of liquidity or accessing liquidity with trading attributes in a single token mode. "Relatively" refers to managing LP actively in Uni V3 or acting as a market maker in CEX).
Secondly, a significant portion of Curve LP's earnings come from CRV token rewards, which are not closely related to transaction fees. This was particularly evident in 2020, with the absolute value of returns being high. Therefore, when facing market fluctuations with relatively small absolute advancements (e.g., 1 ~ 2%), LP becomes even more stable.
The combined effect of the above two points makes Curve LP more stable.
Thirdly, for certain tokens, Curve is the largest liquidity provider. For example, in 2020, the y Pool was the largest exchange pool for DAI.
If all three of the above points hold true at the same time, it will make Curve Pool the main determinant of the supply curve in the entire market. Remember these three premises as we move on to the supply-demand curve discussion.
Let's first look at the supply curve in the entire market, where the A value influences the shape of the curve. The higher the A value, the "flatter and longer" the curve near the price of 1, meaning there is more abundant liquidity.
Supply-Demand Curve for the Entire Market
Now let's consider the demand curve. Let's assume a stable market condition curve - demand curve 1. When ETH experiences a sharp decline, the demand for closing CDPs sharply increases, and the market requires more DAI. Therefore, the demand curve shifts to the right - demand curve 2.
By observing the intersection of the supply-demand curves, we can clearly see the impact of the A parameter on the price. The lower the A value, the higher the new equilibrium point for the price.
Thus, if a token's primary liquidity provider is in Curve, the A parameter has a crucial influence on price determination.
Conclusion
The A parameter more or less affects the price determination in the entire market, and the degree depends on factors such as the CRV token reward rate and Curve Pool's market share.
Naturally, for such an important parameter, it raises a series of questions. What is the mechanism for setting the A parameter? Who sets it, and what are the selection criteria for the value?
Furthermore, the market is not static, which leads to a series of dynamic questions. When does the A parameter need adjustment? What impact does adjusting the A parameter have on the AMM formula, and so on.
II. Changes in the Curve due to Adjusting the A Parameter and Profit/Loss
April 17, 2020, more than a month away from 312, DAI is still in a positive unpegged state, with a price of around 1.02.
Michael (founder of Curve) initiated a poll on Twitter to see if everyone supports adjusting the A parameter of the Compound pool from 900 to 400.
49 people participated in the poll, but there was only one respondent. 8 hours later, Michael adjusted A to 400 and sent another tweet, 0 replies.
At that moment, there were very few people who could truly participate in the discussion of this issue. Michael may be immersed in a personal experiment, adjusting parameters, observing, and improving. In the scattered words on Telegram, I felt his enthusiasm and enjoyment.
Returning to the adjustment of the A parameter, it brought a daily loss of about 0.1%.
This article of mine is to clarify what it means when A is adjusted and why it brings losses.
A diagram illustrating different curve shapes corresponding to different A values
I selected a set of actual parameter settings for illustration. The discussion in this article is about Curve V1 Pool, and the curve formula is described in the V1 whitepaper.
The parameters corresponding to the black curve are: A = 10 D = 20,000
The current pool is at the black dot, with the quantities of X_token and Y_token being 2500/18105, and the price is approximately 1 X_token = 1.36 Y_token.
At this moment, if A is reduced to 3, the curve will become the red line. The parameters of this curve are: A = 3 D = 19,022
Comparing the red and black curves, it is evident that the proportion of the black curve approaching a straight line is greater. This is also the core function of A, as a larger A leads to more liquidity around price 1. The A(10) of the black curve is higher than the A(3) of the red curve. Correspondingly, the red curve has more liquidity in the range away from price 1 compared to the black curve.
At the moment of that Twitter poll, DAI was somewhat off-peg. By using the red curve with a lower A value, it would provide more liquidity compared to the black curve with a higher A value. This is why Michael wants to adjust A, as he hopes that the pool can capture more fees.
Let's go back to the changes brought about by reducing A to 3. At the moment of reducing A to 3, the quantities of the two tokens in the pool did not change, but D value changed. Additionally, as shown in the graph, the slope of the tangent line at the current point changed, and the shape of the curve also changed.
Let's specifically discuss these changes. The changes in the slope of the tangent line and the shape of the curve would be more intuitive if viewed from a different angle. The change in D value involves the topic of pool's profit and loss evaluation.
Changes in A Value from the Order Book Perspective
The Curve pool can be understood from the perspective of the order book. For a single pool, based on its A and D parameters, it corresponds to different distributions of order quantities at all price points, and all orders exist as interlinked and integral entities.
In the previous example, when A dropped from 10 to 3, it can be understood as a moment when all orders underwent an overall major adjustment, transforming from a set of black orders to a set of red orders.
First, let's make some basic explanations of the above chart.
The horizontal axis represents the price, where 1.00 represents 1 X_token = [1.00 ~ 1.01) Y_token, 1.01 represents 1 X_token = [1.01 ~ 1.02) Y_token, and so on. To save space, I have omitted orders with price below 1.00.
The vertical axis represents the quantity of Y_token (i.e. buy orders for X_token). The black portion has no data in the price range > 1.36, because the current price on the black curve is 1.36, and > 1.36 means higher-priced sell orders for X_token. This graph only examines the part where Y_token is used for buy orders, so there is no data for the portion > 1.36.
We are looking at the contrast between black and red. First, the current price has changed, corresponding to the change in the slope of the tangent line mentioned in the previous section. After adjustment A, the current price instantly changes to 1.92, and the red part extends to 1.92. This means that a certain amount of Y_token has been placed in batches within the price range of 1.36 - 1.92 to buy X_token.
This is actually a strange change, where the current price of a DEX changes without any swap. We can immediately think that this will create a difference between the current price and the market price, and we assume that arbitrageurs will instantly intervene to bring the price down to 1.36.
In addition, it can be seen that the number of orders at each price point from 1.00 to 1.36 is different, overall, there are more orders at higher prices. This corresponds to the change in the shape of the curve mentioned in the previous section.
Profit/Loss from Adjustment A - The most direct way to calculate
Michael's suggestion mentioned that lowering the parameters of Compound Pool A will result in some loss ("Wipe One Day's Profits"). Before discussing the mathematical relationship behind it, it is necessary to clarify the definition of "loss/profit".
According to the most direct idea, defining profit/loss is simple. Convert the value of both tokens into U or one of them (either X_token or Y_token), from two dimensions to one dimension, and then compare the total value before and after adjustment A. This is also what Michael mentioned as "With Impermanent Loss".
Let's briefly discuss this concept of profit/loss. For the sake of simplification, let's assume that the transaction fee = 0.
Based on the example used throughout the previous text, after lowering A, the instantaneous price of X_token becomes higher. Arbitrageurs intervene and bring the price back to the price before adjustment A, resulting in a loss. The reason is simple. As mentioned in the previous section, after lowering A, it is equivalent to placing many buy orders for X_token at prices higher than the market price. These abnormal buy orders are eaten by arbitrageurs, which will inevitably result in losses.
It will be clearer when looking at the curve graph.
The black dots and black curve represent the state of the pool before the adjustment, corresponding to a price of 1.36. After the adjustment, the pool runs along the red curve. At the moment of the adjustment, the pool price becomes 1.92, and the arbitrageurs intervene, causing the pool state to quickly move from the black dot to the red dot, corresponding to a price of 1.36.
It is necessary to compare the total value of the pool before and after the adjustment of A, and the method is relatively simple.
First, look at the total value of the pool after the adjustment of A (after the arbitrageurs intervene). Find the intersection of the tangent line of the red curve at the red dot and the Y-axis, which is the quantity of both tokens converted into a single Y_token at the current price.
Next, look at the total value of the pool before the adjustment of A. Find the intersection of the tangent line of the black curve at the black dot and the Y-axis. Because the prices before and after the adjustment of A are the same (after the arbitrageurs intervene), this tangent line is parallel to the tangent line in the first step.
Obviously, the intersection of the black tangent line and the Y-axis is higher, which means that the total value of the pool before the adjustment of A is higher. The adjustment of A resulted in a loss of total value.
The above discussion is limited to the momentary loss after the adjustment of A, which is relatively simple. However, if we extend the tracking time and explore the long-term gains and losses brought about by the adjustment of A under different price trends, it becomes somewhat complex. This depends on whether the price develops in a more unanchored direction or returns to a perfect anchor. The total value of the pool after the adjustment of A may be lower, or it may be higher. This will not be further discussed here. The purpose of this article is only to briefly demonstrate how the adjustment of A affects the total value of the pool, without seeking a complete systematic discussion.
Evaluation of Impermanent Loss
Converting based on the current prices of the two tokens, taking into account impermanent loss, is the most intuitive measurement method, but it is relatively complicated. Curve introduces another unique method for evaluating loss, which removes the factor of impermanent loss, simplifies the calculation, and is also applicable in most cases.
This is the D value, which is another core parameter of the Curve formula outside of A. The Virtual Price that we see in each pool on the Curve official website is calculated based on the D value.
D value, is the total quantity of the two tokens in the pool when the pool price is 1 (perfect anchoring). Since the price is 1 at this moment, the quantities of the two tokens can be simply added. The point where the pool price equals 1 is the intersection of the curve and the x=y line.
Returning to the previous example, it is obvious that the D value decreases when A is lowered. Therefore, in the long run, if the price can recover anchoring, the change in D value can reflect the loss caused by the adjustment of A.
In the example I used earlier, the current price is 1.36, which is actually a more extreme case. Let's take a look at Curve V1 pools, such as mainstream stablecoin / LSD pools, where the price does not deviate too much from 1. When the price is close to 1, the impact of impermanent loss is negligible, so the change in D value can be directly used to approximately reflect the profit and loss.
D value, as a one-dimensional measurement and one of the parameters of the pool, is easy to calculate and track historical values, making it suitable for evaluating profit and loss approximately.
Conclusion
Adjusting the A parameter is equivalent to rearranging the orders placed on all price points in the order book, changing the current price point, changing the D value, and causing profit or loss.
Therefore, a one-time large adjustment of the A parameter feels abrupt and even flawed. The whitepaper does not involve the dynamic management of A, perhaps because Michael gradually realized the need to modify the adjustment method of the A parameter after Curve was launched and operated for a period of time. Under the tweet announcing the completion of the A parameter adjustment for the Compound Pool, Michael responded to a comment. In subsequent versions of the pool, the adjustment of the A parameter was changed to a gradual completion over a period of time.
Is the one-time adjustment method of the A parameter for the old pool just a flaw? It's not that simple. Behind it, there is also a vulnerable point that can be attacked. Fortunately, this vulnerability was discovered by a white hacker (the depth of understanding of the protocol is truly beyond imagination). A separate article will be written to explain this attack method.