Skip to content

Commit

Permalink
Merge pull request #650 from IntersectMBO/jordan/enable-conway-ledger…
Browse files Browse the repository at this point in the history
…-events

Handle plutus related ledger events in Conway
  • Loading branch information
Jimbo4350 authored Oct 7, 2024
2 parents 00f025d + 9deea90 commit 649a698
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ toLedgerEventConway evt =
ShelleyLedgerEventBBODY
(ShelleyInAlonzoEvent (LedgersEvent (Shelley.LedgerEvent conwayLedgerEvent))) ->
case conwayLedgerEvent of
Conway.UtxowEvent{} -> Nothing
Conway.UtxowEvent utxowEvent -> handleConwayUTxOWEvent utxowEvent
Conway.CertsEvent{} -> Nothing
Conway.GovEvent govEvent ->
case govEvent of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ handleShelleyLEDGEREvents
=> Shelley.ShelleyLedgerEvent ledgerera -> Maybe LedgerEvent
handleShelleyLEDGEREvents ledgerEvent =
case ledgerEvent of
Shelley.UtxowEvent e -> handleAlonzoOnwardsUTxOWEvent e
Shelley.UtxowEvent e -> handleAlonzoUTxOWEvent e
Shelley.DelegsEvent e -> handleShelleyDELEGSEvent e
19 changes: 16 additions & 3 deletions cardano-api/internal/Cardano/Api/LedgerEvents/Rule/BBODY/UTXOW.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}

module Cardano.Api.LedgerEvents.Rule.BBODY.UTXOW
( handleAlonzoOnwardsUTxOWEvent
( handleAlonzoUTxOWEvent
, handleAllegraMaryUTxOWEvent
, handleConwayUTxOWEvent
, handlePreAlonzoUTxOWEvent
)
where
Expand All @@ -15,18 +17,29 @@ import qualified Cardano.Ledger.Allegra.Rules as Allegra
import Cardano.Ledger.Alonzo.Rules (AlonzoUtxoEvent (..), AlonzoUtxosEvent (..),
AlonzoUtxowEvent (..))
import qualified Cardano.Ledger.Alonzo.Rules as Alonzo
import Cardano.Ledger.Conway
import qualified Cardano.Ledger.Conway.Rules as Conway
import qualified Cardano.Ledger.Core as Ledger.Core
import qualified Cardano.Ledger.Crypto as Crypto
import qualified Cardano.Ledger.Shelley.Rules as Shelley

import Control.State.Transition.Extended

handleAlonzoOnwardsUTxOWEvent
handleConwayUTxOWEvent
:: AlonzoUtxowEvent (ConwayEra Crypto.StandardCrypto) -> Maybe LedgerEvent
handleConwayUTxOWEvent (Alonzo.WrappedShelleyEraEvent (Shelley.UtxoEvent (Alonzo.UtxosEvent conwayUTxOsEvent))) =
case conwayUTxOsEvent of
Conway.TotalDeposits{} -> Nothing
Conway.SuccessfulPlutusScriptsEvent e -> Just $ SuccessfulPlutusScript e
Conway.FailedPlutusScriptsEvent e -> Just $ FailedPlutusScript e
Conway.TxUTxODiff _ _ -> Nothing

handleAlonzoUTxOWEvent
:: Event (Ledger.Core.EraRule "UTXO" ledgerera) ~ AlonzoUtxoEvent ledgerera
=> Event (Ledger.Core.EraRule "UTXOS" ledgerera) ~ AlonzoUtxosEvent ledgerera
=> Ledger.Core.EraCrypto ledgerera ~ Crypto.StandardCrypto
=> AlonzoUtxowEvent ledgerera -> Maybe LedgerEvent
handleAlonzoOnwardsUTxOWEvent (WrappedShelleyEraEvent (Shelley.UtxoEvent (UtxosEvent utxoEvent))) =
handleAlonzoUTxOWEvent (WrappedShelleyEraEvent (Shelley.UtxoEvent (UtxosEvent utxoEvent))) =
case utxoEvent of
Alonzo.AlonzoPpupToUtxosEvent{} -> Nothing
Alonzo.TotalDeposits{} -> Nothing
Expand Down

0 comments on commit 649a698

Please sign in to comment.