As part of our ongoing effort to optimize AMM design, we have developed a new version of Proteus, our AMM engine, which increases precision and gas efficiency (Github).
Please see our previous white papers (first paper, second paper) for a review of our prior work. Briefly, our objective is to create an “AMM engine” that can replicate any bonding curve. To that end, we developed a method that could use any polynomial equation as an invariant (provided the segment in question was positive and monotonically decreasing). In our first paper, we used generalized conic sections as a proof of concept. The drawback to conic sections is that they are difficult to parameterize due to the nonlinear relationship between their algebraic coefficients and their geometry. Therefore, in our second paper, we used a piece-wise function of modified constant product curves. This strategy gave us both flexible geometry and could be easily parameterized. This third paper describes an implementation that is mathematically equivalent to the second iteration, but is more precise and gas efficient (approximately 90k-110k gas for a swap).
This approach allows for extremely precise liquidity concentration across multiple price ranges and fungible LP tokens. The first application will be stablecoin liquidity pools. We will branch out to other use cases over time.
Our motivation is to create an algorithm that bonding curve that can replicate any bonding curve. This allows for both ****liquidity concentration and fungible LP tokens. This algorithm must meet the following design constraints in order to be viable:
The proteus curve is a composite function; that is, a curve made up of smaller functions scaled up and ‘stitched’ together in a stepwise fashion. The curve sections we use are all of hyperbolic form: $(x+a)(y+b)=1$ as seen below. The curves are constrained such that the boundaries between curve sections each represent a single price so that there are no discontinuities in the curve and its first derivative. When each segment is scaled appropriately, this stepwise function of curve segments generates a composite function as shown below:
Figure 1: A composite bonding curve created from discrete curve segments
Figure 1: A composite bonding curve created from discrete curve segments
After implementing this stepwise function in Solidity and deploying it to Ethereum test nets, we concluded the following about this composite curve:
Figure 2: A section’s kappa value influences the degree to which its curve segment scale in the composite curve
To generate the composite function, the utility and kappa are represented in each segment i of the stepwise function with n segments, numbered from 1..n starting with the bottom-most segment (the segment adjacent to the x-axis), and increasing counter-clockwise. as follows:
$$ \Big(\dfrac {x}{u\kappa _i} + a_i\Big)\Big(\dfrac {y}{u\kappa _i} + b_i\Big) = 1 $$
There are three arrays (vectors) that determine the shape of the curve: