The maximum supply of a token Xupper is deeply entrenched in the equations of this AMM, and therefore, this value plays a big role in the bounds of the other variables. It makes sense, then, to start here:
A maxSupply bound can be set by agreeing on a “reasonable” extremely high value of market capitalization of a token. This value also helps to perform safe and precise math operations without fears of ever overflowing our math in Solidity or losing too much precision in our calculations.The value found that best serves our purpose for the maxSupply bound is: 100 billion tokens (with 18 decimals).This max supply tells us that if a token with such supply ever reaches a price of 1 USD per token, then its market capitalization would be of 100 billion USD. If this token reaches a value of 10 USD per token, then we are talking about a market cap of a trillion dollars. Therefore, a max supply of 100 billion tokens seems to be a practical and reasonable bound.
The minimum value allowed for a token maxSupply is not strictly enforced in the AMM beyond that it must be greater than 0. The tests were made assuming a minimum Xupper of 100_000_000_000 tokens (with 18 decimals).
The value of x is an interesting one since the tests have shown that it must be in a certain range for the math to be precise. Fortunately, the forbidden range is small enough to be almost insignificant in practical terms. The initial value of xn is xmin
According to the math:C=PUpper−PLowerXUpperandPlower≤Pupper≤100,000∗PlowerThis means that max value of Pupper−Plower=100,000∗Plower−Plower=99,999∗Plower
With the aforementioned facts in mind, it is assumed then that a C smaller than 0.1 is highly unlikely since that would mean that the denominator has to be very large in comparison to the max supply of the token (Xupper). This would be only possible through 2 different scenarios:
A huge market capitalization of the pool:
Let’s set Xupper to 100 K tokens (with 18 decimals) for this scenario (a common one). For C to be 0.1, we have that (Pupper−Plower) would have to be one million: 100,000/1,000,000=0.1. The best case scenario for a C of 0.1 is one where Pupper is 99,999 times Plower, which makes Plower1,000,000/99,999, or 10. This also means that the pool would have a market capitalization (imagining a price area of a triangle) of 50 billion (1,000,000∗100K)/2. If the y tokens are USDC or USDT, then this means 50 billion dollars market cap. In the case of the collateral being Ether, we would be talking about trillions. Something really unlikely with the current values of market caps in all industries.
The other scenario would be a very steep price curve:
Now, let’s assume this time that the max supply is of only 1 thousand tokens (again, with 18 decimals). For C to be 0.1, the price difference would have to be 10,000: 1,000/10,000=0.1. This basically means that the difference in price would have to go from 1 dollar to 10,001 dollars which is a very steep price change (if the y tokens are stable coins). We assume this to be a very unlikely situation, and therefore the most extreme situation allowed.
In conclusion, we can say that C has a lower bound of:Clower = 0.1
The upper bound for C is set by bn.s=x+C1and0<s≤C1Since s is expressed as a WAD number, then, the min value of s is 1/WAD or 1e(-18):At initialization time (when x=0), we have that s is:s=C1In other words:C=s1And if the minimum value of s is 1e-18, then, from the above equation we have that the maximum value of C is:Cupper = 1e18
10 billion (in WADs).The upper price (max Pupper) allowed is set to 10 billion. This limit is important to keep mathematical operations safe, but its cap has no mathematical explanation. It is rather an arbitrary number that best serves the purpose of keeping math operations safe within the pool.
The specs state that:0<PlowerIt is worth noting that prices are expressed in WADs which means that in reality, a lower bound of 1_000 means that the price is 1e-15 y tokens per each x token.
The upper bound of the life price of a token will be determined mostly by the y intersect of the curve (variable c in the code). When the slope of the curve is almost zero (most restrictive case), then the max price before the pool’s math overflows will be equal to c. If the slope is steep enough to cause a change in price in a certain range of x, then the max price will be determined by the max value of c, the value of the slope of the curve b and the value of x obeying to the curve equation.The maximum value for c found obeys to Solidity math limitations. It was discovered that, after the following value, c would cause an overflow of the pool:Max c: 1e12*1e18In plain English, this means that the maximum price can be, in the most restricitive scenario, 1 trillion y tokens per every x token.
For the lower bound on price over the life of the pool, the value of P<sub>lower</sub> will always work as a hard limit of the pool since c can never be less than P<sub>lower</sub>.