Skip to content
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

Internal math for stableswap #1006

Merged
merged 5 commits into from
Nov 17, 2022
Merged

Internal math for stableswap #1006

merged 5 commits into from
Nov 17, 2022

Conversation

AlpinYukseloglu
Copy link
Contributor

This PR implements relevant math/calc functions for stableswap. Specifically, it implements the following:

  • calcOutGivenIn
  • calcInGivenOut
  • calcSpotPrice
  • solveCfmm

To align precision bounds with our Go implementation, we also implement a wider precision decimal type for internal calculations

TODO:

  • More calc tests
  • Basic spot price tests
  • BigDec implementation
  • Precision issue fixes

@vercel
Copy link

vercel bot commented Nov 14, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
osmosis-frontend ✅ Ready (Inspect) Visit Preview Nov 14, 2022 at 11:08PM (UTC)
osmosis-frontend-legacy ✅ Ready (Inspect) Visit Preview Nov 14, 2022 at 11:08PM (UTC)
osmosis-frontend-v13-chain ✅ Ready (Inspect) Visit Preview Nov 14, 2022 at 11:08PM (UTC)
osmosis-frontier ✅ Ready (Inspect) Visit Preview Nov 14, 2022 at 11:08PM (UTC)
osmosis-testnet ✅ Ready (Inspect) Visit Preview Nov 14, 2022 at 11:08PM (UTC)

const poolAssets: StableMath.StableSwapToken[] = [
{
amount: new Dec(1_000_000_000),
denom: "foo",
denom: 'foo',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm it seems your vscode setup (prob prettier) is changing double quotes to single

My only hunch right now is you're missing eslint? Try installing this extension below and see if that fixes it. If not, DM me.

https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint

@jonator jonator merged commit 44ac70b into jonator/v13 Nov 17, 2022
@jonator jonator deleted the alpo/v13 branch December 13, 2022 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants