{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Ledger.Babbage.Transition (TransitionConfig (..)) where

import Cardano.Ledger.Alonzo
import Cardano.Ledger.Alonzo.Transition
import Cardano.Ledger.Babbage.Era
import Cardano.Ledger.Babbage.Translation ()
import Cardano.Ledger.Crypto
import Cardano.Ledger.Genesis (NoGenesis (..))
import Cardano.Ledger.Shelley.Transition
import Data.Aeson (FromJSON (..), ToJSON (..))
import Lens.Micro
import NoThunks.Class (NoThunks (..))

instance Crypto c => EraTransition (BabbageEra c) where
  newtype TransitionConfig (BabbageEra c) = BabbageTransitionConfig
    { forall c.
TransitionConfig (BabbageEra c) -> TransitionConfig (AlonzoEra c)
btcAlonzoTransitionConfig :: TransitionConfig (AlonzoEra c)
    }
    deriving (Int -> TransitionConfig (BabbageEra c) -> ShowS
forall c.
Crypto c =>
Int -> TransitionConfig (BabbageEra c) -> ShowS
forall c. Crypto c => [TransitionConfig (BabbageEra c)] -> ShowS
forall c. Crypto c => TransitionConfig (BabbageEra c) -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransitionConfig (BabbageEra c)] -> ShowS
$cshowList :: forall c. Crypto c => [TransitionConfig (BabbageEra c)] -> ShowS
show :: TransitionConfig (BabbageEra c) -> String
$cshow :: forall c. Crypto c => TransitionConfig (BabbageEra c) -> String
showsPrec :: Int -> TransitionConfig (BabbageEra c) -> ShowS
$cshowsPrec :: forall c.
Crypto c =>
Int -> TransitionConfig (BabbageEra c) -> ShowS
Show, TransitionConfig (BabbageEra c)
-> TransitionConfig (BabbageEra c) -> Bool
forall c.
Crypto c =>
TransitionConfig (BabbageEra c)
-> TransitionConfig (BabbageEra c) -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransitionConfig (BabbageEra c)
-> TransitionConfig (BabbageEra c) -> Bool
$c/= :: forall c.
Crypto c =>
TransitionConfig (BabbageEra c)
-> TransitionConfig (BabbageEra c) -> Bool
== :: TransitionConfig (BabbageEra c)
-> TransitionConfig (BabbageEra c) -> Bool
$c== :: forall c.
Crypto c =>
TransitionConfig (BabbageEra c)
-> TransitionConfig (BabbageEra c) -> Bool
Eq, Context -> TransitionConfig (BabbageEra c) -> IO (Maybe ThunkInfo)
Proxy (TransitionConfig (BabbageEra c)) -> String
forall c.
Crypto c =>
Context -> TransitionConfig (BabbageEra c) -> IO (Maybe ThunkInfo)
forall c.
Crypto c =>
Proxy (TransitionConfig (BabbageEra c)) -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy (TransitionConfig (BabbageEra c)) -> String
$cshowTypeOf :: forall c.
Crypto c =>
Proxy (TransitionConfig (BabbageEra c)) -> String
wNoThunks :: Context -> TransitionConfig (BabbageEra c) -> IO (Maybe ThunkInfo)
$cwNoThunks :: forall c.
Crypto c =>
Context -> TransitionConfig (BabbageEra c) -> IO (Maybe ThunkInfo)
noThunks :: Context -> TransitionConfig (BabbageEra c) -> IO (Maybe ThunkInfo)
$cnoThunks :: forall c.
Crypto c =>
Context -> TransitionConfig (BabbageEra c) -> IO (Maybe ThunkInfo)
NoThunks, [TransitionConfig (BabbageEra c)] -> Encoding
[TransitionConfig (BabbageEra c)] -> Value
TransitionConfig (BabbageEra c) -> Bool
TransitionConfig (BabbageEra c) -> Encoding
TransitionConfig (BabbageEra c) -> Value
forall c. Crypto c => [TransitionConfig (BabbageEra c)] -> Encoding
forall c. Crypto c => [TransitionConfig (BabbageEra c)] -> Value
forall c. Crypto c => TransitionConfig (BabbageEra c) -> Bool
forall c. Crypto c => TransitionConfig (BabbageEra c) -> Encoding
forall c. Crypto c => TransitionConfig (BabbageEra c) -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
omitField :: TransitionConfig (BabbageEra c) -> Bool
$comitField :: forall c. Crypto c => TransitionConfig (BabbageEra c) -> Bool
toEncodingList :: [TransitionConfig (BabbageEra c)] -> Encoding
$ctoEncodingList :: forall c. Crypto c => [TransitionConfig (BabbageEra c)] -> Encoding
toJSONList :: [TransitionConfig (BabbageEra c)] -> Value
$ctoJSONList :: forall c. Crypto c => [TransitionConfig (BabbageEra c)] -> Value
toEncoding :: TransitionConfig (BabbageEra c) -> Encoding
$ctoEncoding :: forall c. Crypto c => TransitionConfig (BabbageEra c) -> Encoding
toJSON :: TransitionConfig (BabbageEra c) -> Value
$ctoJSON :: forall c. Crypto c => TransitionConfig (BabbageEra c) -> Value
ToJSON, Maybe (TransitionConfig (BabbageEra c))
Value -> Parser [TransitionConfig (BabbageEra c)]
Value -> Parser (TransitionConfig (BabbageEra c))
forall c. Crypto c => Maybe (TransitionConfig (BabbageEra c))
forall c.
Crypto c =>
Value -> Parser [TransitionConfig (BabbageEra c)]
forall c.
Crypto c =>
Value -> Parser (TransitionConfig (BabbageEra c))
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
omittedField :: Maybe (TransitionConfig (BabbageEra c))
$comittedField :: forall c. Crypto c => Maybe (TransitionConfig (BabbageEra c))
parseJSONList :: Value -> Parser [TransitionConfig (BabbageEra c)]
$cparseJSONList :: forall c.
Crypto c =>
Value -> Parser [TransitionConfig (BabbageEra c)]
parseJSON :: Value -> Parser (TransitionConfig (BabbageEra c))
$cparseJSON :: forall c.
Crypto c =>
Value -> Parser (TransitionConfig (BabbageEra c))
FromJSON)

  mkTransitionConfig :: TranslationContext (BabbageEra c)
