Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Cardano.Ledger.Shelley.UTxO
Contents
Synopsis
- class EraTx era ⇒ EraUTxO era where
- type ScriptsNeeded era = (r ∷ Type) | r → era
- getConsumedValue ∷ PParams era → (Credential 'Staking → Maybe Coin) → (Credential 'DRepRole → Maybe Coin) → UTxO era → TxBody era → Value era
- getProducedValue ∷ PParams era → (KeyHash 'StakePool → Bool) → TxBody era → Value era
- getScriptsProvided ∷ UTxO era → Tx era → ScriptsProvided era
- getScriptsNeeded ∷ UTxO era → TxBody era → ScriptsNeeded era
- getScriptsHashesNeeded ∷ ScriptsNeeded era → Set ScriptHash
- getWitsVKeyNeeded ∷ CertState era → UTxO era → TxBody era → Set (KeyHash 'Witness)
- getMinFeeTxUtxo ∷ PParams era → Tx era → UTxO era → Coin
- newtype ShelleyScriptsNeeded era = ShelleyScriptsNeeded (Set ScriptHash)
- getShelleyScriptsNeeded ∷ EraTxBody era ⇒ UTxO era → TxBody era → ShelleyScriptsNeeded era
- getConsumedCoin ∷ EraTxBody era ⇒ PParams era → (Credential 'Staking → Maybe Coin) → UTxO era → TxBody era → Coin
- shelleyProducedValue ∷ EraTxBody era ⇒ PParams era → (KeyHash 'StakePool → Bool) → TxBody era → Value era
- consumed ∷ (EraUTxO era, EraCertState era) ⇒ PParams era → CertState era → UTxO era → TxBody era → Value era
- produced ∷ (EraUTxO era, EraCertState era) ⇒ PParams era → CertState era → TxBody era → Value era
- getShelleyMinFeeTxUtxo ∷ EraTx era ⇒ PParams era → Tx era → Coin
- getShelleyWitsVKeyNeeded ∷ ∀ era. (EraTx era, ShelleyEraTxBody era, EraCertState era) ⇒ CertState era → UTxO era → TxBody era → Set (KeyHash 'Witness)
- getShelleyWitsVKeyNeededNoGov ∷ ∀ era. EraTx era ⇒ UTxO era → TxBody era → Set (KeyHash 'Witness)
- getScriptHash ∷ Addr → Maybe ScriptHash
- areAllAdaOnly ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Bool
- sumAllCoin ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Coin
- sumAllValue ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Value era
- coinBalance ∷ EraTxOut era ⇒ UTxO era → Coin
- balance ∷ EraTxOut era ⇒ UTxO era → Value era
- verifyWitVKey ∷ ∀ (kr ∷ KeyRole). Typeable kr ⇒ Hash HASH EraIndependentTxBody → WitVKey kr → Bool
- txInsFilter ∷ UTxO era → Set TxIn → UTxO era
- txinLookup ∷ TxIn → UTxO era → Maybe (TxOut era)
- txouts ∷ EraTxBody era ⇒ TxBody era → UTxO era
- txins ∷ EraTxBody era ⇒ TxBody era → Set TxIn
- class CanGetUTxO (t ∷ Type → Type) where
- utxoG ∷ SimpleGetter (t era) (UTxO era)
- class CanGetUTxO t ⇒ CanSetUTxO (t ∷ Type → Type) where
- newtype UTxO era = UTxO {}
- newtype ScriptsProvided era = ScriptsProvided {
- unScriptsProvided ∷ Map ScriptHash (Script era)
- type family ScriptsNeeded era = (r ∷ Type) | r → era
- class EraTx era ⇒ EraUTxO era where
- type ScriptsNeeded era = (r ∷ Type) | r → era
- getConsumedValue ∷ PParams era → (Credential 'Staking → Maybe Coin) → (Credential 'DRepRole → Maybe Coin) → UTxO era → TxBody era → Value era
- getProducedValue ∷ PParams era → (KeyHash 'StakePool → Bool) → TxBody era → Value era
- getScriptsProvided ∷ UTxO era → Tx era → ScriptsProvided era
- getScriptsNeeded ∷ UTxO era → TxBody era → ScriptsNeeded era
- getScriptsHashesNeeded ∷ ScriptsNeeded era → Set ScriptHash
- getWitsVKeyNeeded ∷ CertState era → UTxO era → TxBody era → Set (KeyHash 'Witness)
- getMinFeeTxUtxo ∷ PParams era → Tx era → UTxO era → Coin
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
Arguments
∷ PParams era | |
→ (Credential 'Staking → Maybe Coin) | Function that can lookup current delegation deposits |
→ (Credential 'DRepRole → Maybe 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.
Arguments
∷ PParams era | |
→ (KeyHash 'StakePool → Bool) | Check whether a pool with a supplied PoolStakeId is already registered. |
→ TxBody era | |
→ Value era |
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.
getScriptsNeeded ∷ UTxO 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
getScriptsHashesNeeded ∷ ScriptsNeeded era → Set ScriptHash Source #
Extract the set of all script hashes that are needed for script validation.
getWitsVKeyNeeded ∷ CertState era → UTxO era → TxBody era → Set (KeyHash 'Witness) Source #
Extract all of the KeyHash witnesses that are required for validating the transaction
getMinFeeTxUtxo ∷ PParams era → Tx era → UTxO era → Coin Source #
Minimum fee computation, excluding witnesses and including ref scripts size
Instances
EraUTxO ShelleyEra Source # | |
Defined in Cardano.Ledger.Shelley.UTxO Associated Types type ScriptsNeeded ShelleyEra = (r ∷ Type) Source # Methods getConsumedValue ∷ PParams ShelleyEra → (Credential 'Staking → Maybe Coin) → (Credential 'DRepRole → Maybe Coin) → UTxO ShelleyEra → TxBody ShelleyEra → Value ShelleyEra Source # getProducedValue ∷ PParams ShelleyEra → (KeyHash 'StakePool → Bool) → TxBody ShelleyEra → Value ShelleyEra Source # getScriptsProvided ∷ UTxO ShelleyEra → Tx ShelleyEra → ScriptsProvided ShelleyEra Source # getScriptsNeeded ∷ UTxO ShelleyEra → TxBody ShelleyEra → ScriptsNeeded ShelleyEra Source # getScriptsHashesNeeded ∷ ScriptsNeeded ShelleyEra → Set ScriptHash Source # getWitsVKeyNeeded ∷ CertState ShelleyEra → UTxO ShelleyEra → TxBody ShelleyEra → Set (KeyHash 'Witness) Source # getMinFeeTxUtxo ∷ PParams ShelleyEra → Tx ShelleyEra → UTxO ShelleyEra → Coin Source # |
newtype ShelleyScriptsNeeded era Source #
Constructors
ShelleyScriptsNeeded (Set ScriptHash) |
Instances
Show (ShelleyScriptsNeeded era) Source # | |
Defined in Cardano.Ledger.Shelley.UTxO Methods showsPrec ∷ Int → ShelleyScriptsNeeded era → ShowS # show ∷ ShelleyScriptsNeeded era → String # showList ∷ [ShelleyScriptsNeeded era] → ShowS # | |
Eq (ShelleyScriptsNeeded era) Source # | |
Defined in Cardano.Ledger.Shelley.UTxO Methods (==) ∷ ShelleyScriptsNeeded era → ShelleyScriptsNeeded era → Bool # (/=) ∷ ShelleyScriptsNeeded era → ShelleyScriptsNeeded era → Bool # |
getShelleyScriptsNeeded ∷ EraTxBody era ⇒ UTxO era → TxBody era → ShelleyScriptsNeeded era Source #
getConsumedCoin ∷ EraTxBody era ⇒ PParams era → (Credential 'Staking → Maybe 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.
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.
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
getScriptHash ∷ Addr → Maybe 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 TxOut
s contain any MultiAssets. Returns
True if non of them do.
sumAllValue ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Value era Source #
Sum all the value in any Foldable with TxOut
s
coinBalance ∷ EraTxOut 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
balance ∷ EraTxOut era ⇒ UTxO era → Value era Source #
Determine the total balance contained in the UTxO.
verifyWitVKey ∷ ∀ (kr ∷ KeyRole). Typeable kr ⇒ Hash HASH EraIndependentTxBody → WitVKey kr → Bool Source #
Verify a transaction body witness
Filter out TxIn's from the UTxO
map
txouts ∷ EraTxBody era ⇒ TxBody era → UTxO era Source #
Compute the transaction outputs of a transaction.
txins ∷ EraTxBody 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 ∷ Type → Type) where Source #
Minimal complete definition
Nothing
Methods
utxoG ∷ SimpleGetter (t era) (UTxO era) Source #
Instances
CanGetUTxO UTxO | |
Defined in Cardano.Ledger.State.UTxO | |
CanGetUTxO EpochState Source # | |
Defined in Cardano.Ledger.Shelley.LedgerState.Types Methods utxoG ∷ SimpleGetter (EpochState era) (UTxO era) Source # | |
CanGetUTxO LedgerState Source # | |
Defined in Cardano.Ledger.Shelley.LedgerState.Types Methods utxoG ∷ SimpleGetter (LedgerState era) (UTxO era) Source # | |
CanGetUTxO NewEpochState Source # | |
Defined in Cardano.Ledger.Shelley.LedgerState.Types Methods utxoG ∷ SimpleGetter (NewEpochState era) (UTxO era) Source # | |
CanGetUTxO UTxOState Source # | |
Defined in Cardano.Ledger.Shelley.LedgerState.Types |
class CanGetUTxO t ⇒ CanSetUTxO (t ∷ Type → Type) where Source #
Instances
The unspent transaction outputs.
Instances
CanGetUTxO UTxO | |
Defined in Cardano.Ledger.State.UTxO | |
CanSetUTxO UTxO | |
ToJSON (TxOut era) ⇒ ToJSON (UTxO era) | |
Era era ⇒ Monoid (UTxO era) | |
Semigroup (UTxO era) | |
Generic (UTxO era) | |
Show (TxOut era) ⇒ Show (UTxO era) | |
(DecCBOR (TxOut era), Era era) ⇒ FromCBOR (UTxO era) | |
(EncCBOR (TxOut era), Era era) ⇒ ToCBOR (UTxO era) | |
(Era era, DecCBOR (TxOut era)) ⇒ DecCBOR (UTxO era) | |
(DecShareCBOR (TxOut era), Share (TxOut era) ~ Interns (Credential 'Staking)) ⇒ DecShareCBOR (UTxO era) | |
(Era era, EncCBOR (TxOut era)) ⇒ EncCBOR (UTxO era) | |
Default (UTxO era) | |
Defined in Cardano.Ledger.State.UTxO | |
(Era era, NFData (TxOut era)) ⇒ NFData (UTxO era) | |
Defined in Cardano.Ledger.State.UTxO | |
(Era era, Eq (TxOut era)) ⇒ Eq (UTxO era) | |
NoThunks (TxOut era) ⇒ NoThunks (UTxO era) | |
type Rep (UTxO era) | |
Defined in Cardano.Ledger.State.UTxO | |
type Share (UTxO era) | |
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 | |
Fields
|
Instances
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
type ScriptsNeeded ShelleyEra Source # | |
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
Arguments
∷ PParams era | |
→ (Credential 'Staking → Maybe Coin) | Function that can lookup current delegation deposits |
→ (Credential 'DRepRole → Maybe 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.
Arguments
∷ PParams era | |
→ (KeyHash 'StakePool → Bool) | Check whether a pool with a supplied PoolStakeId is already registered. |
→ TxBody era | |
→ Value era |
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.
getScriptsNeeded ∷ UTxO 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
getScriptsHashesNeeded ∷ ScriptsNeeded era → Set ScriptHash Source #
Extract the set of all script hashes that are needed for script validation.
getWitsVKeyNeeded ∷ CertState era → UTxO era → TxBody era → Set (KeyHash 'Witness) Source #
Extract all of the KeyHash witnesses that are required for validating the transaction
getMinFeeTxUtxo ∷ PParams era → Tx era → UTxO era → Coin Source #
Minimum fee computation, excluding witnesses and including ref scripts size
Instances
EraUTxO ShelleyEra Source # | |
Defined in Cardano.Ledger.Shelley.UTxO Associated Types type ScriptsNeeded ShelleyEra = (r ∷ Type) Source # Methods getConsumedValue ∷ PParams ShelleyEra → (Credential 'Staking → Maybe Coin) → (Credential 'DRepRole → Maybe Coin) → UTxO ShelleyEra → TxBody ShelleyEra → Value ShelleyEra Source # getProducedValue ∷ PParams ShelleyEra → (KeyHash 'StakePool → Bool) → TxBody ShelleyEra → Value ShelleyEra Source # getScriptsProvided ∷ UTxO ShelleyEra → Tx ShelleyEra → ScriptsProvided ShelleyEra Source # getScriptsNeeded ∷ UTxO ShelleyEra → TxBody ShelleyEra → ScriptsNeeded ShelleyEra Source # getScriptsHashesNeeded ∷ ScriptsNeeded ShelleyEra → Set ScriptHash Source # getWitsVKeyNeeded ∷ CertState ShelleyEra → UTxO ShelleyEra → TxBody ShelleyEra → Set (KeyHash 'Witness) Source # getMinFeeTxUtxo ∷ PParams ShelleyEra → Tx ShelleyEra → UTxO ShelleyEra → Coin Source # |
Orphan instances
EraUTxO ShelleyEra Source # | |
Associated Types type ScriptsNeeded ShelleyEra = (r ∷ Type) Source # Methods getConsumedValue ∷ PParams ShelleyEra → (Credential 'Staking → Maybe Coin) → (Credential 'DRepRole → Maybe Coin) → UTxO ShelleyEra → TxBody ShelleyEra → Value ShelleyEra Source # getProducedValue ∷ PParams ShelleyEra → (KeyHash 'StakePool → Bool) → TxBody ShelleyEra → Value ShelleyEra Source # getScriptsProvided ∷ UTxO ShelleyEra → Tx ShelleyEra → ScriptsProvided ShelleyEra Source # getScriptsNeeded ∷ UTxO ShelleyEra → TxBody ShelleyEra → ScriptsNeeded ShelleyEra Source # getScriptsHashesNeeded ∷ ScriptsNeeded ShelleyEra → Set ScriptHash Source # getWitsVKeyNeeded ∷ CertState ShelleyEra → UTxO ShelleyEra → TxBody ShelleyEra → Set (KeyHash 'Witness) Source # getMinFeeTxUtxo ∷ PParams ShelleyEra → Tx ShelleyEra → UTxO ShelleyEra → Coin Source # |