Copyright | © 2021 IOHK |
---|---|
License | Apache-2.0 |
Safe Haskell | None |
Language | Haskell2010 |
This module contains an algorithm for planning migrations at a high level.
It determines how to partition the UTxO set into entries of different types, and in which order to add entries to selections, in order to maximize the number of entries that can be successfully migrated.
Use
createPlan
to create a migration plan.
Synopsis
- createPlan :: TxConstraints -> CategorizedUTxO input -> RewardWithdrawal -> MigrationPlan input
-
data
MigrationPlan
input =
MigrationPlan
{
- selections :: ![ Selection input]
- unselected :: !( CategorizedUTxO input)
- totalFee :: ! Coin
-
data
CategorizedUTxO
input =
CategorizedUTxO
{
- supporters :: ![(input, TokenBundle )]
- freeriders :: ![(input, TokenBundle )]
- ignorables :: ![(input, TokenBundle )]
- data UTxOEntryCategory
- categorizeUTxO :: TxConstraints -> UTxO -> CategorizedUTxO ( TxIn , TxOut )
- categorizeUTxOEntries :: forall input. TxConstraints -> [(input, TokenBundle )] -> CategorizedUTxO input
- categorizeUTxOEntry :: TxConstraints -> TokenBundle -> UTxOEntryCategory
- uncategorizeUTxO :: CategorizedUTxO ( TxIn , TxOut ) -> UTxO
- uncategorizeUTxOEntries :: CategorizedUTxO input -> [(input, TokenBundle )]
Migration planning
createPlan :: TxConstraints -> CategorizedUTxO input -> RewardWithdrawal -> MigrationPlan input Source #
Creates a migration plan for the given categorized UTxO set and reward withdrawal amount.
See
MigrationPlan
.
data MigrationPlan input Source #
Represents a plan for migrating a set of UTxO entries.
Use
createPlan
to create a migration plan.
MigrationPlan | |
|
Instances
UTxO entry categorization
data CategorizedUTxO input Source #
CategorizedUTxO | |
|
Instances
Eq input => Eq ( CategorizedUTxO input) Source # | |
Defined in Cardano.Wallet.Primitive.Migration.Planning (==) :: CategorizedUTxO input -> CategorizedUTxO input -> Bool Source # (/=) :: CategorizedUTxO input -> CategorizedUTxO input -> Bool Source # |
|
Show input => Show ( CategorizedUTxO input) Source # | |
Defined in Cardano.Wallet.Primitive.Migration.Planning |
data UTxOEntryCategory Source #
Supporter |
A coin or bundle that is capable of paying for its own marginal fee and the base transaction fee. |
Freerider |
A coin or bundle that is not capable of paying for itself. |
Ignorable |
A coin that should not be added to a selection, because its value is lower than the marginal fee for an input. |
Instances
Eq UTxOEntryCategory Source # | |
Defined in Cardano.Wallet.Primitive.Migration.Planning (==) :: UTxOEntryCategory -> UTxOEntryCategory -> Bool Source # (/=) :: UTxOEntryCategory -> UTxOEntryCategory -> Bool Source # |
|
Show UTxOEntryCategory Source # | |
Defined in Cardano.Wallet.Primitive.Migration.Planning |
categorizeUTxO :: TxConstraints -> UTxO -> CategorizedUTxO ( TxIn , TxOut ) Source #
categorizeUTxOEntries :: forall input. TxConstraints -> [(input, TokenBundle )] -> CategorizedUTxO input Source #
uncategorizeUTxO :: CategorizedUTxO ( TxIn , TxOut ) -> UTxO Source #
uncategorizeUTxOEntries :: CategorizedUTxO input -> [(input, TokenBundle )] Source #