-
Notifications
You must be signed in to change notification settings - Fork 97
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
Autoswap accounting fixes #NTRN-385 #685
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Is it ready for review? Cause the description says otherwise |
Yes, ready for review |
pr0n00gler
requested changes
Sep 6, 2024
jcompagni10
force-pushed
the
fix/autoswap
branch
from
October 11, 2024 04:26
76b2c50
to
603ea85
Compare
pr0n00gler
previously approved these changes
Oct 11, 2024
pr0n00gler
approved these changes
Oct 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes 4 issues to related to how autoswap shares are calculated. For broader context see the autoswap spec: https://www.notion.so/hadron/1f17de6d999f4ace9f322262dde11a93?v=5bca99093f134baf9688c9bf12f1aa1c&p=7aca1c1dd1c54ae38202792b79cfe54e&pm=s
Issue 1:
The price (
price1To0Center
) used for the calculation was incorrect.Issue 2:
Autoswap shares were being issued at full value instead of being discounted by the normal share value calculation (existingShares / poolValue)
Issue 2.5:
The share value calculation must include the autoswap fee as part of the share value.
Issue 3:
Autoswap calculation does not take into account prices and handles 1 sides pools incorrectly, forcing autoswap amount to be too high. See: https://www.notion.so/Autoswap-Spec-ca5f35a4cd5b4dbf9ae27e0454ddd445?pvs=4#12032ea59b0e802c925efae10c3ca85f
Because of these issues, it is possible that an incorrect number of shares were issued for pool deposits. As of this moment, there are no pools that are affected. But out of caution, there is an upgrade that will withdraw any potentially affected pools.