diff --git a/lib/core/src/Cardano/Wallet/Primitive/CoinSelection/MA/RoundRobin.hs b/lib/core/src/Cardano/Wallet/Primitive/CoinSelection/MA/RoundRobin.hs index e23d35e98b4..1bc80ac4b89 100644 --- a/lib/core/src/Cardano/Wallet/Primitive/CoinSelection/MA/RoundRobin.hs +++ b/lib/core/src/Cardano/Wallet/Primitive/CoinSelection/MA/RoundRobin.hs @@ -1032,6 +1032,8 @@ makeChange criteria -- asset count: & NE.zipWith (\m1 (m2, c) -> (m1 <> m2, c)) changeForNonUserSpecifiedAssets + & addMintValueToChangeMaps + & subtractBurnValueFromChangeMaps -- Finally, if there are any maps that are oversized (in any way), then -- split these maps up along with their corresponding output coins: & splitOversizedMaps @@ -1140,6 +1142,37 @@ makeChange criteria collateNonUserSpecifiedAssetQuantities (view #tokens <$> inputBundles) userSpecifiedAssetIds +-- Subtracts from the start of the list +-- +-- Properties: +-- 1. F.fold changeMaps `TokenMap.difference` burnValue +-- == F.fold (f changeMaps burnValue) +-- 2. length is conserved +-- 3. order is preserved (i.e., the result is in ascending partial order). +-- +subtractBurnValueFromChangeMaps + :: NonEmpty TokenMap + -- ^ Change maps for user and non-user-specified assets. + -> TokenMap + -- ^ Value to burn. + -> NonEmpty TokenMap +subtractBurnValueFromChangeMaps = undefined + +-- Adds to the end of the list +-- +-- Properties: +-- 1. F.fold changeMaps <> mintValue == F.fold (f changeMaps mintValue) +-- 2. length is conserved +-- 3. order is preserved (i.e., the result is in ascending partial order). +-- +addMintValueToChangeMaps + :: NonEmpty TokenMap + -- ^ Change maps for user and non-user-specified assets. + -> TokenMap + -- ^ Value to mint. + -> NonEmpty TokenMap +addMintValueToChangeMaps changeMaps mintValue = undefined + -- | Generates a map of all non-user-specified assets and their quantities. -- -- Each key in the resulting map corresponds to an asset that was NOT included