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

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

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

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

  mkTransitionConfig :: TranslationContext AllegraEra
-> TransitionConfig (PreviousEra AllegraEra)
-> TransitionConfig AllegraEra
mkTransitionConfig TranslationContext AllegraEra
NoGenesis AllegraEra
NoGenesis = TransitionConfig ShelleyEra -> TransitionConfig AllegraEra
AllegraTransitionConfig

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

  tcPreviousEraConfigL :: EraTransition (PreviousEra AllegraEra) =>
Lens'
  (TransitionConfig AllegraEra)
  (TransitionConfig (PreviousEra AllegraEra))
tcPreviousEraConfigL =
    forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TransitionConfig AllegraEra -> TransitionConfig ShelleyEra
atcShelleyTransitionConfig (\TransitionConfig AllegraEra
atc TransitionConfig ShelleyEra
pc -> TransitionConfig AllegraEra
atc {atcShelleyTransitionConfig :: TransitionConfig ShelleyEra
atcShelleyTransitionConfig = TransitionConfig ShelleyEra
pc})

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