cardano-ledger-shelley-1.21.0.0: Shelley Ledger Executable Model
Safe HaskellNone
LanguageHaskell2010

Cardano.Ledger.Shelley.UTxO

Synopsis

Documentation

class EraTx era ⇒ EraUTxO era where Source #

Associated Types

type ScriptsNeeded era = (r ∷ Type) | r → era Source #

A customizable type on per era basis for the information required to find all scripts needed for the transaction.

Methods

getConsumedValue Source #

Arguments

∷ ∀ (t ∷ TxLevel). PParams era 
→ (Credential 'Staking → Maybe Coin)

Function that can lookup current delegation deposits

→ UTxO era 
→ TxBody t era 
→ Value era 

Calculate all the value that is being consumed by the transaction.

getProducedValue Source #

Arguments

∷ PParams era 
→ (KeyHash 'StakePool → Bool)

Check whether a pool with a supplied PoolStakeId is already registered.

→ TxBody 'TopTx era 
→ Value era 

getScriptsProvided Source #

Arguments

∷ ∀ (t ∷ TxLevel). UTxO era

For some era it is necessary to look into the UTxO to find all of the available scripts for the transaction

→ Tx t era 
→ ScriptsProvided era 

Initial eras will look into witness set to find all of the available scripts, but starting with Babbage we can look for available scripts in the UTxO using reference inputs.

getScriptsNeeded ∷ ∀ (t ∷ TxLevel). UTxO era → TxBody t era → ScriptsNeeded era Source #

Produce all the information required for figuring out which scripts are required for the transaction to be valid, once those scripts are evaluated

getScriptsHashesNeeded ∷ ScriptsNeeded era → Set ScriptHash Source #

Extract the set of all script hashes that are needed for script validation.

getWitsVKeyNeeded ∷ ∀ (t ∷ TxLevel). CertState era → UTxO era → TxBody t era → Set (KeyHash 'Witness) Source #

Extract all of the KeyHash witnesses that are required for validating the transaction

getMinFeeTxUtxo ∷ ∀ (t ∷ TxLevel). PParams era → Tx t era → UTxO era → Coin Source #

Minimum fee computation, excluding witnesses and including ref scripts size

newtype ShelleyScriptsNeeded era Source #

Instances

Instances details
Generic (ShelleyScriptsNeeded era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.UTxO

Associated Types

type Rep (ShelleyScriptsNeeded era) 
Instance details

Defined in Cardano.Ledger.Shelley.UTxO

type Rep (ShelleyScriptsNeeded era) = D1 ('MetaData "ShelleyScriptsNeeded" "Cardano.Ledger.Shelley.UTxO" "cardano-ledger-shelley-1.21.0.0-inplace" 'True) (C1 ('MetaCons "ShelleyScriptsNeeded" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set ScriptHash))))
Show (ShelleyScriptsNeeded era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.UTxO

Eq (ShelleyScriptsNeeded era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.UTxO

type Rep (ShelleyScriptsNeeded era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.UTxO

type Rep (ShelleyScriptsNeeded era) = D1 ('MetaData "ShelleyScriptsNeeded" "Cardano.Ledger.Shelley.UTxO" "cardano-ledger-shelley-1.21.0.0-inplace" 'True) (C1 ('MetaCons "ShelleyScriptsNeeded" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set ScriptHash))))

getShelleyScriptsNeeded ∷ ∀ era (l ∷ TxLevel). EraTxBody era ⇒ UTxO era → TxBody l era → ShelleyScriptsNeeded era Source #

getConsumedCoin ∷ ∀ era (l ∷ TxLevel). EraTxBody era ⇒ PParams era → (Credential 'Staking → Maybe Coin) → UTxO era → TxBody l era → Coin Source #

Compute the lovelace which are destroyed by the transaction. This implementation is suitable for Shelley and Allegra only.

shelleyProducedValue Source #

Arguments

∷ EraTxBody era 
⇒ PParams era 
→ (KeyHash 'StakePool → Bool)

Check whether a pool with a supplied PoolStakeId is already registered.

→ TxBody 'TopTx era 
→ Value era 

shelleyConsumed ∷ ∀ era (l ∷ TxLevel). (EraUTxO era, EraCertState era) ⇒ PParams era → Accounts era → UTxO era → TxBody l era → Value era Source #

Shelley version of consumed will work for all eras, however, starting with Dijkstra era it becomes simpler, because it will no longer require access to Accounts.

produced ∷ EraUTxO era ⇒ PParams era → PState era → TxBody 'TopTx era → Value era Source #

Compute the lovelace which are created by the transaction For eras before Conway, VState is expected to have an empty Map for vsDReps, and so deposit summed up is zero.

getShelleyMinFeeTxUtxo ∷ ∀ era (l ∷ TxLevel). EraTx era ⇒ PParams era → Tx l era → Coin Source #

getShelleyWitsVKeyNeeded ∷ ∀ era (l ∷ TxLevel). (EraTx era, ShelleyEraTxBody era, EraCertState era, STxLevel l era ~ STxTopLevel l era) ⇒ CertState era → UTxO era → TxBody l era → Set (KeyHash 'Witness) Source #

getShelleyWitsVKeyNeededNoGov ∷ ∀ era (l ∷ TxLevel). EraTx era ⇒ UTxO era → TxBody l era → Set (KeyHash 'Witness) Source #

Extract witnesses from UTxO and TxBody. Does not enforce witnesses for governance related Keys, i.e. GenDelegs

newtype UTxO era Source #

The unspent transaction outputs.

Constructors

UTxO 

Fields

Instances

Instances details
CanGetUTxO UTxO 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

utxoG ∷ SimpleGetter (UTxO era) (UTxO era) Source #

CanSetUTxO UTxO 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

utxoL ∷ Lens' (UTxO era) (UTxO era) Source #

ToJSON (TxOut era) ⇒ ToJSON (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

toJSON ∷ UTxO era → Value Source #

toEncoding ∷ UTxO era → Encoding Source #

toJSONList ∷ [UTxO era] → Value Source #

toEncodingList ∷ [UTxO era] → Encoding Source #

omitField ∷ UTxO era → Bool Source #

(Era era, DecShareCBOR (TxOut era), Share (TxOut era) ~ Interns (Credential 'Staking)) ⇒ FromCBOR (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

fromCBOR ∷ Decoder s (UTxO era) Source #

label ∷ Proxy (UTxO era) → Text Source #

(Era era, EncCBOR (TxOut era)) ⇒ ToCBOR (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

toCBOR ∷ UTxO era → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (UTxO era) → Size Source #

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

(Era era, DecShareCBOR (TxOut era), Share (TxOut era) ~ Interns (Credential 'Staking)) ⇒ DecCBOR (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

decCBOR ∷ Decoder s (UTxO era) Source #

dropCBOR ∷ Proxy (UTxO era) → Decoder s () Source #

label ∷ Proxy (UTxO era) → Text Source #

(DecShareCBOR (TxOut era), Share (TxOut era) ~ Interns (Credential 'Staking)) ⇒ DecShareCBOR (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Associated Types

type Share (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

getShare ∷ UTxO era → Share (UTxO era) Source #

decShareCBOR ∷ Share (UTxO era) → Decoder s (UTxO era) Source #

decSharePlusCBOR ∷ StateT (Share (UTxO era)) (Decoder s) (UTxO era) Source #

(Era era, EncCBOR (TxOut era)) ⇒ EncCBOR (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

encCBOR ∷ UTxO era → Encoding Source #

Default (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

def ∷ UTxO era Source #

(Era era, NFData (TxOut era)) ⇒ NFData (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

rnf ∷ UTxO era → () #

Era era ⇒ Monoid (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

mempty ∷ UTxO era #

mappend ∷ UTxO era → UTxO era → UTxO era #

mconcat ∷ [UTxO era] → UTxO era #

Semigroup (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

(<>) ∷ UTxO era → UTxO era → UTxO era #

sconcat ∷ NonEmpty (UTxO era) → UTxO era #

stimes ∷ Integral b ⇒ b → UTxO era → UTxO era #

Generic (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Associated Types

type Rep (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

type Rep (UTxO era) = D1 ('MetaData "UTxO" "Cardano.Ledger.State.UTxO" "cardano-ledger-core-1.23.0.0-inplace" 'True) (C1 ('MetaCons "UTxO" 'PrefixI 'True) (S1 ('MetaSel ('Just "unUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map TxIn (TxOut era)))))

Methods

from ∷ UTxO era → Rep (UTxO era) x #

to ∷ Rep (UTxO era) x → UTxO era #

Show (TxOut era) ⇒ Show (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

showsPrec ∷ Int → UTxO era → ShowS #

show ∷ UTxO era → String #

showList ∷ [UTxO era] → ShowS #

(Era era, Eq (TxOut era)) ⇒ Eq (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

(==) ∷ UTxO era → UTxO era → Bool #

(/=) ∷ UTxO era → UTxO era → Bool #

NoThunks (TxOut era) ⇒ NoThunks (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

type Share (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

type Rep (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

type Rep (UTxO era) = D1 ('MetaData "UTxO" "Cardano.Ledger.State.UTxO" "cardano-ledger-core-1.23.0.0-inplace" 'True) (C1 ('MetaCons "UTxO" 'PrefixI 'True) (S1 ('MetaSel ('Just "unUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map TxIn (TxOut era)))))

class EraTx era ⇒ EraUTxO era where Source #

Associated Types

type ScriptsNeeded era = (r ∷ Type) | r → era Source #

A customizable type on per era basis for the information required to find all scripts needed for the transaction.

Methods

getConsumedValue Source #

Arguments

∷ ∀ (t ∷ TxLevel). PParams era 
→ (Credential 'Staking → Maybe Coin)

Function that can lookup current delegation deposits

→ UTxO era 
→ TxBody t era 
→ Value era 

Calculate all the value that is being consumed by the transaction.

getProducedValue Source #

Arguments

∷ PParams era 
→ (KeyHash 'StakePool → Bool)

Check whether a pool with a supplied PoolStakeId is already registered.

→ TxBody 'TopTx era 
→ Value era 

getScriptsProvided Source #

Arguments

∷ ∀ (t ∷ TxLevel). UTxO era

For some era it is necessary to look into the UTxO to find all of the available scripts for the transaction

→ Tx t era 
→ ScriptsProvided era 

Initial eras will look into witness set to find all of the available scripts, but starting with Babbage we can look for available scripts in the UTxO using reference inputs.

getScriptsNeeded ∷ ∀ (t ∷ TxLevel). UTxO era → TxBody t era → ScriptsNeeded era Source #

Produce all the information required for figuring out which scripts are required for the transaction to be valid, once those scripts are evaluated

getScriptsHashesNeeded ∷ ScriptsNeeded era → Set ScriptHash Source #

Extract the set of all script hashes that are needed for script validation.

getWitsVKeyNeeded ∷ ∀ (t ∷ TxLevel). CertState era → UTxO era → TxBody t era → Set (KeyHash 'Witness) Source #

Extract all of the KeyHash witnesses that are required for validating the transaction

getMinFeeTxUtxo ∷ ∀ (t ∷ TxLevel). PParams era → Tx t era → UTxO era → Coin Source #

Minimum fee computation, excluding witnesses and including ref scripts size

type family ScriptsNeeded era = (r ∷ Type) | r → era Source #

A customizable type on per era basis for the information required to find all scripts needed for the transaction.

Instances

Instances details
type ScriptsNeeded ShelleyEra Source # 
Instance details

Defined in Cardano.Ledger.Shelley.UTxO

newtype ScriptsProvided era Source #

The only reason it is a newtype instead of just a Map is because for later eras it is expensive to compute the actual map, so we want to use the type safety guidance to avoid redundant work.

Constructors

ScriptsProvided 

Instances

Instances details
(Era era, NFData (Script era)) ⇒ NFData (ScriptsProvided era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

rnf ∷ ScriptsProvided era → () #

Generic (ScriptsProvided era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Associated Types

type Rep (ScriptsProvided era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

type Rep (ScriptsProvided era) = D1 ('MetaData "ScriptsProvided" "Cardano.Ledger.State.UTxO" "cardano-ledger-core-1.23.0.0-inplace" 'True) (C1 ('MetaCons "ScriptsProvided" 'PrefixI 'True) (S1 ('MetaSel ('Just "unScriptsProvided") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map ScriptHash (Script era)))))

Methods

from ∷ ScriptsProvided era → Rep (ScriptsProvided era) x #

to ∷ Rep (ScriptsProvided era) x → ScriptsProvided era #

(Era era, Show (Script era)) ⇒ Show (ScriptsProvided era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

showsPrec ∷ Int → ScriptsProvided era → ShowS #

show ∷ ScriptsProvided era → String #

showList ∷ [ScriptsProvided era] → ShowS #

(Era era, Eq (Script era)) ⇒ Eq (ScriptsProvided era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

(==) ∷ ScriptsProvided era → ScriptsProvided era → Bool #

(/=) ∷ ScriptsProvided era → ScriptsProvided era → Bool #

(Era era, Ord (Script era)) ⇒ Ord (ScriptsProvided era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

type Rep (ScriptsProvided era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

type Rep (ScriptsProvided era) = D1 ('MetaData "ScriptsProvided" "Cardano.Ledger.State.UTxO" "cardano-ledger-core-1.23.0.0-inplace" 'True) (C1 ('MetaCons "ScriptsProvided" 'PrefixI 'True) (S1 ('MetaSel ('Just "unScriptsProvided") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map ScriptHash (Script era)))))

class CanGetUTxO t ⇒ CanSetUTxO (t ∷ Type → Type) where Source #

Methods

utxoL ∷ Lens' (t era) (UTxO era) Source #

Instances

Instances details
CanSetUTxO UTxO 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

utxoL ∷ Lens' (UTxO era) (UTxO era) Source #

CanSetUTxO EpochState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoL ∷ Lens' (EpochState era) (UTxO era) Source #

CanSetUTxO LedgerState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoL ∷ Lens' (LedgerState era) (UTxO era) Source #

CanSetUTxO NewEpochState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoL ∷ Lens' (NewEpochState era) (UTxO era) Source #

CanSetUTxO UTxOState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoL ∷ Lens' (UTxOState era) (UTxO era) Source #

class CanGetUTxO (t ∷ Type → Type) where Source #

Minimal complete definition

Nothing

Methods

utxoG ∷ SimpleGetter (t era) (UTxO era) Source #

default utxoG ∷ CanSetUTxO t ⇒ SimpleGetter (t era) (UTxO era) Source #

Instances

Instances details
CanGetUTxO UTxO 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

utxoG ∷ SimpleGetter (UTxO era) (UTxO era) Source #

CanGetUTxO EpochState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoG ∷ SimpleGetter (EpochState era) (UTxO era) Source #

CanGetUTxO LedgerState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoG ∷ SimpleGetter (LedgerState era) (UTxO era) Source #

CanGetUTxO NewEpochState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoG ∷ SimpleGetter (NewEpochState era) (UTxO era) Source #

CanGetUTxO UTxOState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoG ∷ SimpleGetter (UTxOState era) (UTxO era) Source #

txins ∷ ∀ era (t ∷ TxLevel). EraTxBody era ⇒ TxBody t era → Set TxIn Source #

Compute the UTxO inputs of a transaction. txins has the same problems as txouts, see notes below.

txouts ∷ ∀ era (l ∷ TxLevel). EraTxBody era ⇒ TxBody l era → UTxO era Source #

Compute the transaction outputs of a transaction.

txinLookup ∷ TxIn → UTxO era → Maybe (TxOut era) Source #

Lookup a txin for a given UTxO collection

txInsFilter Source #

Arguments

∷ UTxO era

Source UTxO

→ Set TxIn

Which of the TxIns you would like to keep.

→ UTxO era 

Filter out TxIn's from the UTxO map

verifyWitVKey ∷ ∀ (kr ∷ KeyRole). Hash HASH EraIndependentTxBody → WitVKey kr → Bool Source #

Verify a transaction body witness

sumUTxO ∷ EraTxOut era ⇒ UTxO era → Value era Source #

Determine the total balance contained in the UTxO.

sumCoinUTxO ∷ EraTxOut era ⇒ UTxO era → Coin Source #

Determine the total Ada only balance contained in the UTxO. This is equivalent to coin . sumUTxO, but it will be more efficient.

Warning - This function cannot be applied to an untrusted UTxO, since it is susceptible to overflow

sumAllValue ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Value era Source #

Sum all the value in any Foldable with TxOuts

sumAllCoin ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Coin Source #

Sum all the Coins in any Foldable with with TxOuts.

Warning - Care should be taken since it is susceptible to integer overflow, therefore make sure this function is not applied to unvalidated TxOuts

areAllAdaOnly ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Bool Source #

Check whether any of the supplied TxOuts contain any MultiAssets. Returns True if non of them do.

getScriptHash ∷ Addr → Maybe ScriptHash Source #

Extract script hash from value address with script.

Orphan instances