shelley-spec-ledger-0.1.0.0
Safe HaskellNone
LanguageHaskell98

Shelley.Spec.Ledger.UTxO

Description

This module defines the types and functions for a simple UTxO Ledger as specified in A Simplified Formal Specification of a UTxO Ledger.

Synopsis

Primitives

newtype UTxO era Source #

The unspent transaction outputs.

Constructors

UTxO 

Fields

Instances

Instances details
ShelleyBased era => Eq (UTxO era) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

Methods

(==) :: UTxO era -> UTxO era -> Bool #

(/=) :: UTxO era -> UTxO era -> Bool #

ShelleyBased era => Show (UTxO era) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

Methods

showsPrec :: Int -> UTxO era -> ShowS #

show :: UTxO era -> String #

showList :: [UTxO era] -> ShowS #

Generic (UTxO era) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

Associated Types

type Rep (UTxO era) :: Type -> Type #

Methods

from :: UTxO era -> Rep (UTxO era) x #

to :: Rep (UTxO era) x -> UTxO era #

Era era => NFData (UTxO era) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

Methods

rnf :: UTxO era -> () #

ShelleyBased era => ToCBOR (UTxO era) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

Methods

toCBOR :: UTxO era -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (UTxO era) -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [UTxO era] -> Size Source #

ShelleyBased era => FromCBOR (UTxO era) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

Methods

fromCBOR :: Decoder s (UTxO era) Source #

label :: Proxy (UTxO era) -> Text Source #

NoThunks (UTxO era) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

Relation (UTxO era) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

Associated Types

type Domain (UTxO era) Source #

type Range (UTxO era) Source #

Methods

singleton :: Domain (UTxO era) -> Range (UTxO era) -> UTxO era Source #

dom :: UTxO era -> Set (Domain (UTxO era)) Source #

range :: UTxO era -> Set (Range (UTxO era)) Source #

(◁) :: Set (Domain (UTxO era)) -> UTxO era -> UTxO era Source #

(<|) :: Set (Domain (UTxO era)) -> UTxO era -> UTxO era Source #

(⋪) :: Set (Domain (UTxO era)) -> UTxO era -> UTxO era Source #

(</|) :: Set (Domain (UTxO era)) -> UTxO era -> UTxO era Source #

(▷) :: UTxO era -> Set (Range (UTxO era)) -> UTxO era Source #

(|>) :: UTxO era -> Set (Range (UTxO era)) -> UTxO era Source #

(⋫) :: UTxO era -> Set (Range (UTxO era)) -> UTxO era Source #

(|/>) :: UTxO era -> Set (Range (UTxO era)) -> UTxO era Source #

(∪) :: UTxO era -> UTxO era -> UTxO era Source #

(⨃) :: UTxO era -> UTxO era -> UTxO era Source #

size :: Integral n => UTxO era -> n Source #

haskey :: Domain (UTxO era) -> UTxO era -> Bool Source #

addpair :: Domain (UTxO era) -> Range (UTxO era) -> UTxO era -> UTxO era Source #

removekey :: Domain (UTxO era) -> UTxO era -> UTxO era Source #

Crypto era ~ crypto => Embed (UTxO era) (Map (TxIn crypto) (TxOut era)) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

Methods

toBase :: UTxO era -> Map (TxIn crypto) (TxOut era) Source #

fromBase :: Map (TxIn crypto) (TxOut era) -> UTxO era Source #

Crypto era ~ crypto => HasExp (UTxO era) (Map (TxIn crypto) (TxOut era)) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

Methods

toExp :: UTxO era -> Exp (Map (TxIn crypto) (TxOut era)) Source #

type Rep (UTxO era) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

type Rep (UTxO era) = D1 ('MetaData "UTxO" "Shelley.Spec.Ledger.UTxO" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'True) (C1 ('MetaCons "UTxO" 'PrefixI 'True) (S1 ('MetaSel ('Just "unUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (TxIn (Crypto era)) (TxOut era)))))
type Range (UTxO era) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

type Range (UTxO era) = TxOut era
type Domain (UTxO era) Source # 
Instance details

Defined in Shelley.Spec.Ledger.UTxO

type Domain (UTxO era) = TxIn (Crypto era)

Functions

txid :: forall era. TxBodyConstraints era => TxBody era -> TxId (Crypto era) Source #

Compute the id of a transaction.

txins :: HasField "inputs" (TxBody era) (Set (TxIn (Crypto era))) => TxBody era -> Set (TxIn (Crypto era)) Source #

Compute the UTxO inputs of a transaction.

txinLookup :: TxIn (Crypto era) -> UTxO era -> Maybe (TxOut era) Source #

Lookup a txin for a given UTxO collection

txouts :: (ShelleyBased era, HasField "outputs" (TxBody era) (StrictSeq (TxOut era))) => TxBody era -> UTxO era Source #

Compute the transaction outputs of a transaction.

txup :: (ShelleyBased era, HasField "update" (TxBody era) (StrictMaybe (Update era))) => Tx era -> Maybe (Update era) Source #

balance :: ShelleyBased era => UTxO era -> Value era Source #

Determine the total balance contained in the UTxO.

totalDeposits :: PParams era -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> [DCert (Crypto era)] -> Coin Source #

Determine the total deposit amount needed. The block may (legitimately) contain multiple registration certificates for the same pool, where the first will be treated as a registration and any subsequent ones as re-registration. As such, we must only take a deposit for the first such registration.

Note that this is not an issue for key registrations since subsequent registration certificates would be invalid.

makeWitnessVKey :: forall crypto kr. (Crypto crypto, DSignable crypto (Hash crypto EraIndependentTxBody)) => Hash crypto EraIndependentTxBody -> KeyPair kr crypto -> WitVKey 'Witness crypto Source #

Create a witness for transaction

makeWitnessesVKey :: forall crypto kr. (Crypto crypto, DSignable crypto (Hash crypto EraIndependentTxBody)) => Hash crypto EraIndependentTxBody -> [KeyPair kr crypto] -> Set (WitVKey 'Witness crypto) Source #

Create witnesses for transaction

makeWitnessesFromScriptKeys :: (Crypto crypto, DSignable crypto (Hash crypto EraIndependentTxBody)) => Hash crypto EraIndependentTxBody -> Map (KeyHash kr crypto) (KeyPair kr crypto) -> Set (KeyHash kr crypto) -> Set (WitVKey 'Witness crypto) Source #

From a list of key pairs and a set of key hashes required for a multi-sig scripts, return the set of required keys.

verifyWitVKey :: (Typeable kr, Crypto crypto, DSignable crypto (Hash crypto EraIndependentTxBody)) => Hash crypto EraIndependentTxBody -> WitVKey kr crypto -> Bool Source #

Verify a transaction body witness

getScriptHash :: Addr crypto -> Maybe (ScriptHash crypto) Source #

Extract script hash from value address with script.

scriptsNeeded :: (ShelleyBased era, HasField "certs" (TxBody era) (StrictSeq (DCert (Crypto era))), HasField "wdrls" (TxBody era) (Wdrl (Crypto era)), HasField "inputs" (TxBody era) (Set (TxIn (Crypto era)))) => UTxO era -> Tx era -> Set (ScriptHash (Crypto era)) Source #

Computes the set of script hashes required to unlock the transcation inputs and the withdrawals.

scriptCred :: Credential kr crypto -> Maybe (ScriptHash crypto) Source #

txinsScript :: ShelleyBased era => Set (TxIn (Crypto era)) -> UTxO era -> Set (TxIn (Crypto era)) Source #

Compute the subset of inputs of the set txInps for which each input is locked by a script in the UTxO u.