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

Add slippage protection functions #94

Merged
merged 1 commit into from Mar 21, 2024

Conversation

trmid
Copy link
Member

@trmid trmid commented Mar 21, 2024

Adds two alternative withdraw and redeem functions that include conditions that must be met for the action to succeed. If the redeem doesn't return at least the expected assets it will revert. Similarly, if the withdraw burns more than the expected shares, it will revert. This allows users to pass in the expected results and be protected against any change in the vault state since they submitted.

The usage of these functions should be encouraged in all UIs even if the vault is not currently in a lossy state so that users can be certain that they'll get the rate they see on the site if the tx is successful.

Copy link

linear bot commented Mar 21, 2024

Copy link

LCOV of commit c3e471c during coverage #506

Summary coverage rate:
  lines......: 99.5% (208 of 209 lines)
  functions..: 100.0% (55 of 55 functions)
  branches...: no data found

Files changed coverage rate:
                              |Lines       |Functions  |Branches    
  Filename                    |Rate     Num|Rate    Num|Rate     Num
  ==================================================================
  src/PrizeVault.sol          |99.4%    179| 100%    44|    -      0

@trmid trmid merged commit 72af610 into main Mar 21, 2024
2 checks passed
@trmid trmid deleted the gen-1221-m-274-slippage-protection-functions branch March 21, 2024 22:44
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.

None yet

2 participants