Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for an x*y=k style bonding curve.
After discussion:
The x and y are based on virtual amounts not actual amounts.
This allows inventory to be decoupled from price/slippage.
For example, Alice may set her x to be 30 eth and her y to be 3 nfts.
But she may then only deposit 10 eth and 1 nft.
That means that the curve will move along as if there was 30 eth and 3 nfts of liquidity.
Similarly she may also specify a different ratio. x = 20 eth, y = 3 nfts (price = 20 / 3 = 6.67).
And then deposit 10 eth and 1 nft (price = 10 / 1 = 10.0).
This means that the curve will move along as if it had 20 eth and 3 nfts of liquidity.
Of course, if the virtual reserves don't match up with the actual reserves then this means that it's possible for a pool to run out of liquidity if it gets sufficiently far along the curve. However this is no different than how the linear and exponential curves behave. The key thing is the way that the curve is shaped: x*y=k.