cardano-ledger-shelley-1.16.0.0: Shelley Ledger Executable Model
Safe HaskellSafe-Inferred
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

PParams era 
→ (Credential 'StakingMaybe Coin)

Function that can lookup current delegation deposits

→ (Credential 'DRepRoleMaybe Coin)

Function that can lookup current drep deposits

UTxO era 
TxBody era 
Value era 

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

getProducedValue Source #

Arguments

PParams era 
→ (KeyHash 'StakePoolBool)

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

TxBody era 
Value era 

getScriptsProvided Source #

Arguments

UTxO era

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

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

getScriptsNeededUTxO era → TxBody 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

getScriptsHashesNeededScriptsNeeded era → Set ScriptHash Source #

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

getWitsVKeyNeededCertState era → UTxO era → TxBody era → Set (KeyHash 'Witness) Source #

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

getMinFeeTxUtxoPParams era → Tx era → UTxO era → Coin Source #

Minimum fee computation, excluding witnesses and including ref scripts size

newtype ShelleyScriptsNeeded era Source #

Instances

Instances details
Show (ShelleyScriptsNeeded era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.UTxO

Eq (ShelleyScriptsNeeded era) Source # 
Instance details

Defined in Cardano.Ledger.Shelley.UTxO

getConsumedCoinEraTxBody era ⇒ PParams era → (Credential 'StakingMaybe Coin) → UTxO era → TxBody 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 'StakePoolBool)

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

TxBody era 
Value era 

consumed ∷ (EraUTxO era, EraCertState era) ⇒ PParams era → CertState era → UTxO era → TxBody era → Value era Source #

For eras before Conway, VState is expected to have an empty Map for vsDReps, and so deposit summed up is zero.

produced ∷ (EraUTxO era, EraCertState era) ⇒ PParams era → CertState era → TxBody 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.

getShelleyMinFeeTxUtxoEraTx era ⇒ PParams era → Tx era → Coin Source #

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

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

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

getScriptHashAddrMaybe ScriptHash Source #

Extract script hash from value address with script.

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.

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

Sum all the Coins in any Foldable with with TxOuts. Care should be taken since it is susceptible to integer overflow, therefore make sure this function is not applied to unvalidated TxOuts

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

Sum all the value in any Foldable with TxOuts

coinBalanceEraTxOut era ⇒ UTxO era → Coin Source #

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

balanceEraTxOut era ⇒ UTxO era → Value era Source #

Determine the total balance contained in the UTxO.

verifyWitVKey ∷ ∀ (kr ∷ KeyRole). Typeable kr ⇒ Hash HASH EraIndependentTxBodyWitVKey kr → Bool Source #

Verify a transaction body witness

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

txinLookupTxInUTxO era → Maybe (TxOut era) Source #

Lookup a txin for a given UTxO collection

txoutsEraTxBody era ⇒ TxBody era → UTxO era Source #

Compute the transaction outputs of a transaction.

txinsEraTxBody era ⇒ TxBody era → Set TxIn Source #

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

class CanGetUTxO (t ∷ TypeType) where Source #

Minimal complete definition

Nothing

Methods

utxoGSimpleGetter (t era) (UTxO era) Source #

Instances

Instances details
CanGetUTxO UTxO 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

utxoGSimpleGetter (UTxO era) (UTxO era) Source #

CanGetUTxO EpochState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoGSimpleGetter (EpochState era) (UTxO era) Source #

CanGetUTxO LedgerState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoGSimpleGetter (LedgerState era) (UTxO era) Source #

CanGetUTxO NewEpochState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoGSimpleGetter (NewEpochState era) (UTxO era) Source #

CanGetUTxO UTxOState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoGSimpleGetter (UTxOState era) (UTxO era) Source #

class CanGetUTxO t ⇒ CanSetUTxO (t ∷ TypeType) where Source #

Methods

utxoLLens' (t era) (UTxO era) Source #

Instances

Instances details
CanSetUTxO UTxO 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

utxoLLens' (UTxO era) (UTxO era) Source #

CanSetUTxO EpochState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoLLens' (EpochState era) (UTxO era) Source #

CanSetUTxO LedgerState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoLLens' (LedgerState era) (UTxO era) Source #

CanSetUTxO NewEpochState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoLLens' (NewEpochState era) (UTxO era) Source #

CanSetUTxO UTxOState Source # 
Instance details

Defined in Cardano.Ledger.Shelley.LedgerState.Types

Methods

utxoLLens' (UTxOState era) (UTxO era) Source #

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

utxoGSimpleGetter (UTxO era) (UTxO era) Source #

CanSetUTxO UTxO 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

utxoLLens' (UTxO era) (UTxO era) Source #

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

Defined in Cardano.Ledger.State.UTxO

Methods

toJSONUTxO era → Value Source #

toEncodingUTxO era → Encoding Source #

toJSONList ∷ [UTxO era] → Value Source #

toEncodingList ∷ [UTxO era] → Encoding Source #

omitFieldUTxO era → Bool Source #

Era era ⇒ Monoid (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

memptyUTxO era #

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

sconcatNonEmpty (UTxO era) → UTxO era #

stimesIntegral b ⇒ b → UTxO era → UTxO era #

Generic (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Associated Types

type Rep (UTxO era) ∷ TypeType #

Methods

fromUTxO era → Rep (UTxO era) x #

toRep (UTxO era) x → UTxO era #

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

Defined in Cardano.Ledger.State.UTxO

Methods

showsPrecIntUTxO era → ShowS #

showUTxO era → String #

showList ∷ [UTxO era] → ShowS #

(DecCBOR (TxOut era), Era era) ⇒ FromCBOR (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

fromCBORDecoder s (UTxO era) Source #

labelProxy (UTxO era) → Text Source #

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

Defined in Cardano.Ledger.State.UTxO

Methods

toCBORUTxO 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, DecCBOR (TxOut era)) ⇒ DecCBOR (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

decCBORDecoder s (UTxO era) Source #

dropCBORProxy (UTxO era) → Decoder s () Source #

labelProxy (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) Source #

Methods

getShareUTxO era → Share (UTxO era) Source #

decShareCBORShare (UTxO era) → Decoder s (UTxO era) Source #

decSharePlusCBORStateT (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

encCBORUTxO era → Encoding Source #

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

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

Default (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Methods

defUTxO era Source #

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

Defined in Cardano.Ledger.State.UTxO

Methods

rnfUTxO era → () #

(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 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.17.0.0-inplace" 'True) (C1 ('MetaCons "UTxO" 'PrefixI 'True) (S1 ('MetaSel ('Just "unUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map TxIn (TxOut era)))))
type Share (UTxO era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

newtype ScriptsProvided era Source #

The only reason it is a newtype instead of just a Map is becuase for later eras 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
Generic (ScriptsProvided era) 
Instance details

Defined in Cardano.Ledger.State.UTxO

Associated Types

type Rep (ScriptsProvided era) ∷ TypeType #

Methods

fromScriptsProvided era → Rep (ScriptsProvided era) x #

toRep (ScriptsProvided era) x → ScriptsProvided era #

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

Defined in Cardano.Ledger.State.UTxO

Methods

showsPrecIntScriptsProvided era → ShowS #

showScriptsProvided era → String #

showList ∷ [ScriptsProvided era] → ShowS #

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

Defined in Cardano.Ledger.State.UTxO

Methods

rnfScriptsProvided era → () #

(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.17.0.0-inplace" 'True) (C1 ('MetaCons "ScriptsProvided" 'PrefixI 'True) (S1 ('MetaSel ('Just "unScriptsProvided") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map ScriptHash (Script era)))))

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

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

PParams era 
→ (Credential 'StakingMaybe Coin)

Function that can lookup current delegation deposits

→ (Credential 'DRepRoleMaybe Coin)

Function that can lookup current drep deposits

UTxO era 
TxBody era 
Value era 

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

getProducedValue Source #

Arguments

PParams era 
→ (KeyHash 'StakePoolBool)

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

TxBody era 
Value era 

getScriptsProvided Source #

Arguments

UTxO era

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

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

getScriptsNeededUTxO era → TxBody 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

getScriptsHashesNeededScriptsNeeded era → Set ScriptHash Source #

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

getWitsVKeyNeededCertState era → UTxO era → TxBody era → Set (KeyHash 'Witness) Source #

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

getMinFeeTxUtxoPParams era → Tx era → UTxO era → Coin Source #

Minimum fee computation, excluding witnesses and including ref scripts size

Orphan instances