This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
token-swap: Fix slippage on withdraw tokens (#1637)
* token-swap: Fix withdrawal all tokens slippage When withdrawing, the slippage check is done before `min`ing the token a and b amounts, which makes it possible to ignore the desired slippage, and lose out on a lot more than expected. This has an additional knock-on effect. When burning all of the pool tokens, it becomes impossible to ever use it again. * Check for slippage after getting the actual amount that would be traded * Re-initialize the pool token amount on the next deposit if all pool tokens were burned Fixes #1629 * Fmt + clippy * Deposit one side on 0 pool tokens just gives new supply back
- Loading branch information
Showing
3 changed files
with
208 additions
and
18 deletions.
There are no files selected for viewing
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
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
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