This PR implements a CFMM with the quartic invariant where the power is 4, and the invariant must be greater than or equal to zero. Since the invariant involves a fractional exponent, it requires a high precision fixed point arithmetic to make sure the invariant rounds close to zero. Therefore we use the UD60x18 type from the PRBMath library.
The invariant is $0 = \frac{x}{L} - {({p_1}^{3} - \frac{3}{4} \frac{y}{L})}^{\frac{4}{3}}$ but simplifies to $scale0 >= {({strike}^{3} - \frac{3}{4} scale1)}^{\frac{4}{3}}$
This PR implements a CFMM with the quartic invariant where the power is 4, and the invariant must be greater than or equal to zero. Since the invariant involves a fractional exponent, it requires a high precision fixed point arithmetic to make sure the invariant rounds close to zero. Therefore we use the
UD60x18
type from the PRBMath library.The invariant is $0 = \frac{x}{L} - {({p_1}^{3} - \frac{3}{4} \frac{y}{L})}^{\frac{4}{3}}$ but simplifies to $scale0 >= {({strike}^{3} - \frac{3}{4} scale1)}^{\frac{4}{3}}$
Learn more here: https://hackmd.io/@Z6CPUVWyQV-cMF924gYOVg/BJPg-dl_R