-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Motivation `transferTokens` currently takes a `amount: number` and optional `token` to convert the number to `e8s`. When we use `TokenAmountV2`, the `token` can't be optional because if we need to use a fallback we can't be certain that we use the token when we have to. So instead pass `ulps` to `transferToken` and convert on the calling side. The calling side knows better whether it's safe to use `numberToE8s` or whether numbsToUlps` with `token` should be used. This PR also includes most of the changes from #3931 # Changes 1. Change the parameters of `transferToken` to accept `amountUlps: bigint` and don't use `numberToE8s`. 2. Change functions that used to share the params type with `transferTokens` but which now accept `amount: number` instead of `amountUlps: bigint` to explicitly state their param types and convert amount, either with `numberToE8s` for SNS or ckBTC, or with `numberToUlps` for IcrcToken. 3. Add `numberToUlps`, which requires 8 decimal places until we use `TokenAmountV2`. # Tests 1. Copied the unit test from #3935 but adjust to start failing when amountToUlps start working instead of skipping that test. 2. Other unit tests are adjust to work with the new param types. # Todos - [ ] Add entry to changelog (if necessary). not necessary
- Loading branch information
Showing
8 changed files
with
94 additions
and
48 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
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
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