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 GetInputAmount formula #4756

Merged

Conversation

zhangyelong
Copy link

@zhangyelong zhangyelong commented Jul 22, 2019

Relates: #4443
Correct formula should be:

(1000 * x * ∆y) / (997 * (y - ∆y)) + 1

Which the spec describes in section 3.2.2: https://github.com/runtimeverification/verified-smart-contracts/blob/uniswap/uniswap/x-y-k.pdf

Am I right?


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

Yes this is correct! Nice catch and thanks for fixing this!

Another ref of this formula being used in uniswap implementation

@colin-axner colin-axner merged commit cf88b4f into cosmos:colin/4443-coinswap Aug 8, 2019
@zhangyelong zhangyelong deleted the yelong/4443-coinswap branch May 9, 2020 07:29
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