{-# 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.Genesis (NoGenesis (..))
import Cardano.Ledger.Shelley.Transition
import Data.Aeson (FromJSON (..), ToJSON (..))
import Lens.Micro
import NoThunks.Class (NoThunks (..))

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

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

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

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

  tcTranslationContextL :: Lens' (TransitionConfig BabbageEra) (TranslationContext BabbageEra)
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)