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

Amount slippage computation #54

Open
peterjah opened this issue Jul 4, 2024 · 0 comments
Open

Amount slippage computation #54

peterjah opened this issue Jul 4, 2024 · 0 comments

Comments

@peterjah
Copy link

peterjah commented Jul 4, 2024

Hello,
I'm trying to understand how AmountMin are computed from allowed slippage here:

const amountXMin = new Fraction(ONE)

    const amountXMin = new Fraction(ONE)
      .add(amountSlippage)
      .invert()
      .multiply(amountX).quotient

for allowed slippage of 100%, it would gives a amountXMin = amountX / 2
Is it intended ? should amountXMin be 0 in that case ?

Intuitively i would do like this:
const amountXMin = (new Fraction(amountX).multiply(new Fraction(1n).subtract(amountSlippage))).quotient;

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

No branches or pull requests

1 participant