Skip to content

Commit

Permalink
feature(cardano-db-sync): Add HasNewEpochState to all other eras
Browse files Browse the repository at this point in the history
  • Loading branch information
sgillespie committed Apr 29, 2024
1 parent 480e395 commit a76f021
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion cardano-db-sync/src/Cardano/DbSync/Ledger/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,45 @@ instance HasNewEpochState StandardShelley where
hApplyExtLedgerState $
fn (applyNewEpochState' st) :* fn id :* fn id :* fn id :* fn id :* fn id :* Nil

instance HasNewEpochState StandardAllegra where
getNewEpochState st = case ledgerState st of
LedgerStateAllegra allegra -> Just (shelleyLedgerState allegra)
_ -> Nothing

applyNewEpochState st =
hApplyExtLedgerState $
fn id :* fn (applyNewEpochState' st) :* fn id :* fn id :* fn id :* fn id :* Nil

instance HasNewEpochState StandardMary where
getNewEpochState st = case ledgerState st of
LedgerStateMary mary -> Just (shelleyLedgerState mary)
_ -> Nothing

applyNewEpochState st =
hApplyExtLedgerState $
fn id :* fn id :* fn (applyNewEpochState' st) :* fn id :* fn id :* fn id :* Nil

instance HasNewEpochState StandardAlonzo where
getNewEpochState st = case ledgerState st of
LedgerStateAlonzo alonzo -> Just (shelleyLedgerState alonzo)
_ -> Nothing

applyNewEpochState st =
hApplyExtLedgerState $
fn id :* fn id :* fn id :* fn (applyNewEpochState' st) :* fn id :* fn id :* Nil

instance HasNewEpochState StandardBabbage where
getNewEpochState st = case ledgerState st of
LedgerStateBabbage babbage -> Just (shelleyLedgerState babbage)
_ -> Nothing

applyNewEpochState st =
hApplyExtLedgerState $
fn id :* fn id :* fn id :* fn id :* fn (applyNewEpochState' st) :* fn id :* Nil

instance HasNewEpochState StandardConway where
getNewEpochState st = case ledgerState st of
LedgerStateConway shelley -> Just (shelleyLedgerState shelley)
LedgerStateConway conway -> Just (shelleyLedgerState conway)
_ -> Nothing

applyNewEpochState st =
Expand Down

0 comments on commit a76f021

Please sign in to comment.