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

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

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

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

  mkTransitionConfig :: TranslationContext MaryEra
-> TransitionConfig (PreviousEra MaryEra)
-> TransitionConfig MaryEra
mkTransitionConfig TranslationContext MaryEra
NoGenesis MaryEra
NoGenesis = TransitionConfig AllegraEra -> TransitionConfig MaryEra
MaryTransitionConfig

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

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

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