-> TransitionConfig (PreviousEra (BabbageEra c))
-> TransitionConfig (BabbageEra c)
mkTransitionConfig TranslationContext (BabbageEra c)
NoGenesis (BabbageEra c)
NoGenesis = forall c.
TransitionConfig (AlonzoEra c) -> TransitionConfig (BabbageEra c)
BabbageTransitionConfig

  injectIntoTestState :: TransitionConfig (BabbageEra c)
-> NewEpochState (BabbageEra c) -> NewEpochState (BabbageEra c)
injectIntoTestState = forall era.
EraTransition era =>
TransitionConfig era -> NewEpochState era -> NewEpochState era
registerInitialFundsThenStaking

  tcPreviousEraConfigL :: EraTransition (PreviousEra (BabbageEra c)) =>
Lens'
  (TransitionConfig (BabbageEra c))
  (TransitionConfig (PreviousEra (BabbageEra c)))
tcPreviousEraConfigL =
    forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall c.
TransitionConfig (BabbageEra c) -> TransitionConfig (AlonzoEra c)
btcAlonzoTransitionConfig (\TransitionConfig (BabbageEra c)
btc TransitionConfig (AlonzoEra c)
pc -> TransitionConfig (BabbageEra c)
btc {btcAlonzoTransitionConfig :: TransitionConfig (AlonzoEra c)
btcAlonzoTransitionConfig = TransitionConfig (AlonzoEra c)
pc})

  tcTranslationContextL :: Lens'
  (TransitionConfig (BabbageEra c))
  (TranslationContext (BabbageEra c))
tcTranslationContextL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens (forall a b. a -> b -> a
const forall era. NoGenesis era
NoGenesis) (forall a b. a -> b -> a
const forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> a
id)