- Solidity math limitations.
- Mathemtical bounds (found from the equations and specifications).
- Arbitrary market assumptions (such as market capitalization).
Shared Bounds - ALTBC and other Curves
MaxSupply (Xupper)
The maximum supply of a tokenXupper 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:
Upper bound
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.Lower 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 minimumXupper of 100_000_000_000 tokens (with 18 decimals).
xn
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 isxmin
The minimum value of the variable x. The bounds are as follows:Upper bound
The upper bound of x is theX_upper of the pool (token’s max supply).
Max protocol fee: up to .20%
Max LP fee: 50%
ALTBC Specific Bounds
Constant C
According to the math: and This means that max value ofLower bound
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 would have to be one million: . The best case scenario for a C of 0.1 is one where Pupper is 99,999 times Plower, which makes Plower , or . This also means that the pool would have a market capitalization (imagining a price area of a triangle) of 50 billion . 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: . 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.
Upper bound
The upper bound for C is set by bn. and Since s is expressed as a WAD number, then, the min value of s is1/WAD or 1e(-18):
At initialization time (when x=0), we have that s is:
In other words:
And 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
Price
Initial Curve Upper bound
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.Initial Curve Lower bound
The specs state that: It 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.Curve Life Upper bound
The upper bound of the life price of a token will be determined mostly by the y intersect of the curve (variablec 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*1e18
In plain English, this means that the maximum price can be, in the most restricitive scenario, 1 trillion y tokens per every x token.
Curve Life Lower bound
For the lower bound on price over the life of the pool, the value ofP<sub>lower</sub> will always work as a hard limit of the pool since c can never be less than P<sub>lower</sub>.