You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently have functions to scale/descale pool reserves, but not ones to scale/descale inputs. This leads to odd behavior where unscaled inputs are passed into scaled pool reserves.
Suggested Design
Apply same logic used in pool reserve scaling but modified to accommodate specific token inputs and outputs (notes/ideas: return slice with length of input []DecCoin, loop through pool liquidity and add scaled output to return slice if denom exists in input array)
Acceptance Criteria
All existing and new tests pass
The text was updated successfully, but these errors were encountered:
…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)
Background
We currently have functions to scale/descale pool reserves, but not ones to scale/descale inputs. This leads to odd behavior where unscaled inputs are passed into scaled pool reserves.
Suggested Design
Acceptance Criteria
The text was updated successfully, but these errors were encountered: