Skip to content

Commit

Permalink
[alonzo] - AlonzoScript
Browse files Browse the repository at this point in the history
  • Loading branch information
teodanciu committed Jan 28, 2025
1 parent 37df284 commit e16f4f5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Scripts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,18 @@ instance AlonzoEraScript era => DecCBOR (Annotator (AlonzoScript era)) where
{-# INLINE decodeScript #-}
{-# INLINE decCBOR #-}

instance AlonzoEraScript era => DecCBOR (AlonzoScript era) where
decCBOR = decode (Summands "AlonzoScript" decodeScript)
where
decodeScript = \case
0 -> SumD TimelockScript <! From
1 -> decodePlutus SPlutusV1
2 -> decodePlutus SPlutusV2
3 -> decodePlutus SPlutusV3
n -> Invalid n
decodePlutus slang =
SumD PlutusScript <! D (decodePlutusScript slang)

-- | 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
-- `Cardano.Ledger.Plutus.Language.PlutusRunnable`.
Expand Down

0 comments on commit e16f4f5

Please sign in to comment.