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(amm): buy_price calculation #269

Merged
merged 4 commits into from
Jun 1, 2021
Merged

fix(amm): buy_price calculation #269

merged 4 commits into from
Jun 1, 2021

Conversation

Roznovjak
Copy link
Contributor

Description

Fee in buy_price calculation is wrongly assigned to the amount_out. The correct operation order is to compute amount_in first, and then apply fee to this value in the next step.

Copy link
Contributor

@enthusiastmartin enthusiastmartin left a comment

Choose a reason for hiding this comment

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

Just few minor comments. Otherwise looks good to me.

pallets/xyk/src/lib.rs Outdated Show resolved Hide resolved
pallets/xyk/src/lib.rs Show resolved Hide resolved
pallets/xyk/src/lib.rs Outdated Show resolved Hide resolved
@enthusiastmartin
Copy link
Contributor

Btw i dont think this is a breaking change. IT is just implementation change but it does not break anything.

@Roznovjak
Copy link
Contributor Author

You are right. A change in behavior to fix a bug is not considered as a breaking change.

@Roznovjak Roznovjak changed the title fix(amm)!: buy_price calculation fix(amm): buy_price calculation Jun 1, 2021
@Roznovjak Roznovjak merged commit 9b41c5c into master Jun 1, 2021
@Roznovjak Roznovjak deleted the fix/buy_price branch June 2, 2021 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants