-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[x/gamm][stableswap]: Create scaling/descaling functions for token in…
…puts/outputs (#2904) Closes: #2902 ## What is the purpose of the change This PR adds a scaling function for token inputs. Depending on what level we want to handle rounding at (at the scaling function level vs. at the `SwapExactAmountIn` level), we can either use this function for outputs as well or create a second one that handles outputs with different rounding. I personally think having one function with rounding handled at a higher level of abstraction is cleaner because it has less repeat code, but I can see the security argument for having multiple scaling functions that round differently for each specific use (cc: @ValarDragon) ## Brief Changelog - Add `scaledInput` function and tests ## Testing and Verifying - The function added in this PR is tested in `pool_test.go` under `TestScaledInput` ## Documentation and Release Note - Does this pull request introduce a new feature or user-facing behavior changes? (no) - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? (no) - How is the feature or change documented? (not documented)
- Loading branch information
1 parent
f573904
commit b9773dc
Showing
2 changed files
with
132 additions
and
15 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