-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Begin stableswap spec #2873
Begin stableswap spec #2873
Conversation
Suppose the existence of a function $\text{solve\_cfmm}(x, v, w, k) = y\text{ s.t. }g(x, y, v, w) = k$. | ||
Then we can solve swaps by first computing $k = g(x_0, y_0, v, w)$. | ||
Then suppose I want to swap $a$ units of $x$, and then want to find how many units $b$ of $y$ that we get out. | ||
We do this by computing $y_f = \text{solve\_cfmm}(x_0 + a, v, w, k)$, and then $b = y_0 - y_f$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and all of the remaining expressions also do not render for me unfortunately
Thoughts on throwing this into a hackmd so we can work on filling out the rest together? Or would you prefer to fill out the whole spec and then have others review? |
upperbound = | ||
``` | ||
|
||
### Spot Price |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these considered as TODOs for future reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, just things that should be filled in before stableswap has a full spec
@p0mvn github rendering now fixed |
@AlpinYukseloglu happy with either of the options you proposed. Feel free to commit to the branch, or move it to a hackmd. I also don't think we need to have the full spec written in one PR though. (e.g. I'm happy with this getting in its current form, I feel like it gives us a swap algorithm description we can iterate on for comparing against code) |
The maximal upperbound is obviously unworkable, and in general binary searching around wide ranges is unfortunate, as we expect most trades to be centered around $y_0$. | ||
This would suggest that we should do something smarter to iteratively approach the right value for the upperbound at least. | ||
Notice that $h$ is super-linearly related in $y$, and at most cubically related to $y$. | ||
This means that $ \forall c \in \R^+, c * h(x,y,w) < h(x,c*y,w) < c^3 * h(x,y,w)$. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one isn't rendering still
ty. fixed! (Also apologies, last commit got cut off a bit early in the web editor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The progress so far LGTM and everything makes sense. Nice work
Co-authored-by: Roman <roman@osmosis.team>
What is the purpose of the change
WIP work on a spec for Solidly stableswap and description of equations used within it
Rendered URL: https://github.com/osmosis-labs/osmosis/blob/dev/stableswap_spec/x/gamm/pool-models/stableswap/README.md