{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Cardano.Ledger.Shelley.Translation (
FromByronTranslationContext (..),
emptyFromByronTranslationContext,
toFromByronTranslationContext,
)
where
import Cardano.Ledger.Core (PParams, TranslationContext, emptyPParams)
import Cardano.Ledger.Crypto (Crypto)
import Cardano.Ledger.Keys
import Cardano.Ledger.Shelley.Era (ShelleyEra)
import Cardano.Ledger.Shelley.Genesis (ShelleyGenesis (..))
import Data.Map (Map)
import qualified Data.Map as Map
import GHC.Generics (Generic)
import GHC.Word (Word64)
import NoThunks.Class (NoThunks (..))
data FromByronTranslationContext c = FromByronTranslationContext
{ forall c.
FromByronTranslationContext c
-> Map (KeyHash 'Genesis c) (GenDelegPair c)
fbtcGenDelegs :: !(Map (KeyHash 'Genesis c) (GenDelegPair c))
, forall c. FromByronTranslationContext c -> PParams (ShelleyEra c)
fbtcProtocolParams :: !(PParams (ShelleyEra c))
, forall c. FromByronTranslationContext c -> Word64
fbtcMaxLovelaceSupply :: !Word64
}
deriving (FromByronTranslationContext c
-> FromByronTranslationContext c -> Bool
forall c.
FromByronTranslationContext c
-> FromByronTranslationContext c -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FromByronTranslationContext c
-> FromByronTranslationContext c -> Bool
$c/= :: forall c.
FromByronTranslationContext c
-> FromByronTranslationContext c -> Bool
== :: FromByronTranslationContext c
-> FromByronTranslationContext c -> Bool
$c== :: forall c.
FromByronTranslationContext c
-> FromByronTranslationContext c -> Bool
Eq, Int -> FromByronTranslationContext c -> ShowS
forall c. Int -> FromByronTranslationContext c -> ShowS
forall c. [FromByronTranslationContext c] -> ShowS
forall c. FromByronTranslationContext c -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FromByronTranslationContext c] -> ShowS
$cshowList :: forall c. [FromByronTranslationContext c] -> ShowS
show :: FromByronTranslationContext c -> String
$cshow :: forall c. FromByronTranslationContext c -> String
showsPrec :: Int -> FromByronTranslationContext c -> ShowS
$cshowsPrec :: forall c. Int -> FromByronTranslationContext c -> ShowS
Show, forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall c x.
Rep (FromByronTranslationContext c) x
-> FromByronTranslationContext c
forall c x.
FromByronTranslationContext c
-> Rep (FromByronTranslationContext c) x
$cto :: forall c x.
Rep (FromByronTranslationContext c) x
-> FromByronTranslationContext c
$cfrom :: forall c x.
FromByronTranslationContext c
-> Rep (FromByronTranslationContext c) x
Generic)
emptyFromByronTranslationContext :: Crypto c => FromByronTranslationContext c
emptyFromByronTranslationContext :: forall c. Crypto c => FromByronTranslationContext c
emptyFromByronTranslationContext =
FromByronTranslationContext
{ fbtcGenDelegs :: Map (KeyHash 'Genesis c) (GenDelegPair c)
fbtcGenDelegs = forall k a. Map k a
Map.empty
, fbtcMaxLovelaceSupply :: Word64
fbtcMaxLovelaceSupply = Word64
0
, fbtcProtocolParams :: PParams (ShelleyEra c)
fbtcProtocolParams = forall era. EraPParams era => PParams era
emptyPParams
}
toFromByronTranslationContext ::
ShelleyGenesis c ->
FromByronTranslationContext c
toFromByronTranslationContext :: forall c. ShelleyGenesis c -> FromByronTranslationContext c
toFromByronTranslationContext ShelleyGenesis {Map (KeyHash 'Genesis c) (GenDelegPair c)
sgGenDelegs :: forall c.
ShelleyGenesis c -> Map (KeyHash 'Genesis c) (GenDelegPair c)
sgGenDelegs :: Map (KeyHash 'Genesis c) (GenDelegPair c)
sgGenDelegs, Word64
sgMaxLovelaceSupply :: forall c. ShelleyGenesis c -> Word64
sgMaxLovelaceSupply :: Word64
sgMaxLovelaceSupply, PParams (ShelleyEra c)
sgProtocolParams :: forall c. ShelleyGenesis c -> PParams (ShelleyEra c)
sgProtocolParams :: PParams (ShelleyEra c)
sgProtocolParams} =
FromByronTranslationContext
{ fbtcGenDelegs :: Map (KeyHash 'Genesis c) (GenDelegPair c)
fbtcGenDelegs = Map (KeyHash 'Genesis c) (GenDelegPair c)
sgGenDelegs
, fbtcProtocolParams :: PParams (ShelleyEra c)
fbtcProtocolParams = PParams (ShelleyEra c)
sgProtocolParams
, fbtcMaxLovelaceSupply :: Word64
fbtcMaxLovelaceSupply = Word64
sgMaxLovelaceSupply
}
deriving instance Crypto c => NoThunks (FromByronTranslationContext c)
type instance TranslationContext (ShelleyEra c) = FromByronTranslationContext c