cardano-ledger-mary-1.8.0.0: Cardano ledger with multiasset support.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Mary.Value

Contents

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

Generic PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

type Rep PolicyIDTypeType #

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 #

DecCBOR PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

encCBORPolicyIDEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy PolicyIDSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [PolicyID] → Size Source #

NFData PolicyID Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfPolicyID → () #

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.8.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

Show AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

showsPrecIntAssetNameShowS #

showAssetNameString #

showList ∷ [AssetName] → ShowS #

DecCBOR AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

encCBORAssetNameEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy AssetNameSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [AssetName] → Size Source #

NFData AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfAssetName → () #

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

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 MaryValueTypeType #

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 #

DecCBOR MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

encCBORMaryValueEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy MaryValueSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [MaryValue] → Size Source #

Compactible MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

data CompactForm MaryValue Source #

Val MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NFData MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfMaryValue → () #

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 #

Show (CompactForm MaryValue) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

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 → () #

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

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.8.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 CompactForm MaryValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

newtype MultiAsset Source #

The MultiAssets map

Instances

Instances details
ToJSON MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

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 MultiAssetTypeType #

Show 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

Methods

encCBORMultiAssetEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy MultiAssetSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [MultiAsset] → Size Source #

NFData MultiAsset Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfMultiAsset → () #

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.8.0.0-inplace" 'True) (C1 ('MetaCons "MultiAsset" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map PolicyID (Map AssetName Integer)))))

insert ∷ (IntegerIntegerInteger) → PolicyIDAssetNameIntegerMultiAssetMultiAsset Source #

Deprecated: In favor of insertMultiAsset

insert 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

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

lookupPolicyIDAssetNameMaryValueInteger Source #

Deprecated: In favor of lookupMultiAsset

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
Generic CompactValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

type Rep CompactValueTypeType #

Show CompactValue Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

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 → () #

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.8.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

Monoid (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Semigroup (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

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

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

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 → () #

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

HeapWords (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

HeapWords (CompactForm DeltaCoin) 
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

Methods

sizeOfType#Proxy (CompactForm Coin) → Int# Source #

sizeOf#CompactForm Coin → Int# Source #

alignmentOfType#Proxy (CompactForm Coin) → Int# Source #

alignment#CompactForm Coin → Int# Source #

indexByteArray#ByteArray# → Int# → CompactForm Coin Source #

readByteArray#MutableByteArray# s → Int# → State# s → (# State# s, CompactForm Coin #) Source #

writeByteArray#MutableByteArray# s → Int# → CompactForm Coin → State# s → State# s Source #

setByteArray#MutableByteArray# s → Int# → Int# → CompactForm Coin → State# s → State# s Source #

indexOffAddr# ∷ Addr# → Int# → CompactForm Coin Source #

readOffAddr# ∷ Addr# → Int# → State# s → (# State# s, CompactForm Coin #) Source #

writeOffAddr# ∷ Addr# → Int# → CompactForm Coin → State# s → State# s Source #

setOffAddr# ∷ Addr# → Int# → Int# → CompactForm Coin → State# s → State# s Source #

Prim (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

sizeOfType#Proxy (CompactForm DeltaCoin) → Int# Source #

sizeOf#CompactForm DeltaCoin → Int# Source #

alignmentOfType#Proxy (CompactForm DeltaCoin) → Int# Source #

alignment#CompactForm DeltaCoin → Int# Source #

indexByteArray#ByteArray# → Int# → CompactForm DeltaCoin Source #

readByteArray#MutableByteArray# s → Int# → State# s → (# State# s, CompactForm DeltaCoin #) Source #

writeByteArray#MutableByteArray# s → Int# → CompactForm DeltaCoin → State# s → State# s Source #

setByteArray#MutableByteArray# s → Int# → Int# → CompactForm DeltaCoin → State# s → State# s Source #

indexOffAddr# ∷ Addr# → Int# → CompactForm DeltaCoin Source #

readOffAddr# ∷ Addr# → Int# → State# s → (# State# s, CompactForm DeltaCoin #) Source #

writeOffAddr# ∷ Addr# → Int# → CompactForm DeltaCoin → State# s → State# s Source #

setOffAddr# ∷ Addr# → Int# → Int# → CompactForm DeltaCoin → State# s → State# s Source #

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

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

Deprecated

pruneMap PolicyID (Map AssetName Integer) → Map PolicyID (Map AssetName Integer) Source #

Deprecated: In favor of pruneZeroMultiAsset

Remove 0 assets from a MultiAsset