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

stableswap: Add multi-asset support threading, via scaled reserve API change #2896

Merged
merged 3 commits into from
Sep 30, 2022

Conversation

ValarDragon
Copy link
Member

@ValarDragon ValarDragon commented Sep 29, 2022

What is the purpose of the change

All of the stableswap functions assumed 2 asset pools still for getting the scaled reserves. This PR fixes this, by making methods to get all scaled reserves at once, but reordering the first and second field as needed.

We may want to change the result type from DecCoin to BigDec in a second pass though

Testing and Verifying

This change is already covered by existing tests, TestScaledSortedPoolReserves.

Added tests for multi-asset pools

@ValarDragon ValarDragon requested review from a team and AlpinYukseloglu September 29, 2022 13:49
@github-actions github-actions bot added the C:x/gamm Changes, features and bugs related to the gamm module. label Sep 29, 2022
@ValarDragon ValarDragon added V:state/compatible/no_backport State machine compatible PR, depends on prior breaks and removed C:x/gamm Changes, features and bugs related to the gamm module. labels Sep 29, 2022
@github-actions github-actions bot added the C:x/gamm Changes, features and bugs related to the gamm module. label Sep 29, 2022
@AlpinYukseloglu AlpinYukseloglu mentioned this pull request Sep 29, 2022
55 tasks
Copy link
Contributor

@AlpinYukseloglu AlpinYukseloglu left a comment

Choose a reason for hiding this comment

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

LGTM!


result[i] = amt.ToDec().QuoInt64Mut(int64(scalingFactor))
// scaledPoolReserves returns scaled amount of pool liquidity for usage in AMM equations
func (p Pool) scaledPoolReserves() ([]sdk.DecCoin, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I love this change

@ValarDragon ValarDragon merged commit bd9c40b into main Sep 30, 2022
@ValarDragon ValarDragon deleted the dev/multiasset_spotsprice branch September 30, 2022 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/gamm Changes, features and bugs related to the gamm module. V:state/compatible/no_backport State machine compatible PR, depends on prior breaks
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants