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

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

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

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

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