Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- module Cardano.Ledger.Api.Scripts.Data
- class (Era era, Show (Script era), Eq (Script era), EqRaw (Script era), ToCBOR (Script era), EncCBOR (Script era), DecCBOR (Annotator (Script era)), NoThunks (Script era), SafeToHash (Script era), Eq (NativeScript era), Show (NativeScript era), NFData (NativeScript era), NoThunks (NativeScript era), EncCBOR (NativeScript era), DecCBOR (Annotator (NativeScript era))) ⇒ EraScript era where
- type Script era = (r ∷ Type) | r → era
- type NativeScript era = (r ∷ Type) | r → era
- data ScriptHash c
- scriptPrefixTag ∷ EraScript era ⇒ Script era → ByteString
- upgradeScript ∷ EraScript era ⇒ Script (PreviousEra era) → Script era
- hashScript ∷ EraScript era ⇒ Script era → ScriptHash (EraCrypto era)
- getNativeScript ∷ EraScript era ⇒ Script era → Maybe (NativeScript era)
- validateNativeScript ∷ EraTx era ⇒ Tx era → NativeScript era → Bool
- isNativeScript ∷ EraScript era ⇒ Script era → Bool
- data ValidityInterval = ValidityInterval {}
- class (EraScript era, Eq (PlutusScript era), Ord (PlutusScript era), Show (PlutusScript era), NoThunks (PlutusScript era), NFData (PlutusScript era), SafeToHash (PlutusScript era), Eq (PlutusPurpose AsItem era), Show (PlutusPurpose AsItem era), EncCBOR (PlutusPurpose AsItem era), DecCBOR (PlutusPurpose AsItem era), NoThunks (PlutusPurpose AsItem era), NFData (PlutusPurpose AsItem era), Eq (PlutusPurpose AsIx era), Ord (PlutusPurpose AsIx era), Show (PlutusPurpose AsIx era), EncCBOR (PlutusPurpose AsIx era), DecCBOR (PlutusPurpose AsIx era), EncCBORGroup (PlutusPurpose AsIx era), DecCBORGroup (PlutusPurpose AsIx era), NoThunks (PlutusPurpose AsIx era), NFData (PlutusPurpose AsIx era), Eq (PlutusPurpose AsIxItem era), Show (PlutusPurpose AsIxItem era), NoThunks (PlutusPurpose AsIxItem era), NFData (PlutusPurpose AsIxItem era), AllegraEraScript era) ⇒ AlonzoEraScript era where
- data PlutusScript era
- type PlutusPurpose (f ∷ Type → Type → Type) era = (r ∷ Type) | r → era
- toSpendingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (TxIn (EraCrypto era)))
- toMintingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (PolicyID (EraCrypto era)))
- toCertifyingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (TxCert era))
- toRewardingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (RewardAccount (EraCrypto era)))
- isPlutusScript ∷ AlonzoEraScript era ⇒ Script era → Bool
- pattern SpendingPurpose ∷ AlonzoEraScript era ⇒ f Word32 (TxIn (EraCrypto era)) → PlutusPurpose f era
- pattern MintingPurpose ∷ AlonzoEraScript era ⇒ f Word32 (PolicyID (EraCrypto era)) → PlutusPurpose f era
- pattern CertifyingPurpose ∷ AlonzoEraScript era ⇒ f Word32 (TxCert era) → PlutusPurpose f era
- pattern RewardingPurpose ∷ AlonzoEraScript era ⇒ f Word32 (RewardAccount (EraCrypto era)) → PlutusPurpose f era
- data CostModels
- class AlonzoEraScript era ⇒ ConwayEraScript era where
- toVotingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (Voter (EraCrypto era)))
- toProposingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (ProposalProcedure era))
- pattern VotingPurpose ∷ ConwayEraScript era ⇒ f Word32 (Voter (EraCrypto era)) → PlutusPurpose f era
- pattern ProposingPurpose ∷ ConwayEraScript era ⇒ f Word32 (ProposalProcedure era) → PlutusPurpose f era
Documentation
class (Era era, Show (Script era), Eq (Script era), EqRaw (Script era), ToCBOR (Script era), EncCBOR (Script era), DecCBOR (Annotator (Script era)), NoThunks (Script era), SafeToHash (Script era), Eq (NativeScript era), Show (NativeScript era), NFData (NativeScript era), NoThunks (NativeScript era), EncCBOR (NativeScript era), DecCBOR (Annotator (NativeScript era))) ⇒ EraScript era Source #
Typeclass for script data types. Allows for script validation and hashing.
You must understand the role of SafeToHash and scriptPrefixTag to make new
instances. scriptPrefixTag
is a magic number representing the tag of the
script language. For each new script language defined, a new tag is chosen
and the tag is included in the script hash for a script. The safeToHash
constraint ensures that Scripts are never reserialised.
data ScriptHash c Source #
Instances
scriptPrefixTag ∷ EraScript era ⇒ Script era → ByteString Source #
upgradeScript ∷ EraScript era ⇒ Script (PreviousEra era) → Script era Source #
Every era, except Shelley, must be able to upgrade a Script
from a previous era.
Warning - Important to note that any memoized binary representation will not be
preserved, you need to retain underlying bytes you can use translateEraThroughCBOR
hashScript ∷ EraScript era ⇒ Script era → ScriptHash (EraCrypto era) Source #
Compute ScriptHash
of a Script
for a particular era.
getNativeScript ∷ EraScript era ⇒ Script era → Maybe (NativeScript era) Source #
validateNativeScript ∷ EraTx era ⇒ Tx era → NativeScript era → Bool Source #
Using information from the transaction validate the supplied native script.
data ValidityInterval Source #
ValidityInterval is a half open interval. Closed on the bottom, open on the top. A SNothing on the bottom is negative infinity, and a SNothing on the top is positive infinity
Instances
Alonzo
class (EraScript era, Eq (PlutusScript era), Ord (PlutusScript era), Show (PlutusScript era), NoThunks (PlutusScript era), NFData (PlutusScript era), SafeToHash (PlutusScript era), Eq (PlutusPurpose AsItem era), Show (PlutusPurpose AsItem era), EncCBOR (PlutusPurpose AsItem era), DecCBOR (PlutusPurpose AsItem era), NoThunks (PlutusPurpose AsItem era), NFData (PlutusPurpose AsItem era), Eq (PlutusPurpose AsIx era), Ord (PlutusPurpose AsIx era), Show (PlutusPurpose AsIx era), EncCBOR (PlutusPurpose AsIx era), DecCBOR (PlutusPurpose AsIx era), EncCBORGroup (PlutusPurpose AsIx era), DecCBORGroup (PlutusPurpose AsIx era), NoThunks (PlutusPurpose AsIx era), NFData (PlutusPurpose AsIx era), Eq (PlutusPurpose AsIxItem era), Show (PlutusPurpose AsIxItem era), NoThunks (PlutusPurpose AsIxItem era), NFData (PlutusPurpose AsIxItem era), AllegraEraScript era) ⇒ AlonzoEraScript era where Source #
eraMaxLanguage, mkPlutusScript, withPlutusScript, hoistPlutusPurpose, mkSpendingPurpose, toSpendingPurpose, mkMintingPurpose, toMintingPurpose, mkCertifyingPurpose, toCertifyingPurpose, mkRewardingPurpose, toRewardingPurpose, upgradePlutusPurposeAsIx
data PlutusScript era Source #
type PlutusPurpose (f ∷ Type → Type → Type) era = (r ∷ Type) | r → era Source #
toSpendingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (TxIn (EraCrypto era))) Source #
toMintingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (PolicyID (EraCrypto era))) Source #
toCertifyingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (TxCert era)) Source #
toRewardingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (RewardAccount (EraCrypto era))) Source #
Instances
isPlutusScript ∷ AlonzoEraScript era ⇒ Script era → Bool Source #
pattern SpendingPurpose ∷ AlonzoEraScript era ⇒ f Word32 (TxIn (EraCrypto era)) → PlutusPurpose f era Source #
pattern MintingPurpose ∷ AlonzoEraScript era ⇒ f Word32 (PolicyID (EraCrypto era)) → PlutusPurpose f era Source #
pattern CertifyingPurpose ∷ AlonzoEraScript era ⇒ f Word32 (TxCert era) → PlutusPurpose f era Source #
pattern RewardingPurpose ∷ AlonzoEraScript era ⇒ f Word32 (RewardAccount (EraCrypto era)) → PlutusPurpose f era Source #
data CostModels Source #
For a known version of Plutus, attempting to construct a cost model with
too few parameters (depending on the version) will result in an error.
CostModelApplyError
exists to collect these errors in the CostModels
type.
The CostModels
type itself needs to be flexible enough to accept any map
of Word8
to '[Int64]', so that cost models can be placed in the protocol parameters
ahead of changes to the Plutus evaluation context. In this way, serializing a cost model,
updating software, and deserializing can result in errors going away.
Additionally, CostModels
needs to be able to store cost models for future version
of Plutus, which we cannot yet even validate. These are stored in
costModelsUnknown
.
Instances
Conway
class AlonzoEraScript era ⇒ ConwayEraScript era where Source #
toVotingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (Voter (EraCrypto era))) Source #
toProposingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (ProposalProcedure era)) Source #
Instances
Crypto c ⇒ ConwayEraScript (ConwayEra c) | |
Defined in Cardano.Ledger.Conway.Scripts mkVotingPurpose ∷ f Word32 (Voter (EraCrypto (ConwayEra c))) → PlutusPurpose f (ConwayEra c) Source # toVotingPurpose ∷ PlutusPurpose f (ConwayEra c) → Maybe (f Word32 (Voter (EraCrypto (ConwayEra c)))) Source # mkProposingPurpose ∷ f Word32 (ProposalProcedure (ConwayEra c)) → PlutusPurpose f (ConwayEra c) Source # toProposingPurpose ∷ PlutusPurpose f (ConwayEra c) → Maybe (f Word32 (ProposalProcedure (ConwayEra c))) Source # |
pattern VotingPurpose ∷ ConwayEraScript era ⇒ f Word32 (Voter (EraCrypto era)) → PlutusPurpose f era Source #
pattern ProposingPurpose ∷ ConwayEraScript era ⇒ f Word32 (ProposalProcedure era) → PlutusPurpose f era Source #