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

Resolve SSW-310 (deposit formula simplification) #76

Merged
merged 4 commits into from
Apr 11, 2024

Conversation

rrruko
Copy link
Contributor

@rrruko rrruko commented Apr 3, 2024

Note that this changes rounding for deposits

@Quantumplation
Copy link
Member

I think we decided not to implement this one, because it changes the AMM behavior, and RV did a significant amount of vetting of that behavior.

@francolq
Copy link
Collaborator

The rounding issue is solved by using "ceil division" (rounded-up):

let give_b = (pool_state.quantity_b.3rd * user_gives_a - 1) / pool_state.quantity_a.3rd + 1

With this formula the AMM behavior should be the same.

However, it is understandable if you decide to preserve the current formulas.

This keeps the rounding logic the same as the heavily audited Sundae v1 logic
@francolq
Copy link
Collaborator

Looks good. It makes sense to use rounding up for the given amount, because in previous version you were rounding down the change.

@Quantumplation Quantumplation requested a review from francolq April 11, 2024 22:19
@Quantumplation Quantumplation merged commit db5185c into main Apr 11, 2024
1 check passed
@Quantumplation Quantumplation deleted the rrruko/ssw-310-deposit-formula-simplification branch April 11, 2024 22:20
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.

3 participants