| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Ledger.Allegra.Scripts
Contents
Synopsis
- class ShelleyEraScript era ⇒ AllegraEraScript era where
- mkTimeStart ∷ SlotNo → NativeScript era
- getTimeStart ∷ NativeScript era → Maybe SlotNo
- mkTimeExpire ∷ SlotNo → NativeScript era
- getTimeExpire ∷ NativeScript era → Maybe SlotNo
- mkRequireSignatureTimelock ∷ Era era ⇒ KeyHash 'Witness → Timelock era
- getRequireSignatureTimelock ∷ ∀ {k} (era ∷ k). Timelock era → Maybe (KeyHash 'Witness)
- mkRequireAllOfTimelock ∷ Era era ⇒ StrictSeq (Timelock era) → Timelock era
- getRequireAllOfTimelock ∷ ∀ {k} (era ∷ k). Timelock era → Maybe (StrictSeq (Timelock era))
- mkRequireAnyOfTimelock ∷ Era era ⇒ StrictSeq (Timelock era) → Timelock era
- getRequireAnyOfTimelock ∷ ∀ {k} (era ∷ k). Timelock era → Maybe (StrictSeq (Timelock era))
- mkRequireMOfTimelock ∷ Era era ⇒ Int → StrictSeq (Timelock era) → Timelock era
- getRequireMOfTimelock ∷ ∀ {k} (era ∷ k). Timelock era → Maybe (Int, StrictSeq (Timelock era))
- mkTimeStartTimelock ∷ Era era ⇒ SlotNo → Timelock era
- getTimeStartTimelock ∷ ∀ {k} (era ∷ k). Timelock era → Maybe SlotNo
- mkTimeExpireTimelock ∷ Era era ⇒ SlotNo → Timelock era
- getTimeExpireTimelock ∷ ∀ {k} (era ∷ k). Timelock era → Maybe SlotNo
- newtype Timelock (era ∷ k) = MkTimelock (MemoBytes (TimelockRaw era))
- pattern RequireTimeExpire ∷ AllegraEraScript era ⇒ SlotNo → NativeScript era
- pattern RequireTimeStart ∷ AllegraEraScript era ⇒ SlotNo → NativeScript era
- data TimelockRaw (era ∷ k)
- = TimelockSignature !(KeyHash 'Witness)
- | TimelockAllOf !(StrictSeq (Timelock era))
- | TimelockAnyOf !(StrictSeq (Timelock era))
- | TimelockMOf !Int !(StrictSeq (Timelock era))
- | TimelockTimeStart !SlotNo
- | TimelockTimeExpire !SlotNo
- inInterval ∷ SlotNo → ValidityInterval → Bool
- showTimelock ∷ AllegraEraScript era ⇒ NativeScript era → String
- evalTimelock ∷ (AllegraEraScript era, NativeScript era ~ Timelock era) ⇒ Set (KeyHash 'Witness) → ValidityInterval → NativeScript era → Bool
- eqTimelockRaw ∷ ∀ {k} (era ∷ k). Timelock era → Timelock era → Bool
- data ValidityInterval = ValidityInterval {}
- encodeVI ∷ ValidityInterval → Encode ('Closed 'Dense) ValidityInterval
- decodeVI ∷ Decode ('Closed 'Dense) ValidityInterval
- translateTimelock ∷ (Era era1, Era era2) ⇒ Timelock era1 → Timelock era2
- upgradeMultiSig ∷ NativeScript ShelleyEra → NativeScript AllegraEra
- lteNegInfty ∷ SlotNo → StrictMaybe SlotNo → Bool
- ltePosInfty ∷ StrictMaybe SlotNo → SlotNo → Bool
- invalidBeforeL ∷ Lens' ValidityInterval (StrictMaybe SlotNo)
- invalidHereAfterL ∷ Lens' ValidityInterval (StrictMaybe SlotNo)
Documentation
class ShelleyEraScript era ⇒ AllegraEraScript era where Source #
Methods
mkTimeStart ∷ SlotNo → NativeScript era Source #
getTimeStart ∷ NativeScript era → Maybe SlotNo Source #
mkTimeExpire ∷ SlotNo → NativeScript era Source #
getTimeExpire ∷ NativeScript era → Maybe SlotNo Source #
Instances
getRequireMOfTimelock ∷ ∀ {k} (era ∷ k). Timelock era → Maybe (Int, StrictSeq (Timelock era)) Source #
newtype Timelock (era ∷ k) Source #
Constructors
| MkTimelock (MemoBytes (TimelockRaw era)) |
Instances
pattern RequireTimeExpire ∷ AllegraEraScript era ⇒ SlotNo → NativeScript era Source #
pattern RequireTimeStart ∷ AllegraEraScript era ⇒ SlotNo → NativeScript era Source #
data TimelockRaw (era ∷ k) Source #
Constructors
| TimelockSignature !(KeyHash 'Witness) | |
| TimelockAllOf !(StrictSeq (Timelock era)) | |
| TimelockAnyOf !(StrictSeq (Timelock era)) | |
| TimelockMOf !Int !(StrictSeq (Timelock era)) | |
| TimelockTimeStart !SlotNo | |
| TimelockTimeExpire !SlotNo |
Instances
| Era era ⇒ DecCBOR (Annotator (TimelockRaw era)) Source # | |||||
| Era era ⇒ EncCBOR (TimelockRaw era) Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Methods encCBOR ∷ TimelockRaw era → Encoding Source # | |||||
| NFData (TimelockRaw era) Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Methods rnf ∷ TimelockRaw era → () # | |||||
| Generic (TimelockRaw era) Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Associated Types
Methods from ∷ TimelockRaw era → Rep (TimelockRaw era) x # to ∷ Rep (TimelockRaw era) x → TimelockRaw era # | |||||
| Show (TimelockRaw era) Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Methods showsPrec ∷ Int → TimelockRaw era → ShowS # show ∷ TimelockRaw era → String # showList ∷ [TimelockRaw era] → ShowS # | |||||
| Eq (TimelockRaw era) Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Methods (==) ∷ TimelockRaw era → TimelockRaw era → Bool # (/=) ∷ TimelockRaw era → TimelockRaw era → Bool # | |||||
| Era era ⇒ NoThunks (TimelockRaw era) Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts | |||||
| type Rep (TimelockRaw era) Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts type Rep (TimelockRaw era) = D1 ('MetaData "TimelockRaw" "Cardano.Ledger.Allegra.Scripts" "cardano-ledger-allegra-1.9.0.0-inplace" 'False) ((C1 ('MetaCons "TimelockSignature" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'Witness))) :+: (C1 ('MetaCons "TimelockAllOf" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictSeq (Timelock era)))) :+: C1 ('MetaCons "TimelockAnyOf" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictSeq (Timelock era)))))) :+: (C1 ('MetaCons "TimelockMOf" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictSeq (Timelock era)))) :+: (C1 ('MetaCons "TimelockTimeStart" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo)) :+: C1 ('MetaCons "TimelockTimeExpire" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SlotNo))))) | |||||
inInterval ∷ SlotNo → ValidityInterval → Bool Source #
Test if a slot is in the Validity interval. Recall that a ValidityInterval is a half Open interval, that is why we use (slot < top)
showTimelock ∷ AllegraEraScript era ⇒ NativeScript era → String Source #
evalTimelock ∷ (AllegraEraScript era, NativeScript era ~ Timelock era) ⇒ Set (KeyHash 'Witness) → ValidityInterval → NativeScript era → Bool Source #
eqTimelockRaw ∷ ∀ {k} (era ∷ k). Timelock era → Timelock 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.
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
Constructors
| ValidityInterval | |
Fields | |
Instances
| ToJSON ValidityInterval Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Methods toJSON ∷ ValidityInterval → Value Source # toEncoding ∷ ValidityInterval → Encoding Source # toJSONList ∷ [ValidityInterval] → Value Source # | |||||
| DecCBOR ValidityInterval Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts | |||||
| EncCBOR ValidityInterval Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Methods | |||||
| NFData ValidityInterval Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Methods rnf ∷ ValidityInterval → () # | |||||
| Generic ValidityInterval Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Associated Types
Methods from ∷ ValidityInterval → Rep ValidityInterval x # to ∷ Rep ValidityInterval x → ValidityInterval # | |||||
| Show ValidityInterval Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Methods showsPrec ∷ Int → ValidityInterval → ShowS # show ∷ ValidityInterval → String # showList ∷ [ValidityInterval] → ShowS # | |||||
| Eq ValidityInterval Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Methods | |||||
| Ord ValidityInterval Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts Methods compare ∷ ValidityInterval → ValidityInterval → Ordering # (<) ∷ ValidityInterval → ValidityInterval → Bool # (<=) ∷ ValidityInterval → ValidityInterval → Bool # (>) ∷ ValidityInterval → ValidityInterval → Bool # (>=) ∷ ValidityInterval → ValidityInterval → Bool # max ∷ ValidityInterval → ValidityInterval → ValidityInterval # min ∷ ValidityInterval → ValidityInterval → ValidityInterval # | |||||
| NoThunks ValidityInterval Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts | |||||
| type Rep ValidityInterval Source # | |||||
Defined in Cardano.Ledger.Allegra.Scripts type Rep ValidityInterval = D1 ('MetaData "ValidityInterval" "Cardano.Ledger.Allegra.Scripts" "cardano-ledger-allegra-1.9.0.0-inplace" 'False) (C1 ('MetaCons "ValidityInterval" 'PrefixI 'True) (S1 ('MetaSel ('Just "invalidBefore") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictMaybe SlotNo)) :*: S1 ('MetaSel ('Just "invalidHereafter") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictMaybe SlotNo)))) | |||||
translateTimelock ∷ (Era era1, Era era2) ⇒ Timelock era1 → Timelock era2 Source #
This function deconstructs and then reconstructs the timelock script to prove the compiler that we can arbirarily switch out the eras as long as the cryptos for both eras are the same.
lteNegInfty ∷ SlotNo → StrictMaybe SlotNo → Bool Source #
less-than-equal comparison, where Nothing is negative infinity
ltePosInfty ∷ StrictMaybe SlotNo → SlotNo → Bool Source #
less-than-equal comparison, where Nothing is positive infinity
invalidBeforeL ∷ Lens' ValidityInterval (StrictMaybe SlotNo) Source #
Lens to access the invalidBefore field of a ValidityInterval as a 'StrictMaybe SlotNo'.
invalidHereAfterL ∷ Lens' ValidityInterval (StrictMaybe SlotNo) Source #
Lens to access the invalidHereAfter field of a ValidityInterval as a 'StrictMaybe SlotNo'.
Orphan instances
| EraScript AllegraEra Source # | Since Timelock scripts are a strictly backwards compatible extension of
MultiSig scripts, we can use the same | ||||||||
Associated Types
| |||||||||
| ShelleyEraScript AllegraEra Source # | |||||||||
Methods mkRequireSignature ∷ KeyHash 'Witness → NativeScript AllegraEra Source # getRequireSignature ∷ NativeScript AllegraEra → Maybe (KeyHash 'Witness) Source # mkRequireAllOf ∷ StrictSeq (NativeScript AllegraEra) → NativeScript AllegraEra Source # getRequireAllOf ∷ NativeScript AllegraEra → Maybe (StrictSeq (NativeScript AllegraEra)) Source # mkRequireAnyOf ∷ StrictSeq (NativeScript AllegraEra) → NativeScript AllegraEra Source # getRequireAnyOf ∷ NativeScript AllegraEra → Maybe (StrictSeq (NativeScript AllegraEra)) Source # mkRequireMOf ∷ Int → StrictSeq (NativeScript AllegraEra) → NativeScript AllegraEra Source # getRequireMOf ∷ NativeScript AllegraEra → Maybe (Int, StrictSeq (NativeScript AllegraEra)) Source # | |||||||||