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

fix(dex): fix calculation of stableswap swaps and add tests #1151

Merged
merged 12 commits into from
Jan 25, 2023

Conversation

matthiasmatt
Copy link
Contributor

Description

Swaps are broken currently on master for stableswap. The invariant calculations are correct, but instead of computing y when x = x + dx and returning y - y_after, it's calculating y when x = dx and then returning y_after.

this pr fix that, and add simple swap test to make sure that stableswap are working.

Purpose

fix a big issue

@matthiasmatt matthiasmatt requested a review from a team as a code owner January 20, 2023 16:05
@matthiasmatt matthiasmatt changed the title feat: fix calculation of stableswap swaps and add tests fix(dex): fix calculation of stableswap swaps and add tests Jan 23, 2023
@@ -76,14 +77,43 @@ func TestSwapExactAmountIn(t *testing.T) {
PoolAssets: []types.PoolAsset{
{Token: sdk.NewInt64Coin("unusd", 3_010_778_598),
Copy link
Member

Choose a reason for hiding this comment

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

note to self: use denom constants from x/common

@matthiasmatt matthiasmatt merged commit fc2e00c into master Jan 25, 2023
@matthiasmatt matthiasmatt deleted the mat/fix-stableswap-dex branch January 25, 2023 17:16
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.

None yet

2 participants