-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3197: Remove hard-coded dependency on `txOutMax{Coin,TokenQuantity}` within coin selection modules r=jonathanknowles a=jonathanknowles ## Issue Number ADP-1481 ## Summary This PR adjusts the **_internal_** coin selection modules so that they no longer depend on **_hard-coded_** maximum token quantity constants imported from the wallet. Instead, these constants are now **_passed in_** to coin selection as part of `SelectionConstraints`. ```patch data SelectionConstraints ctx = SelectionConstraints { ... + , outputMaximumAdaQuantity + :: Coin + , outputMaximumTokenQuantity + :: TokenQuantity , ... } ``` There is no impact on the wallet itself, since these dependencies are injected in automatically by the `Cardano.Wallet.CoinSelection` module, which provides a wallet-friendly interface to coin selection. ## Future Work We intend to eventually adjust coin selection so that it **_does not discriminate_** between **_ada_** and **_non-ada_** quantities. (See https://input-output.atlassian.net/browse/ADP-1449). When that moment comes, we may want to replace these two constants with a function similar to: ```patch data SelectionConstraints ctx = SelectionConstraints { ... - , outputMaximumAdaQuantity - :: Coin - , outputMaximumTokenQuantity - :: TokenQuantity + , outputMaximumTokenQuantity + :: Asset ctx -> TokenQuantity , ... } ``` Then, callers of coin selection can provide a function that meets their requirements. If the requirement is still to have different limits for ada and non-ada quantities, then this can be encoded in the function. Or, if we can get away with a single limit for all asset types (including ada), then we can reduce this to a single constant. Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
- Loading branch information
Showing
5 changed files
with
139 additions
and
8 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