cardano-ledger-mary-1.10.0.0: Cardano ledger with multiasset support.
Safe HaskellNone
LanguageHaskell2010

Cardano.Ledger.Mary.Value

Synopsis

Documentation

newtype PolicyID Source #

Policy ID

Constructors

PolicyID 

Fields

Instances

Instances details
FromJSON PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

FromJSONKey PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

ToJSON PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

ToJSONKey PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

DecCBOR PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NFData PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfPolicyID → () #

Generic PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

type Rep PolicyID 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep PolicyID = D1 ('MetaData "PolicyID" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.10.0.0-inplace" 'True) (C1 ('MetaCons "PolicyID" 'PrefixI 'True) (S1 ('MetaSel ('Just "policyID") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ScriptHash)))

Methods

fromPolicyIDRep PolicyID x #

toRep PolicyID x → PolicyID #

Show PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

showsPrecIntPolicyIDShowS #

showPolicyIDString #

showList ∷ [PolicyID] → ShowS #

Eq PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

(==)PolicyIDPolicyIDBool #

(/=)PolicyIDPolicyIDBool #

Ord PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NoThunks PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep PolicyID = D1 ('MetaData "PolicyID" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.10.0.0-inplace" 'True) (C1 ('MetaCons "PolicyID" 'PrefixI 'True) (S1 ('MetaSel ('Just "policyID") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ScriptHash)))

newtype AssetName Source #

Asset Name

Constructors

AssetName 

Instances

Instances details
ToJSON AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

ToJSONKey AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

DecCBOR AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NFData AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfAssetName → () #

Show AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

showsPrecIntAssetNameShowS #

showAssetNameString #

showList ∷ [AssetName] → ShowS #

Eq AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

(==)AssetNameAssetNameBool #

(/=)AssetNameAssetNameBool #

Ord AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NoThunks AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

data MaryValue Source #

The Value representing MultiAssets

Constructors

MaryValue !Coin !MultiAsset 

Instances

Instances details
ToJSON MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

DecCBOR MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

ToKeyValuePairs MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

toKeyValuePairsKeyValue e kv ⇒ MaryValue → [kv] Source #

Compactible MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

newtype CompactForm MaryValue 
Instance details

Defined in Cardano.Ledger.Mary.Value

Val MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NFData MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfMaryValue → () #

Monoid MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Semigroup MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Generic MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

type Rep MaryValue 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep MaryValue = D1 ('MetaData "MaryValue" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.10.0.0-inplace" 'False) (C1 ('MetaCons "MaryValue" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Coin) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MultiAsset)))

Methods

fromMaryValueRep MaryValue x #

toRep MaryValue x → MaryValue #

Show MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

showsPrecIntMaryValueShowS #

showMaryValueString #

showList ∷ [MaryValue] → ShowS #

Eq MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

(==)MaryValueMaryValueBool #

(/=)MaryValueMaryValueBool #

Abelian MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Group MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NoThunks MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Inject Coin MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

injectCoinMaryValue Source #

DecCBOR (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NFData (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfCompactForm MaryValue → () #

Show (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Eq (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

MemPack (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NoThunks (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

newtype CompactForm MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep MaryValue = D1 ('MetaData "MaryValue" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.10.0.0-inplace" 'False) (C1 ('MetaCons "MaryValue" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Coin) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MultiAsset)))

newtype MultiAsset Source #

The MultiAssets map

Instances

Instances details
ToJSON MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

DecCBOR MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NFData MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfMultiAsset → () #

Monoid MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Semigroup MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Generic MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

type Rep MultiAsset 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep MultiAsset = D1 ('MetaData "MultiAsset" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.10.0.0-inplace" 'True) (C1 ('MetaCons "MultiAsset" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map PolicyID (Map AssetName Integer)))))
Show MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Eq MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

(==)MultiAssetMultiAssetBool #

(/=)MultiAssetMultiAssetBool #

Group MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NoThunks MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep MultiAsset = D1 ('MetaData "MultiAsset" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.10.0.0-inplace" 'True) (C1 ('MetaCons "MultiAsset" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map PolicyID (Map AssetName Integer)))))
type MemoHashIndex (MaryTxBodyRaw l) Source # 
Instance details

Defined in Cardano.Ledger.Mary.TxBody

insertMultiAsset ∷ (IntegerIntegerInteger) → PolicyIDAssetNameIntegerMultiAssetMultiAsset Source #

insertMultiAsset comb policy asset n v, if comb = old new -> old, the integer in the MultiAsset is prefered over n if comb = old new -> new, then n is prefered over the integer in the MultiAsset if (comb old new) == 0, then that value should not be stored in the MultiAsset

multiAssetFromList ∷ [(PolicyID, AssetName, Integer)] → MultiAsset Source #

Rather than using prune to remove 0 assets, when can avoid adding them in the first place by using valueFromList to construct a MultiAsset

policiesMultiAssetSet PolicyID Source #

Extract the set of policies in the Value.

This function is equivalent to computing the support of the value in the spec.

mapMaybeMultiAsset ∷ (PolicyIDAssetNameIntegerMaybe Integer) → MultiAssetMultiAsset Source #

Map a function over each multi asset value while optionally filtering values out. Canonical form is preserved.

filterMultiAsset Source #

Arguments

∷ (PolicyIDAssetNameIntegerBool)

Predicate that needs to return True whenever an asset should be retained.

MultiAsset 
MultiAsset 

Filter multi assets. Canonical form is preserved.

pruneZeroMultiAssetMultiAssetMultiAsset Source #

Remove all assets with that have zero amount specified

showValueMaryValueString Source #

Display a MaryValue as a String, one token per line

data CompactValue Source #

Instances

Instances details
DecCBOR CompactValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR CompactValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NFData CompactValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfCompactValue → () #

Generic CompactValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

type Rep CompactValue 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep CompactValue = D1 ('MetaData "CompactValue" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.10.0.0-inplace" 'False) (C1 ('MetaCons "CompactValueAdaOnly" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 (CompactForm Coin))) :+: C1 ('MetaCons "CompactValueMultiAsset" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 (CompactForm Coin)) :*: (S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 ShortByteString))))
Show CompactValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Eq CompactValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

MemPack CompactValue Source #

We need to manually pack/unpack `CompactForm Coin` here because its MemPack instance can't be used due to the requirement of it being compatible with the first case of CompactValueAdaOnly. In other words MemPack instance for `CompactForm Coin` also prefixes a zero Tag for binary compatibility with CompactValueAdaOnly case.

Instance details

Defined in Cardano.Ledger.Mary.Value

NoThunks CompactValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep CompactValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep CompactValue = D1 ('MetaData "CompactValue" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.10.0.0-inplace" 'False) (C1 ('MetaCons "CompactValueAdaOnly" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 (CompactForm Coin))) :+: C1 ('MetaCons "CompactValueMultiAsset" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 (CompactForm Coin)) :*: (S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 ShortByteString))))

data family CompactForm a Source #

Instances

Instances details
FromJSON (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

ToJSON (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

ToJSON (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

ToCBOR (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

toCBORCompactForm CoinEncoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (CompactForm Coin) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [CompactForm Coin] → Size Source #

DecCBOR (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

DecCBOR (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

DecCBOR (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

EncCBOR (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

EncCBOR (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

ToPlutusData (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Plutus.ToPlutusData

NFData (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

rnfCompactForm Coin → () #

NFData (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

rnfCompactForm DeltaCoin → () #

NFData (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfCompactForm MaryValue → () #

Monoid (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Semigroup (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Generic (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Associated Types

type Rep (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

type Rep (CompactForm Coin) = D1 ('MetaData "CompactForm" "Cardano.Ledger.Coin" "cardano-ledger-core-1.19.0.0-inplace" 'True) (C1 ('MetaCons "CompactCoin" 'PrefixI 'True) (S1 ('MetaSel ('Just "unCompactCoin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)))
Show (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Show (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

Show (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Eq (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Eq (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

Eq (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Ord (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Abelian (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Group (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

MemPack (CompactForm Coin)

This instance prefixes with a 0 Tag for binary compatibility with compact form of multiassets.

Instance details

Defined in Cardano.Ledger.Coin

MemPack (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NoThunks (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

NoThunks (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

NoThunks (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Prim (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Prim (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

Uniform (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

uniformMStatefulGen g m ⇒ g → m (CompactForm Coin) Source #

UniformRange (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

newtype CompactForm Coin 
Instance details

Defined in Cardano.Ledger.Coin

newtype CompactForm DeltaCoin 
Instance details

Defined in Cardano.Ledger.Coin

newtype CompactForm MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

type Rep (CompactForm Coin) = D1 ('MetaData "CompactForm" "Cardano.Ledger.Coin" "cardano-ledger-core-1.19.0.0-inplace" 'True) (C1 ('MetaCons "CompactCoin" 'PrefixI 'True) (S1 ('MetaSel ('Just "unCompactCoin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)))

isMultiAssetSmallEnoughMultiAssetBool Source #

Unlike representationSize, this function cheaply checks whether any offset within a MultiAsset compact representation is likely to overflow Word16.

compact form inequality: 8n (Word64) + 2n (Word16) + 2n (Word16) + 28p (policy ids) + sum of lengths of unique asset names <= 65535 maximum size for the asset name is 32 bytes, so: 8n + 2n + 2n + 28p + 32n <= 65535 where: n = total number of assets, p = number of unique policy ids