Skip to main content
Bounds can be set by 3 criteria:
  1. Solidity math limitations.
  2. Mathemtical bounds (found from the equations and specifications).
  3. Arbitrary market assumptions (such as market capitalization).
The following bounds have been set using at least one of these three criteria.

Shared Bounds - ALTBC and other Curves

MaxSupply (Xupper)

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:

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 minimum Xupper 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 xnx_n is xminx_{min}

xmin

The minimum value of the variable x. The bounds are as follows: 0.000001xupper<xmin<0.1xupper0.000001 x_{upper} < x_{min} < 0.1 x_{upper}

Upper bound

The upper bound of x is the X_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: C=XUpperPUpperPLowerC = \frac{X_{Upper}}{P_{Upper} - P_{Lower}} and PlowerPupper100,000PlowerP_{lower} \leq P_{upper} \leq 100,000 * P_{lower} This means that max value of PupperPlower=100,000PlowerPlower=99,999PlowerP_{upper} - P_{lower} = 100,000 * P_{lower} - P_{lower} = 99,999 * P_{lower}

Lower 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:
  1. 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 (PupperPlower)(P_{upper} - P_{lower}) would have to be one million: 100,000/1,000,000=0.1100,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 Plower 1,000,000/99,9991,000,000 / 99,999, or 1010. This also means that the pool would have a market capitalization (imagining a price area of a triangle) of 50 billion (1,000,000100K)/2(1,000,000 * 100 K) / 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.
  2. 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.11,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

Upper bound

The upper bound for C is set by bn. s=1x+Cs = \frac{1}{x + C} and 0<s1C0 < s \leq \frac{1}{C} Since 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=1Cs = \frac{1}{C} In other words: C=1sC = \frac{1}{s} 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: 0<Plower0 < P_{lower} 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 (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*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 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>.

Swaps

There are no restrictions in the amount of tokens that can be swaped since the math is precise enough to handle any size of swaps.

Invariants

Please visit next page for Invariants.

Relative Bounds

  • Dx106pDx106\frac{D \cdot x}{10^6} \leq p \leq D \cdot x \cdot 10^6
  • cnxnDnc_n \cdot x_n \leq D_n
  • cnXnDnc_n \cdot X_n \leq D_n
  • cnxn+(pncn)xn2Dnc_n \cdot x_n + \frac{(p_n - c_n) \cdot x_n}{2} \geq D_n
  • DnxnpnDnxn+12s(xn)xn\frac{D_n}{x_n} \leq p_n \leq \frac{D_n}{x_n} + \frac{1}{2} \cdot s(x_n) \cdot x_n
where
  • s(xn)=Vnxn+Cs(x_n) = \frac{V_n}{x_n + C}
  • cnxnDnc_n \cdot x_n \leq D_n
  • Dncnxn+12s(xn)xn2D_n \leq c_n \cdot x_n + \frac{1}{2} \cdot s(x_n) \cdot x_n^2

New Bounds

  • 0pn1060 \leq p_n \leq 10^6
  • 0xn10120 \leq x_n \leq 10^{12}
  • 10cn10610 \leq c_n \leq 10^6
  • 0<C10310 < C \leq 10^{31}
  • LnCn>xTarget\frac{L_n}{\sqrt{C_n}} > x_{Target}