Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Cooked.InitialDistribution
Description
This module provides a convenient way to spread assets between wallets and scripts at the initialization of the mock chain. These initial assets can be accompanied by datums, staking credentials and reference scripts.
Synopsis
- data InitialDistribution where
- InitialDistribution :: {..} -> InitialDistribution
- distributionFromList :: [(Wallet, [Value])] -> InitialDistribution
Documentation
data InitialDistribution where Source #
Describes the initial distribution of UTxOs per wallet. This is important
since transaction validation must specify a collateral. Hence, wallets must
have more than one UTxO to begin with in order to execute a transaction and
have some collateral option. The txCollateral
is transferred to the node
operator in case the transaction fails to validate.
The following specifies a starting state where wallet 1
owns two UTxOs,
one with 42 Ada and one with 2 Ada and one TOK token; wallet 2
owns a
single UTxO with 10 Ada and wallet 3
has 10 Ada and a permanent value. See
Cooked.Currencies for more information on quick and permanent values.
i0 = distributionFromList $ [ (wallet 1 , [ ada 42 , ada 2 <> quickValue "TOK" 1 ] , (wallet 2 , [ ada 10 ]) , (wallet 3 , [ ada 10 <> permanentValue "XYZ" 10]) ]
Note that initial distribution can lead to payments that would not be accepted if part of an actual transaction, such as payment without enough ada to sustain themselves.
Constructors
InitialDistribution | |
Fields
|
Instances
Monoid InitialDistribution Source # | |
Defined in Cooked.InitialDistribution Methods mempty :: InitialDistribution # mappend :: InitialDistribution -> InitialDistribution -> InitialDistribution # | |
Semigroup InitialDistribution Source # | |
Defined in Cooked.InitialDistribution Methods (<>) :: InitialDistribution -> InitialDistribution -> InitialDistribution # sconcat :: NonEmpty InitialDistribution -> InitialDistribution # stimes :: Integral b => b -> InitialDistribution -> InitialDistribution # | |
Default InitialDistribution Source # | 5 UTxOs with 100 Ada each, for each of the |
Defined in Cooked.InitialDistribution Methods |
distributionFromList :: [(Wallet, [Value])] -> InitialDistribution Source #
Creating a initial distribution with simple values assigned to wallets