cardano-ledger-alonzo-0.1.0.0: Cardano ledger introducing Plutus Core
Safe Haskell None
Language Haskell2010

Cardano.Ledger.Alonzo.TxInfo

Synopsis

Documentation

data TxOutSource crypto Source #

A transaction output can be translated because it is a newly created output, or because it is the output which is connected to a transaction input being spent.

Instances

Instances details
Eq ( TxOutSource crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

Show ( TxOutSource crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

Generic ( TxOutSource crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

Associated Types

type Rep ( TxOutSource crypto) :: Type -> Type Source #

Crypto crypto => ToCBOR ( TxOutSource crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

Crypto crypto => FromCBOR ( TxOutSource crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

NoThunks ( TxOutSource crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

type Rep ( TxOutSource crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

type Rep ( TxOutSource crypto) = D1 (' MetaData "TxOutSource" "Cardano.Ledger.Alonzo.TxInfo" "cardano-ledger-alonzo-0.1.0.0-xW3meaGVQP43dxJ76zbGD" ' False ) ( C1 (' MetaCons "TxOutFromInput" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( TxIn crypto))) :+: C1 (' MetaCons "TxOutFromOutput" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TxIx )))

data TranslationError crypto Source #

Instances

Instances details
Eq ( TranslationError crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

Show ( TranslationError crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

Generic ( TranslationError crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

Associated Types

type Rep ( TranslationError crypto) :: Type -> Type Source #

Crypto crypto => ToCBOR ( TranslationError crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

Crypto crypto => FromCBOR ( TranslationError crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

NoThunks ( TranslationError crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

type Rep ( TranslationError crypto) Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

type Rep ( TranslationError crypto) = D1 (' MetaData "TranslationError" "Cardano.Ledger.Alonzo.TxInfo" "cardano-ledger-alonzo-0.1.0.0-xW3meaGVQP43dxJ76zbGD" ' False ) ((( C1 (' MetaCons "ByronTxOutInContext" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( TxOutSource crypto))) :+: C1 (' MetaCons "TranslationLogicMissingInput" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( TxIn crypto)))) :+: ( C1 (' MetaCons "RdmrPtrPointsToNothing" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 RdmrPtr )) :+: C1 (' MetaCons "LanguageNotSupported" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Language )))) :+: (( C1 (' MetaCons "InlineDatumsNotSupported" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( TxOutSource crypto))) :+: C1 (' MetaCons "ReferenceScriptsNotSupported" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( TxOutSource crypto)))) :+: ( C1 (' MetaCons "ReferenceInputsNotSupported" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Set ( TxIn crypto)))) :+: C1 (' MetaCons "TimeTranslationPastHorizon" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Text )))))

txInfoIn :: forall era c i. ( Era era, Value era ~ Value ( Crypto era), HasField "datahash" ( TxOut era) ( StrictMaybe ( SafeHash c i))) => TxIn ( Crypto era) -> TxOut era -> Maybe TxInInfo Source #

Given a TxIn, look it up in the UTxO. If it exists, translate it and return (Just translation). If does not exist in the UTxO, return Nothing.

txInfoOut :: forall era c. ( Era era, Value era ~ Value ( Crypto era), HasField "datahash" ( TxOut era) ( StrictMaybe ( DataHash c))) => TxOut era -> Maybe TxOut Source #

Given a TxOut, translate it and return (Just transalation). It is possible the address part is a Bootstrap Address, in that case return Nothing I.e. don't include Bootstrap Addresses in the answer.

class ExtendedUTxO era where Source #

Where we keep functions that differ from Era to Era but which deal with the extra things in the TxOut (Scripts, DataHash, Datum, etc)

valContext :: VersionedTxInfo -> ScriptPurpose ( Crypto era) -> Data era Source #

valContext pairs transaction data with a script purpose. See figure 22 of the Alonzo specification.

data ScriptResult Source #

Instances

Instances details
Generic ScriptResult Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

Semigroup ScriptResult Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

Monoid ScriptResult Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

NoThunks ScriptResult Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

type Rep ScriptResult Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

data PlutusDebug Source #

Instances

Instances details
Eq PlutusDebug Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

Generic PlutusDebug Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

ToCBOR PlutusDebug Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

FromCBOR PlutusDebug Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

NoThunks PlutusDebug Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

type Rep PlutusDebug Source #
Instance details

Defined in Cardano.Ledger.Alonzo.TxInfo

type Rep PlutusDebug = D1 (' MetaData "PlutusDebug" "Cardano.Ledger.Alonzo.TxInfo" "cardano-ledger-alonzo-0.1.0.0-xW3meaGVQP43dxJ76zbGD" ' False ) ( C1 (' MetaCons "PlutusDebugV1" ' PrefixI ' False ) (( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 CostModel ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ExUnits )) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ShortByteString ) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [ Data ]) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ProtVer )))) :+: C1 (' MetaCons "PlutusDebugV2" ' PrefixI ' False ) (( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 CostModel ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ExUnits )) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ShortByteString ) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [ Data ]) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ProtVer )))))

runPLCScript :: forall era. Show ( Script era) => Proxy era -> ProtVer -> Language -> CostModel -> ShortByteString -> ExUnits -> [ Data ] -> ScriptResult Source #

Run a Plutus Script, given the script and the bounds on resources it is allocated.

explainPlutusFailure :: forall era. Show ( Script era) => Proxy era -> ProtVer -> Language -> ShortByteString -> EvaluationError -> [ Data ] -> CostModel -> ExUnits -> ScriptResult Source #

Explain why a script might fail. Scripts come in two flavors:

  1. with 3 data arguments [data,redeemer,context]
  2. with 2 data arguments [redeemer,context].

It pays to decode the context data into a real context because that provides way more information. But there is no guarantee the context data really can be decoded.

validScript :: ProtVer -> Script era -> Bool Source #

Test that every Alonzo script represents a real Script. Run deepseq to see that there are no infinite computations and that every Plutus Script unflattens into a real PV1.Script

languages :: forall era. ( ExtendedUTxO era, Script era ~ Script era) => Tx era -> UTxO era -> Set ( ScriptHash ( Crypto era)) -> Set Language Source #

Compute the Set of Languages in an era, where Alonzo.Scripts are used