Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle plutus related ledger events in Conway #650

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading