Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype PlutusBinary = PlutusBinary {}
- data AlonzoScript era
- = TimelockScript !(Timelock era)
- | PlutusScript !(PlutusScript era)
- type family Script era = (r ∷ Type) | r → era
- isPlutusScript ∷ AlonzoEraScript era ⇒ Script era → Bool
- validScript ∷ (HasCallStack, AlonzoEraScript era) ⇒ ProtVer → Script era → Bool
- eqAlonzoScriptRaw ∷ Eq (PlutusScript era) ⇒ AlonzoScript era → AlonzoScript era → Bool
- 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
- type PlutusPurpose (f ∷ Type → Type → Type) era = (r ∷ Type) | r → era
- eraMaxLanguage ∷ Language
- toPlutusScript ∷ Script era → Maybe (PlutusScript era)
- fromPlutusScript ∷ PlutusScript era → Script era
- mkPlutusScript ∷ PlutusLanguage l ⇒ Plutus l → Maybe (PlutusScript era)
- withPlutusScript ∷ PlutusScript era → (∀ l. PlutusLanguage l ⇒ Plutus l → a) → a
- hoistPlutusPurpose ∷ (∀ ix it. g ix it → f ix it) → PlutusPurpose g era → PlutusPurpose f era
- mkSpendingPurpose ∷ f Word32 TxIn → PlutusPurpose f era
- toSpendingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 TxIn)
- mkMintingPurpose ∷ f Word32 PolicyID → PlutusPurpose f era
- toMintingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 PolicyID)
- mkCertifyingPurpose ∷ f Word32 (TxCert era) → PlutusPurpose f era
- toCertifyingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (TxCert era))
- mkRewardingPurpose ∷ f Word32 RewardAccount → PlutusPurpose f era
- toRewardingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 RewardAccount)
- upgradePlutusPurposeAsIx ∷ AlonzoEraScript (PreviousEra era) ⇒ PlutusPurpose AsIx (PreviousEra era) → PlutusPurpose AsIx era
- eraLanguages ∷ ∀ era. AlonzoEraScript era ⇒ [Language]
- withPlutusScriptLanguage ∷ AlonzoEraScript era ⇒ Language → PlutusScript era → (∀ l. PlutusLanguage l ⇒ Plutus l → a) → Maybe a
- plutusScriptLanguage ∷ AlonzoEraScript era ⇒ PlutusScript era → Language
- decodePlutusScript ∷ ∀ era l s. (AlonzoEraScript era, PlutusLanguage l) ⇒ SLanguage l → Decoder s (PlutusScript era)
- plutusScriptBinary ∷ AlonzoEraScript era ⇒ PlutusScript era → PlutusBinary
- mkBinaryPlutusScript ∷ AlonzoEraScript era ⇒ Language → PlutusBinary → Maybe (PlutusScript era)
- isValidPlutusScript ∷ AlonzoEraScript era ⇒ Version → PlutusScript era → Bool
- toPlutusSLanguage ∷ ∀ l era. (PlutusLanguage l, AlonzoEraScript era) ⇒ SLanguage l → PlutusScript era → Maybe (Plutus l)
- alonzoScriptPrefixTag ∷ (AlonzoEraScript era, AlonzoScript era ~ Script era) ⇒ Script era → ByteString
- lookupPlutusScript ∷ AlonzoEraScript era ⇒ ScriptHash → Map ScriptHash (Script era) → Maybe (PlutusScript era)
- pattern SpendingPurpose ∷ AlonzoEraScript era ⇒ f Word32 TxIn → PlutusPurpose f era
- pattern MintingPurpose ∷ AlonzoEraScript era ⇒ f Word32 PolicyID → PlutusPurpose f era
- pattern CertifyingPurpose ∷ AlonzoEraScript era ⇒ f Word32 (TxCert era) → PlutusPurpose f era
- pattern RewardingPurpose ∷ AlonzoEraScript era ⇒ f Word32 RewardAccount → PlutusPurpose f era
- data AlonzoPlutusPurpose f era
- = AlonzoSpending !(f Word32 TxIn)
- | AlonzoMinting !(f Word32 PolicyID)
- | AlonzoCertifying !(f Word32 (TxCert era))
- | AlonzoRewarding !(f Word32 RewardAccount)
- newtype AsItem ix it = AsItem {
- unAsItem ∷ it
- newtype AsIx ix it = AsIx {
- unAsIx ∷ ix
- data AsIxItem ix it = AsIxItem {}
- toAsItem ∷ AsIxItem ix it → AsItem ix it
- toAsIx ∷ AsIxItem ix it → AsIx ix it
- module Cardano.Ledger.Plutus.CostModels
- module Cardano.Ledger.Plutus.ExUnits
Documentation
newtype PlutusBinary Source #
Binary representation of a Plutus script.
Instances
data AlonzoScript era Source #
Scripts in the Alonzo Era, Either a Timelock script or a Plutus script.
TimelockScript !(Timelock era) | |
PlutusScript !(PlutusScript era) |
Instances
type family Script era = (r ∷ Type) | r → era Source #
Scripts which may lock transaction outputs in this era
Instances
type Script AllegraEra | |
Defined in Cardano.Ledger.Allegra.Scripts | |
type Script AlonzoEra Source # | |
Defined in Cardano.Ledger.Alonzo.Scripts | |
type Script MaryEra | |
Defined in Cardano.Ledger.Mary.Scripts | |
type Script ShelleyEra | |
Defined in Cardano.Ledger.Shelley.Scripts |
isPlutusScript ∷ AlonzoEraScript era ⇒ Script era → Bool Source #
validScript ∷ (HasCallStack, AlonzoEraScript era) ⇒ ProtVer → Script era → Bool Source #
Verify that every Script
represents a valid script. Force native scripts to Normal
Form, to ensure that there are no bottoms and deserialize Plutus
scripts into a
PlutusRunnable
.
eqAlonzoScriptRaw ∷ Eq (PlutusScript era) ⇒ AlonzoScript era → AlonzoScript era → Bool Source #
Check the equality of two underlying types, while ignoring their binary
representation, which Eq
instance normally does. This is used for testing.
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 ∷ Type Source #
type PlutusPurpose (f ∷ Type → Type → Type) era = (r ∷ Type) | r → era Source #
eraMaxLanguage ∷ Language Source #
Highest supported Plutus language version for this era.
toPlutusScript ∷ Script era → Maybe (PlutusScript era) Source #
Attempt to extract a AlonzoEraScript
from a wrapper type family Script
. Whenevr
Script
is a native script Nothing
will be returned
default toPlutusScript ∷ Script era ~ AlonzoScript era ⇒ Script era → Maybe (PlutusScript era) Source #
fromPlutusScript ∷ PlutusScript era → Script era Source #
Convert a AlonzoEraScript
to a wrapper type family Script
default fromPlutusScript ∷ Script era ~ AlonzoScript era ⇒ PlutusScript era → Script era Source #
mkPlutusScript ∷ PlutusLanguage l ⇒ Plutus l → Maybe (PlutusScript era) Source #
Returns Nothing, whenver plutus language is not supported for this era.
withPlutusScript ∷ PlutusScript era → (∀ l. PlutusLanguage l ⇒ Plutus l → a) → a Source #
Give a AlonzoEraScript
apply a function that can handle Plutus
scripts of all
known versions.
hoistPlutusPurpose ∷ (∀ ix it. g ix it → f ix it) → PlutusPurpose g era → PlutusPurpose f era Source #
mkSpendingPurpose ∷ f Word32 TxIn → PlutusPurpose f era Source #
toSpendingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 TxIn) Source #
mkMintingPurpose ∷ f Word32 PolicyID → PlutusPurpose f era Source #
toMintingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 PolicyID) Source #
mkCertifyingPurpose ∷ f Word32 (TxCert era) → PlutusPurpose f era Source #
toCertifyingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 (TxCert era)) Source #
mkRewardingPurpose ∷ f Word32 RewardAccount → PlutusPurpose f era Source #
toRewardingPurpose ∷ PlutusPurpose f era → Maybe (f Word32 RewardAccount) Source #
upgradePlutusPurposeAsIx ∷ AlonzoEraScript (PreviousEra era) ⇒ PlutusPurpose AsIx (PreviousEra era) → PlutusPurpose AsIx era Source #
Instances
eraLanguages ∷ ∀ era. AlonzoEraScript era ⇒ [Language] Source #
withPlutusScriptLanguage ∷ AlonzoEraScript era ⇒ Language → PlutusScript era → (∀ l. PlutusLanguage l ⇒ Plutus l → a) → Maybe a Source #
Apply a function to a plutus script, but only if it is of expected language version, otherwise it will return Nothing.
plutusScriptLanguage ∷ AlonzoEraScript era ⇒ PlutusScript era → Language Source #
Get value level plutus language of the plutus script
decodePlutusScript ∷ ∀ era l s. (AlonzoEraScript era, PlutusLanguage l) ⇒ SLanguage l → Decoder s (PlutusScript era) Source #
plutusScriptBinary ∷ AlonzoEraScript era ⇒ PlutusScript era → PlutusBinary Source #
Extract binary representation of the script.
mkBinaryPlutusScript ∷ AlonzoEraScript era ⇒ Language → PlutusBinary → Maybe (PlutusScript era) Source #
isValidPlutusScript ∷ AlonzoEraScript era ⇒ Version → PlutusScript era → Bool Source #
Verifies whether Plutus script is well formed or not, which simply means whether it deserializes successfully or not.
toPlutusSLanguage ∷ ∀ l era. (PlutusLanguage l, AlonzoEraScript era) ⇒ SLanguage l → PlutusScript era → Maybe (Plutus l) Source #
Attempt to extract the version aware Plutus
script, but only if it matches the
language version supplied. This is useful whenever the version is known by some other
means.
alonzoScriptPrefixTag ∷ (AlonzoEraScript era, AlonzoScript era ~ Script era) ⇒ Script era → ByteString Source #
lookupPlutusScript ∷ AlonzoEraScript era ⇒ ScriptHash → Map ScriptHash (Script era) → Maybe (PlutusScript era) Source #
Having a Map with scripts and a script hash, lookup the plutus script. Returns Nothing when script is missing or it is not a PlutusScript
Plutus Purpose
pattern SpendingPurpose ∷ AlonzoEraScript era ⇒ f Word32 TxIn → PlutusPurpose f era Source #
pattern MintingPurpose ∷ AlonzoEraScript era ⇒ f Word32 PolicyID → PlutusPurpose f era Source #
pattern CertifyingPurpose ∷ AlonzoEraScript era ⇒ f Word32 (TxCert era) → PlutusPurpose f era Source #
pattern RewardingPurpose ∷ AlonzoEraScript era ⇒ f Word32 RewardAccount → PlutusPurpose f era Source #
data AlonzoPlutusPurpose f era Source #
AlonzoSpending !(f Word32 TxIn) | |
AlonzoMinting !(f Word32 PolicyID) | |
AlonzoCertifying !(f Word32 (TxCert era)) | |
AlonzoRewarding !(f Word32 RewardAccount) |