{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
{-# OPTIONS_GHC -Wno-orphans #-}

-- | This module contains just the type of protocol parameters.
module Cardano.Ledger.Alonzo.PParams (
  -- * Era Agnostic
  AlonzoEraPParams (..),
  ppCoinsPerUTxOWordL,
  ppCostModelsL,
  ppPricesL,
  ppMaxTxExUnitsL,
  ppMaxBlockExUnitsL,
  ppMaxValSizeL,
  ppCollateralPercentageL,
  ppMaxCollateralInputsL,
  ppuCoinsPerUTxOWordL,
  ppuCostModelsL,
  ppuPricesL,
  ppuMaxTxExUnitsL,
  ppuMaxBlockExUnitsL,
  ppuMaxValSizeL,
  ppuCollateralPercentageL,
  ppuMaxCollateralInputsL,

  -- * Alonzo specific
  AlonzoPParams (..),
  UpgradeAlonzoPParams (..),
  DowngradeAlonzoPParams (..),
  emptyAlonzoPParams,
  emptyAlonzoPParamsUpdate,
  upgradeAlonzoPParams,
  downgradeAlonzoPParams,
  getLanguageView,
  LangDepView (..),
  encodeLangViews,
  OrdExUnits (..),
  CoinPerWord (..),

  -- * JSON helpers
  alonzoCommonPParamsHKDPairs,
)
where

import Cardano.Ledger.Alonzo.Era (AlonzoEra)
import Cardano.Ledger.BaseTypes (
  EpochInterval (..),
  NonNegativeInterval,
  Nonce (NeutralNonce),
  StrictMaybe (..),
  UnitInterval,
  isSNothing,
 )
import qualified Cardano.Ledger.BaseTypes as BT (ProtVer (..))
import Cardano.Ledger.Binary (
  DecCBOR (..),
  EncCBOR (..),
  Encoding,
  FromCBOR (..),
  ToCBOR (..),
  decCBORGroup,
  decodeRecordNamed,
  encCBORGroup,
  encodeFoldableAsDefLenList,
  encodeFoldableAsIndefLenList,
  encodeListLen,
  encodeMapLen,
  encodeNull,
  encodePreEncoded,
  listLen,
  serialize',
 )
import Cardano.Ledger.Binary.Coders (
  Decode (..),
  Density (..),
  Encode (..),
  Field (..),
  Wrapped (..),
  decode,
  encode,
  field,
  (!>),
 )
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.Core (EraPParams (..))
import Cardano.Ledger.Crypto (Crypto)
import Cardano.Ledger.HKD (HKD, HKDFunctor (..))
import Cardano.Ledger.Mary.Core
import Cardano.Ledger.Plutus.CostModels (
  CostModel,
  CostModels,
  costModelsValid,
  emptyCostModels,
  getCostModelLanguage,
  getCostModelParams,
 )
import Cardano.Ledger.Plutus.ExUnits (
  ExUnits (..),
  Prices (..),
  zipSemiExUnits,
 )
import Cardano.Ledger.Plutus.Language (Language (..))
import Cardano.Ledger.Shelley.PParams (
  ShelleyPParams (..),
  shelleyCommonPParamsHKDPairs,
  shelleyCommonPParamsHKDPairsV6,
  shelleyCommonPParamsHKDPairsV8,
 )
import Control.DeepSeq (NFData)
import Data.Aeson as Aeson (
  FromJSON (parseJSON),
  Key,
  KeyValue ((.=)),
  ToJSON (..),
  object,
  pairs,
  withObject,
  (.!=),
  (.:),
 )
import qualified Data.Aeson.Types as Aeson
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import Data.Coerce (coerce)
import Data.Default (Default (def))
import Data.Function (on)
import Data.Functor.Identity (Identity (..))
import Data.List (sortBy)
import qualified Data.Map.Strict as Map
import Data.Proxy (Proxy (Proxy))
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Word (Word16, Word32)
import GHC.Generics (Generic)
import Lens.Micro (Lens', lens, (^.))
import NoThunks.Class (NoThunks (..))
import Numeric.Natural (Natural)

class EraPParams era => AlonzoEraPParams era where
  hkdCoinsPerUTxOWordL ::
    (HKDFunctor f, ExactEra AlonzoEra era) =>
    Lens' (PParamsHKD f era) (HKD f CoinPerWord)

  hkdCostModelsL :: HKDFunctor f => Lens' (PParamsHKD f era) (HKD f CostModels)

  hkdPricesL :: HKDFunctor f => Lens' (PParamsHKD f era) (HKD f Prices)

  hkdMaxTxExUnitsL :: HKDFunctor f => Lens' (PParamsHKD f era) (HKD f ExUnits)

  hkdMaxBlockExUnitsL :: HKDFunctor f => Lens' (PParamsHKD f era) (HKD f ExUnits)

  hkdMaxValSizeL :: HKDFunctor f => Lens' (PParamsHKD f era) (HKD f Natural)

  hkdCollateralPercentageL :: HKDFunctor f => Lens' (PParamsHKD f era) (HKD f Natural)

  hkdMaxCollateralInputsL :: HKDFunctor f => Lens' (PParamsHKD f era) (HKD f Natural)

ppCoinsPerUTxOWordL ::
  forall era.
  (AlonzoEraPParams era, ExactEra AlonzoEra era) =>
  Lens' (PParams era) CoinPerWord
ppCoinsPerUTxOWordL :: forall era.
(AlonzoEraPParams era, ExactEra AlonzoEra era) =>
Lens' (PParams era) CoinPerWord
ppCoinsPerUTxOWordL = forall era. Lens' (PParams era) (PParamsHKD Identity era)
ppLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f, ExactEra AlonzoEra era) =>
Lens' (PParamsHKD f era) (HKD f CoinPerWord)
hkdCoinsPerUTxOWordL @era @Identity

ppCostModelsL :: forall era. AlonzoEraPParams era => Lens' (PParams era) CostModels
ppCostModelsL :: forall era. AlonzoEraPParams era => Lens' (PParams era) CostModels
ppCostModelsL = forall era. Lens' (PParams era) (PParamsHKD Identity era)
ppLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f CostModels)
hkdCostModelsL @era @Identity

ppPricesL :: forall era. AlonzoEraPParams era => Lens' (PParams era) Prices
ppPricesL :: forall era. AlonzoEraPParams era => Lens' (PParams era) Prices
ppPricesL = forall era. Lens' (PParams era) (PParamsHKD Identity era)
ppLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Prices)
hkdPricesL @era @Identity

ppMaxTxExUnitsL :: forall era. AlonzoEraPParams era => Lens' (PParams era) ExUnits
ppMaxTxExUnitsL :: forall era. AlonzoEraPParams era => Lens' (PParams era) ExUnits
ppMaxTxExUnitsL = forall era. Lens' (PParams era) (PParamsHKD Identity era)
ppLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f ExUnits)
hkdMaxTxExUnitsL @era @Identity

ppMaxBlockExUnitsL :: forall era. AlonzoEraPParams era => Lens' (PParams era) ExUnits
ppMaxBlockExUnitsL :: forall era. AlonzoEraPParams era => Lens' (PParams era) ExUnits
ppMaxBlockExUnitsL = forall era. Lens' (PParams era) (PParamsHKD Identity era)
ppLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f ExUnits)
hkdMaxBlockExUnitsL @era @Identity

ppMaxValSizeL :: forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
ppMaxValSizeL :: forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
ppMaxValSizeL = forall era. Lens' (PParams era) (PParamsHKD Identity era)
ppLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Natural)
hkdMaxValSizeL @era @Identity

ppCollateralPercentageL :: forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
ppCollateralPercentageL :: forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
ppCollateralPercentageL = forall era. Lens' (PParams era) (PParamsHKD Identity era)
ppLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Natural)
hkdCollateralPercentageL @era @Identity

ppMaxCollateralInputsL :: forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
ppMaxCollateralInputsL :: forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
ppMaxCollateralInputsL = forall era. Lens' (PParams era) (PParamsHKD Identity era)
ppLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Natural)
hkdMaxCollateralInputsL @era @Identity

ppuCoinsPerUTxOWordL ::
  forall era.
  (AlonzoEraPParams era, ExactEra AlonzoEra era) =>
  Lens' (PParamsUpdate era) (StrictMaybe CoinPerWord)
ppuCoinsPerUTxOWordL :: forall era.
(AlonzoEraPParams era, ExactEra AlonzoEra era) =>
Lens' (PParamsUpdate era) (StrictMaybe CoinPerWord)
ppuCoinsPerUTxOWordL = forall era. Lens' (PParamsUpdate era) (PParamsHKD StrictMaybe era)
ppuLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f, ExactEra AlonzoEra era) =>
Lens' (PParamsHKD f era) (HKD f CoinPerWord)
hkdCoinsPerUTxOWordL @era @StrictMaybe

ppuCostModelsL ::
  forall era.
  AlonzoEraPParams era =>
  Lens' (PParamsUpdate era) (StrictMaybe CostModels)
ppuCostModelsL :: forall era.
AlonzoEraPParams era =>
Lens' (PParamsUpdate era) (StrictMaybe CostModels)
ppuCostModelsL = forall era. Lens' (PParamsUpdate era) (PParamsHKD StrictMaybe era)
ppuLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f CostModels)
hkdCostModelsL @era @StrictMaybe

ppuPricesL ::
  forall era.
  AlonzoEraPParams era =>
  Lens' (PParamsUpdate era) (StrictMaybe Prices)
ppuPricesL :: forall era.
AlonzoEraPParams era =>
Lens' (PParamsUpdate era) (StrictMaybe Prices)
ppuPricesL = forall era. Lens' (PParamsUpdate era) (PParamsHKD StrictMaybe era)
ppuLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Prices)
hkdPricesL @era @StrictMaybe

ppuMaxTxExUnitsL ::
  forall era.
  AlonzoEraPParams era =>
  Lens' (PParamsUpdate era) (StrictMaybe ExUnits)
ppuMaxTxExUnitsL :: forall era.
AlonzoEraPParams era =>
Lens' (PParamsUpdate era) (StrictMaybe ExUnits)
ppuMaxTxExUnitsL = forall era. Lens' (PParamsUpdate era) (PParamsHKD StrictMaybe era)
ppuLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f ExUnits)
hkdMaxTxExUnitsL @era @StrictMaybe

ppuMaxBlockExUnitsL ::
  forall era.
  AlonzoEraPParams era =>
  Lens' (PParamsUpdate era) (StrictMaybe ExUnits)
ppuMaxBlockExUnitsL :: forall era.
AlonzoEraPParams era =>
Lens' (PParamsUpdate era) (StrictMaybe ExUnits)
ppuMaxBlockExUnitsL = forall era. Lens' (PParamsUpdate era) (PParamsHKD StrictMaybe era)
ppuLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f ExUnits)
hkdMaxBlockExUnitsL @era @StrictMaybe

ppuMaxValSizeL ::
  forall era.
  AlonzoEraPParams era =>
  Lens' (PParamsUpdate era) (StrictMaybe Natural)
ppuMaxValSizeL :: forall era.
AlonzoEraPParams era =>
Lens' (PParamsUpdate era) (StrictMaybe Natural)
ppuMaxValSizeL = forall era. Lens' (PParamsUpdate era) (PParamsHKD StrictMaybe era)
ppuLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Natural)
hkdMaxValSizeL @era @StrictMaybe

ppuCollateralPercentageL ::
  forall era.
  AlonzoEraPParams era =>
  Lens' (PParamsUpdate era) (StrictMaybe Natural)
ppuCollateralPercentageL :: forall era.
AlonzoEraPParams era =>
Lens' (PParamsUpdate era) (StrictMaybe Natural)
ppuCollateralPercentageL = forall era. Lens' (PParamsUpdate era) (PParamsHKD StrictMaybe era)
ppuLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Natural)
hkdCollateralPercentageL @era @StrictMaybe

ppuMaxCollateralInputsL ::
  forall era.
  AlonzoEraPParams era =>
  Lens' (PParamsUpdate era) (StrictMaybe Natural)
ppuMaxCollateralInputsL :: forall era.
AlonzoEraPParams era =>
Lens' (PParamsUpdate era) (StrictMaybe Natural)
ppuMaxCollateralInputsL = forall era. Lens' (PParamsUpdate era) (PParamsHKD StrictMaybe era)
ppuLens forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Natural)
hkdMaxCollateralInputsL @era @StrictMaybe

-- | Protocol parameters.
-- Shelley parameters + additional ones
data AlonzoPParams f era = AlonzoPParams
  { forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMinFeeA :: !(HKD f Coin)
  -- ^ The linear factor for the minimum fee calculation
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMinFeeB :: !(HKD f Coin)
  -- ^ The constant factor for the minimum fee calculation
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word32
appMaxBBSize :: !(HKD f Word32)
  -- ^ Maximal block body size
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word32
appMaxTxSize :: !(HKD f Word32)
  -- ^ Maximal transaction size
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word16
appMaxBHSize :: !(HKD f Word16)
  -- ^ Maximal block header size
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appKeyDeposit :: !(HKD f Coin)
  -- ^ The amount of a key registration deposit
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appPoolDeposit :: !(HKD f Coin)
  -- ^ The amount of a pool registration deposit
  , forall (f :: * -> *) era.
AlonzoPParams f era -> HKD f EpochInterval
appEMax :: !(HKD f EpochInterval)
  -- ^ Maximum number of epochs in the future a pool retirement is allowed to
  -- be scheduled for.
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appNOpt :: !(HKD f Natural)
  -- ^ Desired number of pools
  , forall (f :: * -> *) era.
AlonzoPParams f era -> HKD f NonNegativeInterval
appA0 :: !(HKD f NonNegativeInterval)
  -- ^ Pool influence
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appRho :: !(HKD f UnitInterval)
  -- ^ Monetary expansion
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appTau :: !(HKD f UnitInterval)
  -- ^ Treasury expansion
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appD :: !(HKD f UnitInterval)
  -- ^ Decentralization parameter. Note that the scale is inverted here - a
  -- value of 0 indicates full decentralisation, where 1 indicates full
  -- federalisation.
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Nonce
appExtraEntropy :: !(HKD f Nonce)
  -- ^ Extra entropy
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f ProtVer
appProtocolVersion :: !(HKD f BT.ProtVer)
  -- ^ Protocol version
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMinPoolCost :: !(HKD f Coin)
  -- ^ Minimum Stake Pool Cost
  , -- new/updated for alonzo

    forall (f :: * -> *) era. AlonzoPParams f era -> HKD f CoinPerWord
appCoinsPerUTxOWord :: !(HKD f CoinPerWord)
  -- ^ Cost in lovelace per word (8 bytes) of UTxO storage (instead of appMinUTxOValue)
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f CostModels
appCostModels :: !(HKD f CostModels)
  -- ^ Cost models for non-native script languages
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Prices
appPrices :: !(HKD f Prices)
  -- ^ Prices of execution units (for non-native script languages)
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f OrdExUnits
appMaxTxExUnits :: !(HKD f OrdExUnits)
  -- ^ Max total script execution resources units allowed per tx
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f OrdExUnits
appMaxBlockExUnits :: !(HKD f OrdExUnits)
  -- ^ Max total script execution resources units allowed per block
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appMaxValSize :: !(HKD f Natural)
  -- ^ Max size of a Value in an output
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appCollateralPercentage :: !(HKD f Natural)
  -- ^ Percentage of the txfee which must be provided as collateral when
  -- including non-native scripts.
  , forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appMaxCollateralInputs :: !(HKD f Natural)
  -- ^ Maximum number of collateral inputs allowed in a transaction
  }
  deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (f :: * -> *) era x.
Rep (AlonzoPParams f era) x -> AlonzoPParams f era
forall (f :: * -> *) era x.
AlonzoPParams f era -> Rep (AlonzoPParams f era) x
$cto :: forall (f :: * -> *) era x.
Rep (AlonzoPParams f era) x -> AlonzoPParams f era
$cfrom :: forall (f :: * -> *) era x.
AlonzoPParams f era -> Rep (AlonzoPParams f era) x
Generic)

deriving instance Eq (AlonzoPParams Identity era)

deriving instance Ord (AlonzoPParams Identity era)

deriving instance Show (AlonzoPParams Identity era)

instance NoThunks (AlonzoPParams Identity era)

instance NFData (AlonzoPParams Identity era)

deriving instance Eq (AlonzoPParams StrictMaybe era)

deriving instance Ord (AlonzoPParams StrictMaybe era)

deriving instance Show (AlonzoPParams StrictMaybe era)

instance NoThunks (AlonzoPParams StrictMaybe era)

instance NFData (AlonzoPParams StrictMaybe era)

instance Crypto c => EraPParams (AlonzoEra c) where
  type PParamsHKD f (AlonzoEra c) = AlonzoPParams f (AlonzoEra c)
  type UpgradePParams f (AlonzoEra c) = UpgradeAlonzoPParams f
  type DowngradePParams f (AlonzoEra c) = DowngradeAlonzoPParams f

  emptyPParamsIdentity :: PParamsHKD Identity (AlonzoEra c)
emptyPParamsIdentity = forall era. Era era => AlonzoPParams Identity era
emptyAlonzoPParams
  emptyPParamsStrictMaybe :: PParamsHKD StrictMaybe (AlonzoEra c)
emptyPParamsStrictMaybe = forall era. AlonzoPParams StrictMaybe era
emptyAlonzoPParamsUpdate

  upgradePParamsHKD :: forall (f :: * -> *).
(HKDApplicative f, EraPParams (PreviousEra (AlonzoEra c))) =>
UpgradePParams f (AlonzoEra c)
-> PParamsHKD f (PreviousEra (AlonzoEra c))
-> PParamsHKD f (AlonzoEra c)
upgradePParamsHKD = forall (f :: * -> *) era1 era2.
HKDFunctor f =>
UpgradeAlonzoPParams f
-> ShelleyPParams f era1 -> AlonzoPParams f era2
upgradeAlonzoPParams
  downgradePParamsHKD :: forall (f :: * -> *).
(HKDFunctor f, EraPParams (PreviousEra (AlonzoEra c))) =>
DowngradePParams f (AlonzoEra c)
-> PParamsHKD f (AlonzoEra c)
-> PParamsHKD f (PreviousEra (AlonzoEra c))
downgradePParamsHKD = forall (f :: * -> *) era2 era1.
DowngradeAlonzoPParams f
-> AlonzoPParams f era2 -> ShelleyPParams f era1
downgradeAlonzoPParams

  hkdMinFeeAL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Coin)
hkdMinFeeAL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMinFeeA forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Coin
x -> PParamsHKD f (AlonzoEra c)
pp {appMinFeeA :: HKD f Coin
appMinFeeA = HKD f Coin
x}
  hkdMinFeeBL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Coin)
hkdMinFeeBL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMinFeeB forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Coin
x -> PParamsHKD f (AlonzoEra c)
pp {appMinFeeB :: HKD f Coin
appMinFeeB = HKD f Coin
x}
  hkdMaxBBSizeL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Word32)
hkdMaxBBSizeL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word32
appMaxBBSize forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Word32
x -> PParamsHKD f (AlonzoEra c)
pp {appMaxBBSize :: HKD f Word32
appMaxBBSize = HKD f Word32
x}
  hkdMaxTxSizeL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Word32)
hkdMaxTxSizeL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word32
appMaxTxSize forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Word32
x -> PParamsHKD f (AlonzoEra c)
pp {appMaxTxSize :: HKD f Word32
appMaxTxSize = HKD f Word32
x}
  hkdMaxBHSizeL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Word16)
hkdMaxBHSizeL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word16
appMaxBHSize forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Word16
x -> PParamsHKD f (AlonzoEra c)
pp {appMaxBHSize :: HKD f Word16
appMaxBHSize = HKD f Word16
x}
  hkdKeyDepositL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Coin)
hkdKeyDepositL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appKeyDeposit forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Coin
x -> PParamsHKD f (AlonzoEra c)
pp {appKeyDeposit :: HKD f Coin
appKeyDeposit = HKD f Coin
x}
  hkdPoolDepositL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Coin)
hkdPoolDepositL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appPoolDeposit forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Coin
x -> PParamsHKD f (AlonzoEra c)
pp {appPoolDeposit :: HKD f Coin
appPoolDeposit = HKD f Coin
x}
  hkdEMaxL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f EpochInterval)
hkdEMaxL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era.
AlonzoPParams f era -> HKD f EpochInterval
appEMax forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f EpochInterval
x -> PParamsHKD f (AlonzoEra c)
pp {appEMax :: HKD f EpochInterval
appEMax = HKD f EpochInterval
x}
  hkdNOptL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Natural)
hkdNOptL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appNOpt forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Natural
x -> PParamsHKD f (AlonzoEra c)
pp {appNOpt :: HKD f Natural
appNOpt = HKD f Natural
x}
  hkdA0L :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f NonNegativeInterval)
hkdA0L = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era.
AlonzoPParams f era -> HKD f NonNegativeInterval
appA0 forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f NonNegativeInterval
x -> PParamsHKD f (AlonzoEra c)
pp {appA0 :: HKD f NonNegativeInterval
appA0 = HKD f NonNegativeInterval
x}
  hkdRhoL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f UnitInterval)
hkdRhoL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appRho forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f UnitInterval
x -> PParamsHKD f (AlonzoEra c)
pp {appRho :: HKD f UnitInterval
appRho = HKD f UnitInterval
x}
  hkdTauL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f UnitInterval)
hkdTauL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appTau forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f UnitInterval
x -> PParamsHKD f (AlonzoEra c)
pp {appTau :: HKD f UnitInterval
appTau = HKD f UnitInterval
x}
  hkdDL :: forall (f :: * -> *).
(HKDFunctor f, ProtVerAtMost (AlonzoEra c) 6) =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f UnitInterval)
hkdDL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appD forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f UnitInterval
x -> PParamsHKD f (AlonzoEra c)
pp {appD :: HKD f UnitInterval
appD = HKD f UnitInterval
x}
  hkdExtraEntropyL :: forall (f :: * -> *).
(HKDFunctor f, ProtVerAtMost (AlonzoEra c) 6) =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Nonce)
hkdExtraEntropyL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Nonce
appExtraEntropy forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Nonce
x -> PParamsHKD f (AlonzoEra c)
pp {appExtraEntropy :: HKD f Nonce
appExtraEntropy = HKD f Nonce
x}
  hkdProtocolVersionL :: forall (f :: * -> *).
(HKDFunctor f, ProtVerAtMost (AlonzoEra c) 8) =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f ProtVer)
hkdProtocolVersionL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f ProtVer
appProtocolVersion forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f ProtVer
x -> PParamsHKD f (AlonzoEra c)
pp {appProtocolVersion :: HKD f ProtVer
appProtocolVersion = HKD f ProtVer
x}
  hkdMinUTxOValueL :: forall (f :: * -> *).
(HKDFunctor f, ProtVerAtMost (AlonzoEra c) 4) =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Coin)
hkdMinUTxOValueL = forall a b. HasCallStack => Lens' a b
notSupportedInThisEraL
  hkdMinPoolCostL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Coin)
hkdMinPoolCostL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMinPoolCost forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Coin
x -> PParamsHKD f (AlonzoEra c)
pp {appMinPoolCost :: HKD f Coin
appMinPoolCost = HKD f Coin
x}

instance Crypto c => AlonzoEraPParams (AlonzoEra c) where
  hkdCoinsPerUTxOWordL :: forall (f :: * -> *).
(HKDFunctor f, ExactEra AlonzoEra (AlonzoEra c)) =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f CoinPerWord)
hkdCoinsPerUTxOWordL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f CoinPerWord
appCoinsPerUTxOWord forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f CoinPerWord
x -> PParamsHKD f (AlonzoEra c)
pp {appCoinsPerUTxOWord :: HKD f CoinPerWord
appCoinsPerUTxOWord = HKD f CoinPerWord
x}
  hkdCostModelsL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f CostModels)
hkdCostModelsL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f CostModels
appCostModels forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f CostModels
x -> PParamsHKD f (AlonzoEra c)
pp {appCostModels :: HKD f CostModels
appCostModels = HKD f CostModels
x}
  hkdPricesL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Prices)
hkdPricesL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Prices
appPrices forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Prices
x -> PParamsHKD f (AlonzoEra c)
pp {appPrices :: HKD f Prices
appPrices = HKD f Prices
x}
  hkdMaxTxExUnitsL :: forall f. HKDFunctor f => Lens' (PParamsHKD f (AlonzoEra c)) (HKD f ExUnits)
  hkdMaxTxExUnitsL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f ExUnits)
hkdMaxTxExUnitsL =
    forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens (forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap (forall {k} (t :: k). Proxy t
Proxy @f) OrdExUnits -> ExUnits
unOrdExUnits forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) era. AlonzoPParams f era -> HKD f OrdExUnits
appMaxTxExUnits) forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f ExUnits
x ->
      PParamsHKD f (AlonzoEra c)
pp {appMaxTxExUnits :: HKD f OrdExUnits
appMaxTxExUnits = forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap (forall {k} (t :: k). Proxy t
Proxy @f) ExUnits -> OrdExUnits
OrdExUnits HKD f ExUnits
x}
  hkdMaxBlockExUnitsL :: forall f. HKDFunctor f => Lens' (PParamsHKD f (AlonzoEra c)) (HKD f ExUnits)
  hkdMaxBlockExUnitsL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f ExUnits)
hkdMaxBlockExUnitsL =
    forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens (forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap (forall {k} (t :: k). Proxy t
Proxy @f) OrdExUnits -> ExUnits
unOrdExUnits forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) era. AlonzoPParams f era -> HKD f OrdExUnits
appMaxBlockExUnits) forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f ExUnits
x ->
      PParamsHKD f (AlonzoEra c)
pp {appMaxBlockExUnits :: HKD f OrdExUnits
appMaxBlockExUnits = forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap (forall {k} (t :: k). Proxy t
Proxy @f) ExUnits -> OrdExUnits
OrdExUnits HKD f ExUnits
x}
  hkdMaxValSizeL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Natural)
hkdMaxValSizeL = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appMaxValSize forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Natural
x -> PParamsHKD f (AlonzoEra c)
pp {appMaxValSize :: HKD f Natural
appMaxValSize = HKD f Natural
x}
  hkdCollateralPercentageL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Natural)
hkdCollateralPercentageL =
    forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appCollateralPercentage forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Natural
x -> PParamsHKD f (AlonzoEra c)
pp {appCollateralPercentage :: HKD f Natural
appCollateralPercentage = HKD f Natural
x}
  hkdMaxCollateralInputsL :: forall (f :: * -> *).
HKDFunctor f =>
Lens' (PParamsHKD f (AlonzoEra c)) (HKD f Natural)
hkdMaxCollateralInputsL =
    forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appMaxCollateralInputs forall a b. (a -> b) -> a -> b
$ \PParamsHKD f (AlonzoEra c)
pp HKD f Natural
x -> PParamsHKD f (AlonzoEra c)
pp {appMaxCollateralInputs :: HKD f Natural
appMaxCollateralInputs = HKD f Natural
x}

instance Crypto c => EraGov (AlonzoEra c) where
  type GovState (AlonzoEra c) = ShelleyGovState (AlonzoEra c)
  emptyGovState :: GovState (AlonzoEra c)
emptyGovState = forall era. EraPParams era => ShelleyGovState era
emptyShelleyGovState

  getProposedPPUpdates :: GovState (AlonzoEra c) -> Maybe (ProposedPPUpdates (AlonzoEra c))
getProposedPPUpdates = forall a. a -> Maybe a
Just forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era. ShelleyGovState era -> ProposedPPUpdates era
sgsCurProposals

  curPParamsGovStateL :: Lens' (GovState (AlonzoEra c)) (PParams (AlonzoEra c))
curPParamsGovStateL = forall era. Lens' (ShelleyGovState era) (PParams era)
curPParamsShelleyGovStateL

  prevPParamsGovStateL :: Lens' (GovState (AlonzoEra c)) (PParams (AlonzoEra c))
prevPParamsGovStateL = forall era. Lens' (ShelleyGovState era) (PParams era)
prevPParamsShelleyGovStateL

  futurePParamsGovStateL :: Lens' (GovState (AlonzoEra c)) (FuturePParams (AlonzoEra c))
futurePParamsGovStateL = forall era. Lens' (ShelleyGovState era) (FuturePParams era)
futurePParamsShelleyGovStateL

  obligationGovState :: GovState (AlonzoEra c) -> Obligations
obligationGovState = forall a b. a -> b -> a
const forall a. Monoid a => a
mempty

instance Era era => EncCBOR (AlonzoPParams Identity era) where
  encCBOR :: AlonzoPParams Identity era -> Encoding
encCBOR AlonzoPParams {HKD Identity Natural
HKD Identity Word16
HKD Identity Word32
HKD Identity Prices
HKD Identity Coin
HKD Identity ProtVer
HKD Identity NonNegativeInterval
HKD Identity UnitInterval
HKD Identity Nonce
HKD Identity CostModels
HKD Identity EpochInterval
HKD Identity OrdExUnits
HKD Identity CoinPerWord
appMaxCollateralInputs :: HKD Identity Natural
appCollateralPercentage :: HKD Identity Natural
appMaxValSize :: HKD Identity Natural
appMaxBlockExUnits :: HKD Identity OrdExUnits
appMaxTxExUnits :: HKD Identity OrdExUnits
appPrices :: HKD Identity Prices
appCostModels :: HKD Identity CostModels
appCoinsPerUTxOWord :: HKD Identity CoinPerWord
appMinPoolCost :: HKD Identity Coin
appProtocolVersion :: HKD Identity ProtVer
appExtraEntropy :: HKD Identity Nonce
appD :: HKD Identity UnitInterval
appTau :: HKD Identity UnitInterval
appRho :: HKD Identity UnitInterval
appA0 :: HKD Identity NonNegativeInterval
appNOpt :: HKD Identity Natural
appEMax :: HKD Identity EpochInterval
appPoolDeposit :: HKD Identity Coin
appKeyDeposit :: HKD Identity Coin
appMaxBHSize :: HKD Identity Word16
appMaxTxSize :: HKD Identity Word32
appMaxBBSize :: HKD Identity Word32
appMinFeeB :: HKD Identity Coin
appMinFeeA :: HKD Identity Coin
appMaxCollateralInputs :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appCollateralPercentage :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appMaxValSize :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appMaxBlockExUnits :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f OrdExUnits
appMaxTxExUnits :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f OrdExUnits
appPrices :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Prices
appCostModels :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f CostModels
appCoinsPerUTxOWord :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f CoinPerWord
appMinPoolCost :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appProtocolVersion :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f ProtVer
appExtraEntropy :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Nonce
appD :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appTau :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appRho :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appA0 :: forall (f :: * -> *) era.
AlonzoPParams f era -> HKD f NonNegativeInterval
appNOpt :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appEMax :: forall (f :: * -> *) era.
AlonzoPParams f era -> HKD f EpochInterval
appPoolDeposit :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appKeyDeposit :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMaxBHSize :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word16
appMaxTxSize :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word32
appMaxBBSize :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word32
appMinFeeB :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMinFeeA :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
..} =
    Word -> Encoding
encodeListLen (Word
23 forall a. Num a => a -> a -> a
+ forall a. EncCBORGroup a => a -> Word
listLen HKD Identity ProtVer
appProtocolVersion)
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Coin
appMinFeeA
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Coin
appMinFeeB
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Word32
appMaxBBSize
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Word32
appMaxTxSize
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Word16
appMaxBHSize
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Coin
appKeyDeposit
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Coin
appPoolDeposit
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity EpochInterval
appEMax
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Natural
appNOpt
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity NonNegativeInterval
appA0
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity UnitInterval
appRho
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity UnitInterval
appTau
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity UnitInterval
appD
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Nonce
appExtraEntropy
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBORGroup a => a -> Encoding
encCBORGroup HKD Identity ProtVer
appProtocolVersion
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Coin
appMinPoolCost
      -- new/updated for alonzo
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity CoinPerWord
appCoinsPerUTxOWord
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity CostModels
appCostModels
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Prices
appPrices
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity OrdExUnits
appMaxTxExUnits
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity OrdExUnits
appMaxBlockExUnits
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Natural
appMaxValSize
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Natural
appCollateralPercentage
      forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> Encoding
encCBOR HKD Identity Natural
appMaxCollateralInputs

instance Era era => DecCBOR (AlonzoPParams Identity era) where
  decCBOR :: forall s. Decoder s (AlonzoPParams Identity era)
decCBOR =
    forall a s. Text -> (a -> Int) -> Decoder s a -> Decoder s a
decodeRecordNamed Text
"PParams" (\AlonzoPParams Identity era
pp -> Int
23 forall a. Num a => a -> a -> a
+ forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. EncCBORGroup a => a -> Word
listLen (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f ProtVer
appProtocolVersion AlonzoPParams Identity era
pp))) forall a b. (a -> b) -> a -> b
$ do
      Coin
appMinFeeA <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Coin
appMinFeeB <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Word32
appMaxBBSize <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Word32
appMaxTxSize <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Word16
appMaxBHSize <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Coin
appKeyDeposit <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Coin
appPoolDeposit <- forall a s. DecCBOR a => Decoder s a
decCBOR
      EpochInterval
appEMax <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Natural
appNOpt <- forall a s. DecCBOR a => Decoder s a
decCBOR
      NonNegativeInterval
appA0 <- forall a s. DecCBOR a => Decoder s a
decCBOR
      UnitInterval
appRho <- forall a s. DecCBOR a => Decoder s a
decCBOR
      UnitInterval
appTau <- forall a s. DecCBOR a => Decoder s a
decCBOR
      UnitInterval
appD <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Nonce
appExtraEntropy <- forall a s. DecCBOR a => Decoder s a
decCBOR
      ProtVer
appProtocolVersion <- forall a s. DecCBORGroup a => Decoder s a
decCBORGroup
      Coin
appMinPoolCost <- forall a s. DecCBOR a => Decoder s a
decCBOR
      -- new/updated for alonzo
      CoinPerWord
appCoinsPerUTxOWord <- forall a s. DecCBOR a => Decoder s a
decCBOR
      CostModels
appCostModels <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Prices
appPrices <- forall a s. DecCBOR a => Decoder s a
decCBOR
      OrdExUnits
appMaxTxExUnits <- forall a s. DecCBOR a => Decoder s a
decCBOR
      OrdExUnits
appMaxBlockExUnits <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Natural
appMaxValSize <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Natural
appCollateralPercentage <- forall a s. DecCBOR a => Decoder s a
decCBOR
      Natural
appMaxCollateralInputs <- forall a s. DecCBOR a => Decoder s a
decCBOR
      forall (f :: * -> *) a. Applicative f => a -> f a
pure AlonzoPParams {Natural
Word16
Word32
Prices
Coin
ProtVer
NonNegativeInterval
UnitInterval
Nonce
CostModels
EpochInterval
OrdExUnits
CoinPerWord
appMaxCollateralInputs :: Natural
appCollateralPercentage :: Natural
appMaxValSize :: Natural
appMaxBlockExUnits :: OrdExUnits
appMaxTxExUnits :: OrdExUnits
appPrices :: Prices
appCostModels :: CostModels
appCoinsPerUTxOWord :: CoinPerWord
appMinPoolCost :: Coin
appProtocolVersion :: ProtVer
appExtraEntropy :: Nonce
appD :: UnitInterval
appTau :: UnitInterval
appRho :: UnitInterval
appA0 :: NonNegativeInterval
appNOpt :: Natural
appEMax :: EpochInterval
appPoolDeposit :: Coin
appKeyDeposit :: Coin
appMaxBHSize :: Word16
appMaxTxSize :: Word32
appMaxBBSize :: Word32
appMinFeeB :: Coin
appMinFeeA :: Coin
appMaxCollateralInputs :: HKD Identity Natural
appCollateralPercentage :: HKD Identity Natural
appMaxValSize :: HKD Identity Natural
appMaxBlockExUnits :: HKD Identity OrdExUnits
appMaxTxExUnits :: HKD Identity OrdExUnits
appPrices :: HKD Identity Prices
appCostModels :: HKD Identity CostModels
appCoinsPerUTxOWord :: HKD Identity CoinPerWord
appMinPoolCost :: HKD Identity Coin
appProtocolVersion :: HKD Identity ProtVer
appExtraEntropy :: HKD Identity Nonce
appD :: HKD Identity UnitInterval
appTau :: HKD Identity UnitInterval
appRho :: HKD Identity UnitInterval
appA0 :: HKD Identity NonNegativeInterval
appNOpt :: HKD Identity Natural
appEMax :: HKD Identity EpochInterval
appPoolDeposit :: HKD Identity Coin
appKeyDeposit :: HKD Identity Coin
appMaxBHSize :: HKD Identity Word16
appMaxTxSize :: HKD Identity Word32
appMaxBBSize :: HKD Identity Word32
appMinFeeB :: HKD Identity Coin
appMinFeeA :: HKD Identity Coin
..}

instance Era era => ToCBOR (AlonzoPParams Identity era) where
  toCBOR :: AlonzoPParams Identity era -> Encoding
toCBOR = forall era t. (Era era, EncCBOR t) => t -> Encoding
toEraCBOR @era

instance Era era => FromCBOR (AlonzoPParams Identity era) where
  fromCBOR :: forall s. Decoder s (AlonzoPParams Identity era)
fromCBOR = forall era t s. (Era era, DecCBOR t) => Decoder s t
fromEraCBOR @era

instance Crypto c => ToJSON (AlonzoPParams Identity (AlonzoEra c)) where
  toJSON :: AlonzoPParams Identity (AlonzoEra c) -> Value
toJSON = [Pair] -> Value
object forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c a e.
(Crypto c, KeyValue e a) =>
PParamsHKD Identity (AlonzoEra c) -> [a]
alonzoPParamsPairs
  toEncoding :: AlonzoPParams Identity (AlonzoEra c) -> Encoding
toEncoding = Series -> Encoding
pairs forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Monoid a => [a] -> a
mconcat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c a e.
(Crypto c, KeyValue e a) =>
PParamsHKD Identity (AlonzoEra c) -> [a]
alonzoPParamsPairs

alonzoPParamsPairs ::
  forall c a e.
  (Crypto c, KeyValue e a) =>
  PParamsHKD Identity (AlonzoEra c) ->
  [a]
alonzoPParamsPairs :: forall c a e.
(Crypto c, KeyValue e a) =>
PParamsHKD Identity (AlonzoEra c) -> [a]
alonzoPParamsPairs PParamsHKD Identity (AlonzoEra c)
pp =
  forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(.=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (f :: * -> *) c.
(HKDFunctor f, Crypto c) =>
Proxy f -> PParamsHKD f (AlonzoEra c) -> [(Key, HKD f Value)]
alonzoPParamsHKDPairs (forall {k} (t :: k). Proxy t
Proxy @Identity) PParamsHKD Identity (AlonzoEra c)
pp

instance FromJSON (AlonzoPParams Identity era) where
  parseJSON :: Value -> Parser (AlonzoPParams Identity era)
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"PParams" forall a b. (a -> b) -> a -> b
$ \Object
obj ->
      forall (f :: * -> *) era.
HKD f Coin
-> HKD f Coin
-> HKD f Word32
-> HKD f Word32
-> HKD f Word16
-> HKD f Coin
-> HKD f Coin
-> HKD f EpochInterval
-> HKD f Natural
-> HKD f NonNegativeInterval
-> HKD f UnitInterval
-> HKD f UnitInterval
-> HKD f UnitInterval
-> HKD f Nonce
-> HKD f ProtVer
-> HKD f Coin
-> HKD f CoinPerWord
-> HKD f CostModels
-> HKD f Prices
-> HKD f OrdExUnits
-> HKD f OrdExUnits
-> HKD f Natural
-> HKD f Natural
-> HKD f Natural
-> AlonzoPParams f era
AlonzoPParams
        forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"txFeePerByte"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"txFeeFixed"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"maxBlockBodySize"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"maxTxSize"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"maxBlockHeaderSize"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"stakeAddressDeposit"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"stakePoolDeposit"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"poolRetireMaxEpoch"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"stakePoolTargetNum"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"poolPledgeInfluence"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"monetaryExpansion"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"treasuryCut"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"decentralization"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"extraPraosEntropy"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"protocolVersion"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"minPoolCost" forall a. Parser (Maybe a) -> a -> Parser a
.!= forall a. Monoid a => a
mempty
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"utxoCostPerByte"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"costModels"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"executionUnitPrices"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"maxTxExecutionUnits"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"maxBlockExecutionUnits"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"maxValueSize"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"collateralPercentage"
        forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
obj forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"maxCollateralInputs"

newtype CoinPerWord = CoinPerWord {CoinPerWord -> Coin
unCoinPerWord :: Coin}
  deriving stock (CoinPerWord -> CoinPerWord -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CoinPerWord -> CoinPerWord -> Bool
$c/= :: CoinPerWord -> CoinPerWord -> Bool
== :: CoinPerWord -> CoinPerWord -> Bool
$c== :: CoinPerWord -> CoinPerWord -> Bool
Eq, Eq CoinPerWord
CoinPerWord -> CoinPerWord -> Bool
CoinPerWord -> CoinPerWord -> Ordering
CoinPerWord -> CoinPerWord -> CoinPerWord
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CoinPerWord -> CoinPerWord -> CoinPerWord
$cmin :: CoinPerWord -> CoinPerWord -> CoinPerWord
max :: CoinPerWord -> CoinPerWord -> CoinPerWord
$cmax :: CoinPerWord -> CoinPerWord -> CoinPerWord
>= :: CoinPerWord -> CoinPerWord -> Bool
$c>= :: CoinPerWord -> CoinPerWord -> Bool
> :: CoinPerWord -> CoinPerWord -> Bool
$c> :: CoinPerWord -> CoinPerWord -> Bool
<= :: CoinPerWord -> CoinPerWord -> Bool
$c<= :: CoinPerWord -> CoinPerWord -> Bool
< :: CoinPerWord -> CoinPerWord -> Bool
$c< :: CoinPerWord -> CoinPerWord -> Bool
compare :: CoinPerWord -> CoinPerWord -> Ordering
$ccompare :: CoinPerWord -> CoinPerWord -> Ordering
Ord)
  deriving newtype (Typeable CoinPerWord
CoinPerWord -> Encoding
(forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [CoinPerWord] -> Size
(forall t. EncCBOR t => Proxy t -> Size)
-> Proxy CoinPerWord -> Size
forall a.
Typeable a
-> (a -> Encoding)
-> ((forall t. EncCBOR t => Proxy t -> Size) -> Proxy a -> Size)
-> ((forall t. EncCBOR t => Proxy t -> Size) -> Proxy [a] -> Size)
-> EncCBOR a
encodedListSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [CoinPerWord] -> Size
$cencodedListSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [CoinPerWord] -> Size
encodedSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy CoinPerWord -> Size
$cencodedSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy CoinPerWord -> Size
encCBOR :: CoinPerWord -> Encoding
$cencCBOR :: CoinPerWord -> Encoding
EncCBOR, Typeable CoinPerWord
Proxy CoinPerWord -> Text
forall s. Decoder s CoinPerWord
forall a.
Typeable a
-> (forall s. Decoder s a)
-> (forall s. Proxy a -> Decoder s ())
-> (Proxy a -> Text)
-> DecCBOR a
forall s. Proxy CoinPerWord -> Decoder s ()
label :: Proxy CoinPerWord -> Text
$clabel :: Proxy CoinPerWord -> Text
dropCBOR :: forall s. Proxy CoinPerWord -> Decoder s ()
$cdropCBOR :: forall s. Proxy CoinPerWord -> Decoder s ()
decCBOR :: forall s. Decoder s CoinPerWord
$cdecCBOR :: forall s. Decoder s CoinPerWord
DecCBOR, [CoinPerWord] -> Encoding
[CoinPerWord] -> Value
CoinPerWord -> Bool
CoinPerWord -> Encoding
CoinPerWord -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
omitField :: CoinPerWord -> Bool
$comitField :: CoinPerWord -> Bool
toEncodingList :: [CoinPerWord] -> Encoding
$ctoEncodingList :: [CoinPerWord] -> Encoding
toJSONList :: [CoinPerWord] -> Value
$ctoJSONList :: [CoinPerWord] -> Value
toEncoding :: CoinPerWord -> Encoding
$ctoEncoding :: CoinPerWord -> Encoding
toJSON :: CoinPerWord -> Value
$ctoJSON :: CoinPerWord -> Value
ToJSON, Maybe CoinPerWord
Value -> Parser [CoinPerWord]
Value -> Parser CoinPerWord
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
omittedField :: Maybe CoinPerWord
$comittedField :: Maybe CoinPerWord
parseJSONList :: Value -> Parser [CoinPerWord]
$cparseJSONList :: Value -> Parser [CoinPerWord]
parseJSON :: Value -> Parser CoinPerWord
$cparseJSON :: Value -> Parser CoinPerWord
FromJSON, CoinPerWord -> ()
forall a. (a -> ()) -> NFData a
rnf :: CoinPerWord -> ()
$crnf :: CoinPerWord -> ()
NFData, Context -> CoinPerWord -> IO (Maybe ThunkInfo)
Proxy CoinPerWord -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy CoinPerWord -> String
$cshowTypeOf :: Proxy CoinPerWord -> String
wNoThunks :: Context -> CoinPerWord -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> CoinPerWord -> IO (Maybe ThunkInfo)
noThunks :: Context -> CoinPerWord -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> CoinPerWord -> IO (Maybe ThunkInfo)
NoThunks, Int -> CoinPerWord -> ShowS
[CoinPerWord] -> ShowS
CoinPerWord -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CoinPerWord] -> ShowS
$cshowList :: [CoinPerWord] -> ShowS
show :: CoinPerWord -> String
$cshow :: CoinPerWord -> String
showsPrec :: Int -> CoinPerWord -> ShowS
$cshowsPrec :: Int -> CoinPerWord -> ShowS
Show)

-- | This is a helper type that allows us to define an `Ord` instance for executions units
-- without affecting the `ExUnits` type. This is needed in order to derive an `Ord` instance`
-- for PParams. This is just a helper type and should not be used directly. Both lenses
-- that operate on TxExUnits and BlockExUnits use the `ExUnits` type, not this one.
newtype OrdExUnits = OrdExUnits {OrdExUnits -> ExUnits
unOrdExUnits :: ExUnits}
  deriving (OrdExUnits -> OrdExUnits -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrdExUnits -> OrdExUnits -> Bool
$c/= :: OrdExUnits -> OrdExUnits -> Bool
== :: OrdExUnits -> OrdExUnits -> Bool
$c== :: OrdExUnits -> OrdExUnits -> Bool
Eq)
  deriving newtype (Int -> OrdExUnits -> ShowS
[OrdExUnits] -> ShowS
OrdExUnits -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrdExUnits] -> ShowS
$cshowList :: [OrdExUnits] -> ShowS
show :: OrdExUnits -> String
$cshow :: OrdExUnits -> String
showsPrec :: Int -> OrdExUnits -> ShowS
$cshowsPrec :: Int -> OrdExUnits -> ShowS
Show, Context -> OrdExUnits -> IO (Maybe ThunkInfo)
Proxy OrdExUnits -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy OrdExUnits -> String
$cshowTypeOf :: Proxy OrdExUnits -> String
wNoThunks :: Context -> OrdExUnits -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> OrdExUnits -> IO (Maybe ThunkInfo)
noThunks :: Context -> OrdExUnits -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> OrdExUnits -> IO (Maybe ThunkInfo)
NoThunks, OrdExUnits -> ()
forall a. (a -> ()) -> NFData a
rnf :: OrdExUnits -> ()
$crnf :: OrdExUnits -> ()
NFData, Typeable OrdExUnits
Proxy OrdExUnits -> Text
forall s. Decoder s OrdExUnits
forall a.
Typeable a
-> (forall s. Decoder s a)
-> (forall s. Proxy a -> Decoder s ())
-> (Proxy a -> Text)
-> DecCBOR a
forall s. Proxy OrdExUnits -> Decoder s ()
label :: Proxy OrdExUnits -> Text
$clabel :: Proxy OrdExUnits -> Text
dropCBOR :: forall s. Proxy OrdExUnits -> Decoder s ()
$cdropCBOR :: forall s. Proxy OrdExUnits -> Decoder s ()
decCBOR :: forall s. Decoder s OrdExUnits
$cdecCBOR :: forall s. Decoder s OrdExUnits
DecCBOR, Typeable OrdExUnits
OrdExUnits -> Encoding
(forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [OrdExUnits] -> Size
(forall t. EncCBOR t => Proxy t -> Size)
-> Proxy OrdExUnits -> Size
forall a.
Typeable a
-> (a -> Encoding)
-> ((forall t. EncCBOR t => Proxy t -> Size) -> Proxy a -> Size)
-> ((forall t. EncCBOR t => Proxy t -> Size) -> Proxy [a] -> Size)
-> EncCBOR a
encodedListSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [OrdExUnits] -> Size
$cencodedListSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy [OrdExUnits] -> Size
encodedSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy OrdExUnits -> Size
$cencodedSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size)
-> Proxy OrdExUnits -> Size
encCBOR :: OrdExUnits -> Encoding
$cencCBOR :: OrdExUnits -> Encoding
EncCBOR, Maybe OrdExUnits
Value -> Parser [OrdExUnits]
Value -> Parser OrdExUnits
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
omittedField :: Maybe OrdExUnits
$comittedField :: Maybe OrdExUnits
parseJSONList :: Value -> Parser [OrdExUnits]
$cparseJSONList :: Value -> Parser [OrdExUnits]
parseJSON :: Value -> Parser OrdExUnits
$cparseJSON :: Value -> Parser OrdExUnits
FromJSON, [OrdExUnits] -> Encoding
[OrdExUnits] -> Value
OrdExUnits -> Bool
OrdExUnits -> Encoding
OrdExUnits -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
omitField :: OrdExUnits -> Bool
$comitField :: OrdExUnits -> Bool
toEncodingList :: [OrdExUnits] -> Encoding
$ctoEncodingList :: [OrdExUnits] -> Encoding
toJSONList :: [OrdExUnits] -> Value
$ctoJSONList :: [OrdExUnits] -> Value
toEncoding :: OrdExUnits -> Encoding
$ctoEncoding :: OrdExUnits -> Encoding
toJSON :: OrdExUnits -> Value
$ctoJSON :: OrdExUnits -> Value
ToJSON)

instance Ord OrdExUnits where
  compare :: OrdExUnits -> OrdExUnits -> Ordering
compare = coerce :: forall a b. Coercible a b => a -> b
coerce (forall a.
Semigroup a =>
(Natural -> Natural -> a) -> ExUnits -> ExUnits -> a
zipSemiExUnits forall a. Ord a => a -> a -> Ordering
compare)

-- | Parameters that were added in Alonzo
data UpgradeAlonzoPParams f = UpgradeAlonzoPParams
  { forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f CoinPerWord
uappCoinsPerUTxOWord :: !(HKD f CoinPerWord)
  , forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f CostModels
uappCostModels :: !(HKD f CostModels)
  , forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f Prices
uappPrices :: !(HKD f Prices)
  , forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f ExUnits
uappMaxTxExUnits :: !(HKD f ExUnits)
  , forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f ExUnits
uappMaxBlockExUnits :: !(HKD f ExUnits)
  , forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f Natural
uappMaxValSize :: !(HKD f Natural)
  , forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f Natural
uappCollateralPercentage :: !(HKD f Natural)
  , forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f Natural
uappMaxCollateralInputs :: !(HKD f Natural)
  }
  deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (f :: * -> *) x.
Rep (UpgradeAlonzoPParams f) x -> UpgradeAlonzoPParams f
forall (f :: * -> *) x.
UpgradeAlonzoPParams f -> Rep (UpgradeAlonzoPParams f) x
$cto :: forall (f :: * -> *) x.
Rep (UpgradeAlonzoPParams f) x -> UpgradeAlonzoPParams f
$cfrom :: forall (f :: * -> *) x.
UpgradeAlonzoPParams f -> Rep (UpgradeAlonzoPParams f) x
Generic)

deriving instance Eq (UpgradeAlonzoPParams Identity)

deriving instance Show (UpgradeAlonzoPParams Identity)

instance NoThunks (UpgradeAlonzoPParams Identity)

instance NFData (UpgradeAlonzoPParams Identity)

instance Default (UpgradeAlonzoPParams StrictMaybe) where
  def :: UpgradeAlonzoPParams StrictMaybe
def =
    UpgradeAlonzoPParams
      { uappCoinsPerUTxOWord :: HKD StrictMaybe CoinPerWord
uappCoinsPerUTxOWord = forall a. StrictMaybe a
SNothing
      , uappCostModels :: HKD StrictMaybe CostModels
uappCostModels = forall a. StrictMaybe a
SNothing
      , uappPrices :: HKD StrictMaybe Prices
uappPrices = forall a. StrictMaybe a
SNothing
      , uappMaxTxExUnits :: HKD StrictMaybe ExUnits
uappMaxTxExUnits = forall a. StrictMaybe a
SNothing
      , uappMaxBlockExUnits :: HKD StrictMaybe ExUnits
uappMaxBlockExUnits = forall a. StrictMaybe a
SNothing
      , uappMaxValSize :: HKD StrictMaybe Natural
uappMaxValSize = forall a. StrictMaybe a
SNothing
      , uappCollateralPercentage :: HKD StrictMaybe Natural
uappCollateralPercentage = forall a. StrictMaybe a
SNothing
      , uappMaxCollateralInputs :: HKD StrictMaybe Natural
uappMaxCollateralInputs = forall a. StrictMaybe a
SNothing
      }

-- | Parameters that were removed in Alonzo
newtype DowngradeAlonzoPParams f = DowngradeAlonzoPParams
  { forall (f :: * -> *). DowngradeAlonzoPParams f -> HKD f Coin
dappMinUTxOValue :: HKD f Coin
  }
  deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (f :: * -> *) x.
Rep (DowngradeAlonzoPParams f) x -> DowngradeAlonzoPParams f
forall (f :: * -> *) x.
DowngradeAlonzoPParams f -> Rep (DowngradeAlonzoPParams f) x
$cto :: forall (f :: * -> *) x.
Rep (DowngradeAlonzoPParams f) x -> DowngradeAlonzoPParams f
$cfrom :: forall (f :: * -> *) x.
DowngradeAlonzoPParams f -> Rep (DowngradeAlonzoPParams f) x
Generic)

deriving instance Eq (DowngradeAlonzoPParams Identity)

deriving instance Show (DowngradeAlonzoPParams Identity)

instance NoThunks (DowngradeAlonzoPParams Identity)

instance NFData (DowngradeAlonzoPParams Identity)

-- | Returns a basic "empty" `PParams` structure with all zero values.
emptyAlonzoPParams :: forall era. Era era => AlonzoPParams Identity era
emptyAlonzoPParams :: forall era. Era era => AlonzoPParams Identity era
emptyAlonzoPParams =
  AlonzoPParams
    { appMinFeeA :: HKD Identity Coin
appMinFeeA = Integer -> Coin
Coin Integer
0
    , appMinFeeB :: HKD Identity Coin
appMinFeeB = Integer -> Coin
Coin Integer
0
    , appMaxBBSize :: HKD Identity Word32
appMaxBBSize = Word32
0
    , appMaxTxSize :: HKD Identity Word32
appMaxTxSize = Word32
2048
    , appMaxBHSize :: HKD Identity Word16
appMaxBHSize = Word16
0
    , appKeyDeposit :: HKD Identity Coin
appKeyDeposit = Integer -> Coin
Coin Integer
0
    , appPoolDeposit :: HKD Identity Coin
appPoolDeposit = Integer -> Coin
Coin Integer
0
    , appEMax :: HKD Identity EpochInterval
appEMax = Word32 -> EpochInterval
EpochInterval Word32
0
    , appNOpt :: HKD Identity Natural
appNOpt = Natural
100
    , appA0 :: HKD Identity NonNegativeInterval
appA0 = forall a. Bounded a => a
minBound
    , appRho :: HKD Identity UnitInterval
appRho = forall a. Bounded a => a
minBound
    , appTau :: HKD Identity UnitInterval
appTau = forall a. Bounded a => a
minBound
    , appD :: HKD Identity UnitInterval
appD = forall a. Bounded a => a
minBound
    , appExtraEntropy :: HKD Identity Nonce
appExtraEntropy = Nonce
NeutralNonce
    , appProtocolVersion :: HKD Identity ProtVer
appProtocolVersion = Version -> Natural -> ProtVer
BT.ProtVer (forall era. Era era => Version
eraProtVerLow @era) Natural
0
    , appMinPoolCost :: HKD Identity Coin
appMinPoolCost = forall a. Monoid a => a
mempty
    , -- new/updated for alonzo
      appCoinsPerUTxOWord :: HKD Identity CoinPerWord
appCoinsPerUTxOWord = Coin -> CoinPerWord
CoinPerWord (Integer -> Coin
Coin Integer
0)
    , appCostModels :: HKD Identity CostModels
appCostModels = CostModels
emptyCostModels
    , appPrices :: HKD Identity Prices
appPrices = NonNegativeInterval -> NonNegativeInterval -> Prices
Prices forall a. Bounded a => a
minBound forall a. Bounded a => a
minBound
    , appMaxTxExUnits :: HKD Identity OrdExUnits
appMaxTxExUnits = ExUnits -> OrdExUnits
OrdExUnits forall a b. (a -> b) -> a -> b
$ Natural -> Natural -> ExUnits
ExUnits Natural
0 Natural
0
    , appMaxBlockExUnits :: HKD Identity OrdExUnits
appMaxBlockExUnits = ExUnits -> OrdExUnits
OrdExUnits forall a b. (a -> b) -> a -> b
$ Natural -> Natural -> ExUnits
ExUnits Natural
0 Natural
0
    , appMaxValSize :: HKD Identity Natural
appMaxValSize = Natural
0
    , appCollateralPercentage :: HKD Identity Natural
appCollateralPercentage = Natural
150
    , appMaxCollateralInputs :: HKD Identity Natural
appMaxCollateralInputs = Natural
5
    }

emptyAlonzoPParamsUpdate :: AlonzoPParams StrictMaybe era
emptyAlonzoPParamsUpdate :: forall era. AlonzoPParams StrictMaybe era
emptyAlonzoPParamsUpdate =
  AlonzoPParams
    { appMinFeeA :: HKD StrictMaybe Coin
appMinFeeA = forall a. StrictMaybe a
SNothing
    , appMinFeeB :: HKD StrictMaybe Coin
appMinFeeB = forall a. StrictMaybe a
SNothing
    , appMaxBBSize :: HKD StrictMaybe Word32
appMaxBBSize = forall a. StrictMaybe a
SNothing
    , appMaxTxSize :: HKD StrictMaybe Word32
appMaxTxSize = forall a. StrictMaybe a
SNothing
    , appMaxBHSize :: HKD StrictMaybe Word16
appMaxBHSize = forall a. StrictMaybe a
SNothing
    , appKeyDeposit :: HKD StrictMaybe Coin
appKeyDeposit = forall a. StrictMaybe a
SNothing
    , appPoolDeposit :: HKD StrictMaybe Coin
appPoolDeposit = forall a. StrictMaybe a
SNothing
    , appEMax :: HKD StrictMaybe EpochInterval
appEMax = forall a. StrictMaybe a
SNothing
    , appNOpt :: HKD StrictMaybe Natural
appNOpt = forall a. StrictMaybe a
SNothing
    , appA0 :: HKD StrictMaybe NonNegativeInterval
appA0 = forall a. StrictMaybe a
SNothing
    , appRho :: HKD StrictMaybe UnitInterval
appRho = forall a. StrictMaybe a
SNothing
    , appTau :: HKD StrictMaybe UnitInterval
appTau = forall a. StrictMaybe a
SNothing
    , appD :: HKD StrictMaybe UnitInterval
appD = forall a. StrictMaybe a
SNothing
    , appExtraEntropy :: HKD StrictMaybe Nonce
appExtraEntropy = forall a. StrictMaybe a
SNothing
    , appProtocolVersion :: HKD StrictMaybe ProtVer
appProtocolVersion = forall a. StrictMaybe a
SNothing
    , appMinPoolCost :: HKD StrictMaybe Coin
appMinPoolCost = forall a. StrictMaybe a
SNothing
    , -- new/updated for alonzo
      appCoinsPerUTxOWord :: HKD StrictMaybe CoinPerWord
appCoinsPerUTxOWord = forall a. StrictMaybe a
SNothing
    , appCostModels :: HKD StrictMaybe CostModels
appCostModels = forall a. StrictMaybe a
SNothing
    , appPrices :: HKD StrictMaybe Prices
appPrices = forall a. StrictMaybe a
SNothing
    , appMaxTxExUnits :: HKD StrictMaybe OrdExUnits
appMaxTxExUnits = forall a. StrictMaybe a
SNothing
    , appMaxBlockExUnits :: HKD StrictMaybe OrdExUnits
appMaxBlockExUnits = forall a. StrictMaybe a
SNothing
    , appMaxValSize :: HKD StrictMaybe Natural
appMaxValSize = forall a. StrictMaybe a
SNothing
    , appCollateralPercentage :: HKD StrictMaybe Natural
appCollateralPercentage = forall a. StrictMaybe a
SNothing
    , appMaxCollateralInputs :: HKD StrictMaybe Natural
appMaxCollateralInputs = forall a. StrictMaybe a
SNothing
    }

-- =======================================================
-- A PParamsUpdate has StrictMaybe fields, we want to Sparse encode it, by
-- writing only those fields where the field is (SJust x), that is the role of
-- the local function (omitStrictMaybe key x)

encodePParamsUpdate ::
  AlonzoPParams StrictMaybe era ->
  Encode ('Closed 'Sparse) (AlonzoPParams StrictMaybe era)
encodePParamsUpdate :: forall era.
AlonzoPParams StrictMaybe era
-> Encode ('Closed 'Sparse) (AlonzoPParams StrictMaybe era)
encodePParamsUpdate AlonzoPParams StrictMaybe era
ppup =
  forall t. t -> Encode ('Closed 'Sparse) t
Keyed forall (f :: * -> *) era.
HKD f Coin
-> HKD f Coin
-> HKD f Word32
-> HKD f Word32
-> HKD f Word16
-> HKD f Coin
-> HKD f Coin
-> HKD f EpochInterval
-> HKD f Natural
-> HKD f NonNegativeInterval
-> HKD f UnitInterval
-> HKD f UnitInterval
-> HKD f UnitInterval
-> HKD f Nonce
-> HKD f ProtVer
-> HKD f Coin
-> HKD f CoinPerWord
-> HKD f CostModels
-> HKD f Prices
-> HKD f OrdExUnits
-> HKD f OrdExUnits
-> HKD f Natural
-> HKD f Natural
-> HKD f Natural
-> AlonzoPParams f era
AlonzoPParams
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
0 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMinFeeA AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
1 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMinFeeB AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
2 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word32
appMaxBBSize AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
3 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word32
appMaxTxSize AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
4 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word16
appMaxBHSize AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
5 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appKeyDeposit AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
6 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appPoolDeposit AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
7 (forall (f :: * -> *) era.
AlonzoPParams f era -> HKD f EpochInterval
appEMax AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
8 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appNOpt AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
9 (forall (f :: * -> *) era.
AlonzoPParams f era -> HKD f NonNegativeInterval
appA0 AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
10 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appRho AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
11 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appTau AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
12 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appD AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
13 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Nonce
appExtraEntropy AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
14 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f ProtVer
appProtocolVersion AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
16 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMinPoolCost AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
17 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f CoinPerWord
appCoinsPerUTxOWord AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
18 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f CostModels
appCostModels AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
19 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Prices
appPrices AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
20 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f OrdExUnits
appMaxTxExUnits AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
21 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f OrdExUnits
appMaxBlockExUnits AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
22 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appMaxValSize AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
23 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appCollateralPercentage AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
    forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode ('Closed r) a -> Encode w t
!> forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
24 (forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appMaxCollateralInputs AlonzoPParams StrictMaybe era
ppup) forall a. EncCBOR a => a -> Encoding
encCBOR
  where
    omitStrictMaybe ::
      Word -> StrictMaybe a -> (a -> Encoding) -> Encode ('Closed 'Sparse) (StrictMaybe a)
    omitStrictMaybe :: forall a.
Word
-> StrictMaybe a
-> (a -> Encoding)
-> Encode ('Closed 'Sparse) (StrictMaybe a)
omitStrictMaybe Word
key StrictMaybe a
x a -> Encoding
enc = forall t.
(t -> Bool)
-> Encode ('Closed 'Sparse) t -> Encode ('Closed 'Sparse) t
Omit forall a. StrictMaybe a -> Bool
isSNothing (forall t.
Word -> Encode ('Closed 'Dense) t -> Encode ('Closed 'Sparse) t
Key Word
key (forall t. (t -> Encoding) -> t -> Encode ('Closed 'Dense) t
E (a -> Encoding
enc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. StrictMaybe a -> a
fromSJust) StrictMaybe a
x))

    fromSJust :: StrictMaybe a -> a
    fromSJust :: forall a. StrictMaybe a -> a
fromSJust (SJust a
x) = a
x
    fromSJust StrictMaybe a
SNothing = forall a. HasCallStack => String -> a
error String
"SNothing in fromSJust. This should never happen, it is guarded by isSNothing."

instance Era era => EncCBOR (AlonzoPParams StrictMaybe era) where
  encCBOR :: AlonzoPParams StrictMaybe era -> Encoding
encCBOR AlonzoPParams StrictMaybe era
ppup = forall (w :: Wrapped) t. Encode w t -> Encoding
encode (forall era.
AlonzoPParams StrictMaybe era
-> Encode ('Closed 'Sparse) (AlonzoPParams StrictMaybe era)
encodePParamsUpdate AlonzoPParams StrictMaybe era
ppup)

updateField :: Word -> Field (AlonzoPParams StrictMaybe era)
updateField :: forall era. Word -> Field (AlonzoPParams StrictMaybe era)
updateField Word
0 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Coin
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appMinFeeA :: HKD StrictMaybe Coin
appMinFeeA = forall a. a -> StrictMaybe a
SJust Coin
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
1 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Coin
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appMinFeeB :: HKD StrictMaybe Coin
appMinFeeB = forall a. a -> StrictMaybe a
SJust Coin
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
2 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Word32
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appMaxBBSize :: HKD StrictMaybe Word32
appMaxBBSize = forall a. a -> StrictMaybe a
SJust Word32
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
3 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Word32
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appMaxTxSize :: HKD StrictMaybe Word32
appMaxTxSize = forall a. a -> StrictMaybe a
SJust Word32
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
4 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Word16
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appMaxBHSize :: HKD StrictMaybe Word16
appMaxBHSize = forall a. a -> StrictMaybe a
SJust Word16
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
5 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Coin
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appKeyDeposit :: HKD StrictMaybe Coin
appKeyDeposit = forall a. a -> StrictMaybe a
SJust Coin
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
6 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Coin
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appPoolDeposit :: HKD StrictMaybe Coin
appPoolDeposit = forall a. a -> StrictMaybe a
SJust Coin
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
7 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\EpochInterval
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appEMax :: HKD StrictMaybe EpochInterval
appEMax = forall a. a -> StrictMaybe a
SJust EpochInterval
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
8 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Natural
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appNOpt :: HKD StrictMaybe Natural
appNOpt = forall a. a -> StrictMaybe a
SJust Natural
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
9 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\NonNegativeInterval
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appA0 :: HKD StrictMaybe NonNegativeInterval
appA0 = forall a. a -> StrictMaybe a
SJust NonNegativeInterval
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
10 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\UnitInterval
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appRho :: HKD StrictMaybe UnitInterval
appRho = forall a. a -> StrictMaybe a
SJust UnitInterval
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
11 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\UnitInterval
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appTau :: HKD StrictMaybe UnitInterval
appTau = forall a. a -> StrictMaybe a
SJust UnitInterval
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
12 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\UnitInterval
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appD :: HKD StrictMaybe UnitInterval
appD = forall a. a -> StrictMaybe a
SJust UnitInterval
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
13 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Nonce
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appExtraEntropy :: HKD StrictMaybe Nonce
appExtraEntropy = forall a. a -> StrictMaybe a
SJust Nonce
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
14 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\ProtVer
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appProtocolVersion :: HKD StrictMaybe ProtVer
appProtocolVersion = forall a. a -> StrictMaybe a
SJust ProtVer
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
16 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Coin
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appMinPoolCost :: HKD StrictMaybe Coin
appMinPoolCost = forall a. a -> StrictMaybe a
SJust Coin
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
17 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\CoinPerWord
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appCoinsPerUTxOWord :: HKD StrictMaybe CoinPerWord
appCoinsPerUTxOWord = forall a. a -> StrictMaybe a
SJust CoinPerWord
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
18 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\CostModels
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appCostModels :: HKD StrictMaybe CostModels
appCostModels = forall a. a -> StrictMaybe a
SJust CostModels
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
19 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Prices
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appPrices :: HKD StrictMaybe Prices
appPrices = forall a. a -> StrictMaybe a
SJust Prices
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
20 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\OrdExUnits
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appMaxTxExUnits :: HKD StrictMaybe OrdExUnits
appMaxTxExUnits = forall a. a -> StrictMaybe a
SJust OrdExUnits
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
21 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\OrdExUnits
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appMaxBlockExUnits :: HKD StrictMaybe OrdExUnits
appMaxBlockExUnits = forall a. a -> StrictMaybe a
SJust OrdExUnits
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
22 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Natural
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appMaxValSize :: HKD StrictMaybe Natural
appMaxValSize = forall a. a -> StrictMaybe a
SJust Natural
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
23 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Natural
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appCollateralPercentage :: HKD StrictMaybe Natural
appCollateralPercentage = forall a. a -> StrictMaybe a
SJust Natural
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
24 = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Natural
x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up {appMaxCollateralInputs :: HKD StrictMaybe Natural
appMaxCollateralInputs = forall a. a -> StrictMaybe a
SJust Natural
x}) forall t (w :: Wrapped). DecCBOR t => Decode w t
From
updateField Word
k = forall x t (d :: Density).
(x -> t -> t) -> Decode ('Closed d) x -> Field t
field (\Any
_x AlonzoPParams StrictMaybe era
up -> AlonzoPParams StrictMaybe era
up) (forall (w :: Wrapped) t. Word -> Decode w t
Invalid Word
k)

instance Era era => DecCBOR (AlonzoPParams StrictMaybe era) where
  decCBOR :: forall s. Decoder s (AlonzoPParams StrictMaybe era)
decCBOR =
    forall (w :: Wrapped) t s. Decode w t -> Decoder s t
decode (forall t.
Typeable t =>
String
-> t
-> (Word -> Field t)
-> [(Word, String)]
-> Decode ('Closed 'Dense) t
SparseKeyed String
"PParamsUpdate" forall era. AlonzoPParams StrictMaybe era
emptyAlonzoPParamsUpdate forall era. Word -> Field (AlonzoPParams StrictMaybe era)
updateField [])

instance Era era => ToCBOR (AlonzoPParams StrictMaybe era) where
  toCBOR :: AlonzoPParams StrictMaybe era -> Encoding
toCBOR = forall era t. (Era era, EncCBOR t) => t -> Encoding
toEraCBOR @era

instance Era era => FromCBOR (AlonzoPParams StrictMaybe era) where
  fromCBOR :: forall s. Decoder s (AlonzoPParams StrictMaybe era)
fromCBOR = forall era t s. (Era era, DecCBOR t) => Decoder s t
fromEraCBOR @era

instance Crypto c => ToJSON (AlonzoPParams StrictMaybe (AlonzoEra c)) where
  toJSON :: AlonzoPParams StrictMaybe (AlonzoEra c) -> Value
toJSON = [Pair] -> Value
object forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c a e.
(Crypto c, KeyValue e a) =>
PParamsHKD StrictMaybe (AlonzoEra c) -> [a]
alonzoPParamsUpdatePairs
  toEncoding :: AlonzoPParams StrictMaybe (AlonzoEra c) -> Encoding
toEncoding = Series -> Encoding
pairs forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Monoid a => [a] -> a
mconcat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c a e.
(Crypto c, KeyValue e a) =>
PParamsHKD StrictMaybe (AlonzoEra c) -> [a]
alonzoPParamsUpdatePairs

alonzoPParamsUpdatePairs ::
  forall c a e.
  (Crypto c, KeyValue e a) =>
  PParamsHKD StrictMaybe (AlonzoEra c) ->
  [a]
alonzoPParamsUpdatePairs :: forall c a e.
(Crypto c, KeyValue e a) =>
PParamsHKD StrictMaybe (AlonzoEra c) -> [a]
alonzoPParamsUpdatePairs PParamsHKD StrictMaybe (AlonzoEra c)
pp =
  [ Key
k forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Value
v
  | (Key
k, SJust Value
v) <- forall (f :: * -> *) c.
(HKDFunctor f, Crypto c) =>
Proxy f -> PParamsHKD f (AlonzoEra c) -> [(Key, HKD f Value)]
alonzoPParamsHKDPairs (forall {k} (t :: k). Proxy t
Proxy @StrictMaybe) PParamsHKD StrictMaybe (AlonzoEra c)
pp
  ]

alonzoPParamsHKDPairs ::
  forall f c.
  (HKDFunctor f, Crypto c) =>
  Proxy f ->
  PParamsHKD f (AlonzoEra c) ->
  [(Key, HKD f Aeson.Value)]
alonzoPParamsHKDPairs :: forall (f :: * -> *) c.
(HKDFunctor f, Crypto c) =>
Proxy f -> PParamsHKD f (AlonzoEra c) -> [(Key, HKD f Value)]
alonzoPParamsHKDPairs Proxy f
px PParamsHKD f (AlonzoEra c)
pp =
  forall (f :: * -> *) era.
(HKDFunctor f, AlonzoEraPParams era) =>
Proxy f -> PParamsHKD f era -> [(Key, HKD f Value)]
alonzoCommonPParamsHKDPairs Proxy f
px PParamsHKD f (AlonzoEra c)
pp
    forall a. [a] -> [a] -> [a]
++ forall (f :: * -> *) era.
(HKDFunctor f, EraPParams era, ProtVerAtMost era 8) =>
Proxy f -> PParamsHKD f era -> [(Key, HKD f Value)]
shelleyCommonPParamsHKDPairsV8 Proxy f
px PParamsHKD f (AlonzoEra c)
pp
    forall a. [a] -> [a] -> [a]
++ forall (f :: * -> *) era.
(HKDFunctor f, EraPParams era, ProtVerAtMost era 6) =>
Proxy f -> PParamsHKD f era -> [(Key, HKD f Value)]
shelleyCommonPParamsHKDPairsV6 Proxy f
px PParamsHKD f (AlonzoEra c)
pp
    forall a. [a] -> [a] -> [a]
++ [(Key
"utxoCostPerByte", forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap Proxy f
px (forall a. ToJSON a => a -> Value
toJSON @CoinPerWord) (PParamsHKD f (AlonzoEra c)
pp forall s a. s -> Getting a s a -> a
^. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f, ExactEra AlonzoEra era) =>
Lens' (PParamsHKD f era) (HKD f CoinPerWord)
hkdCoinsPerUTxOWordL @_ @f))]

-- | These are the fields that are common across all eras starting with Alonzo.
alonzoCommonPParamsHKDPairs ::
  forall f era.
  (HKDFunctor f, AlonzoEraPParams era) =>
  Proxy f ->
  PParamsHKD f era ->
  [(Key, HKD f Aeson.Value)]
alonzoCommonPParamsHKDPairs :: forall (f :: * -> *) era.
(HKDFunctor f, AlonzoEraPParams era) =>
Proxy f -> PParamsHKD f era -> [(Key, HKD f Value)]
alonzoCommonPParamsHKDPairs Proxy f
px PParamsHKD f era
pp =
  forall (f :: * -> *) era.
(HKDFunctor f, EraPParams era) =>
Proxy f -> PParamsHKD f era -> [(Key, HKD f Value)]
shelleyCommonPParamsHKDPairs Proxy f
px PParamsHKD f era
pp
    forall a. [a] -> [a] -> [a]
++ [ (Key
"costModels", forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap Proxy f
px (forall a. ToJSON a => a -> Value
toJSON @CostModels) (PParamsHKD f era
pp forall s a. s -> Getting a s a -> a
^. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f CostModels)
hkdCostModelsL @era @f))
       , (Key
"executionUnitPrices", forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap Proxy f
px (forall a. ToJSON a => a -> Value
toJSON @Prices) (PParamsHKD f era
pp forall s a. s -> Getting a s a -> a
^. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Prices)
hkdPricesL @era @f))
       , (Key
"maxTxExecutionUnits", forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap Proxy f
px (forall a. ToJSON a => a -> Value
toJSON @ExUnits) (PParamsHKD f era
pp forall s a. s -> Getting a s a -> a
^. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f ExUnits)
hkdMaxTxExUnitsL @era @f))
       , (Key
"maxBlockExecutionUnits", forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap Proxy f
px (forall a. ToJSON a => a -> Value
toJSON @ExUnits) (PParamsHKD f era
pp forall s a. s -> Getting a s a -> a
^. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f ExUnits)
hkdMaxBlockExUnitsL @era @f))
       , (Key
"maxValueSize", forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap Proxy f
px (forall a. ToJSON a => a -> Value
toJSON @Natural) (PParamsHKD f era
pp forall s a. s -> Getting a s a -> a
^. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Natural)
hkdMaxValSizeL @era @f))
       , (Key
"collateralPercentage", forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap Proxy f
px (forall a. ToJSON a => a -> Value
toJSON @Natural) (PParamsHKD f era
pp forall s a. s -> Getting a s a -> a
^. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Natural)
hkdCollateralPercentageL @era @f))
       , (Key
"maxCollateralInputs", forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap Proxy f
px (forall a. ToJSON a => a -> Value
toJSON @Natural) (PParamsHKD f era
pp forall s a. s -> Getting a s a -> a
^. forall era (f :: * -> *).
(AlonzoEraPParams era, HKDFunctor f) =>
Lens' (PParamsHKD f era) (HKD f Natural)
hkdMaxCollateralInputsL @era @f))
       ]

-- ===================================================
-- Figure 1: "Definitions Used in Protocol Parameters"

-- The LangDepView is a key value pair. The key is the (canonically) encoded
-- language tag and the value is the (canonically) encoded set of relevant
-- protocol parameters
data LangDepView = LangDepView {LangDepView -> ByteString
tag :: ByteString, LangDepView -> ByteString
params :: ByteString}
  deriving (LangDepView -> LangDepView -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LangDepView -> LangDepView -> Bool
$c/= :: LangDepView -> LangDepView -> Bool
== :: LangDepView -> LangDepView -> Bool
$c== :: LangDepView -> LangDepView -> Bool
Eq, Int -> LangDepView -> ShowS
[LangDepView] -> ShowS
LangDepView -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LangDepView] -> ShowS
$cshowList :: [LangDepView] -> ShowS
show :: LangDepView -> String
$cshow :: LangDepView -> String
showsPrec :: Int -> LangDepView -> ShowS
$cshowsPrec :: Int -> LangDepView -> ShowS
Show, Eq LangDepView
LangDepView -> LangDepView -> Bool
LangDepView -> LangDepView -> Ordering
LangDepView -> LangDepView -> LangDepView
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: LangDepView -> LangDepView -> LangDepView
$cmin :: LangDepView -> LangDepView -> LangDepView
max :: LangDepView -> LangDepView -> LangDepView
$cmax :: LangDepView -> LangDepView -> LangDepView
>= :: LangDepView -> LangDepView -> Bool
$c>= :: LangDepView -> LangDepView -> Bool
> :: LangDepView -> LangDepView -> Bool
$c> :: LangDepView -> LangDepView -> Bool
<= :: LangDepView -> LangDepView -> Bool
$c<= :: LangDepView -> LangDepView -> Bool
< :: LangDepView -> LangDepView -> Bool
$c< :: LangDepView -> LangDepView -> Bool
compare :: LangDepView -> LangDepView -> Ordering
$ccompare :: LangDepView -> LangDepView -> Ordering
Ord, forall x. Rep LangDepView x -> LangDepView
forall x. LangDepView -> Rep LangDepView x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LangDepView x -> LangDepView
$cfrom :: forall x. LangDepView -> Rep LangDepView x
Generic, Context -> LangDepView -> IO (Maybe ThunkInfo)
Proxy LangDepView -> String
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy LangDepView -> String
$cshowTypeOf :: Proxy LangDepView -> String
wNoThunks :: Context -> LangDepView -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> LangDepView -> IO (Maybe ThunkInfo)
noThunks :: Context -> LangDepView -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> LangDepView -> IO (Maybe ThunkInfo)
NoThunks)

encodeCostModel :: CostModel -> Encoding
encodeCostModel :: CostModel -> Encoding
encodeCostModel CostModel
cm =
  case CostModel -> Language
getCostModelLanguage CostModel
cm of
    -- In the Alonzo era, the map of languages to cost models was mistakenly encoded
    -- using an indefinite CBOR map (contrary to canonical CBOR, as intended) when
    -- computing the script integrity hash.
    -- For this reason, PlutusV1 remains with this encoding.
    -- Future versions of Plutus, starting with PlutusV2 in the Babbage era, will
    -- use the intended definite length encoding.
    Language
PlutusV1 -> forall (f :: * -> *) a.
Foldable f =>
(a -> Encoding) -> f a -> Encoding
encodeFoldableAsIndefLenList forall a. EncCBOR a => a -> Encoding
encCBOR forall a b. (a -> b) -> a -> b
$ CostModel -> [Int64]
getCostModelParams CostModel
cm
    -- Since cost model serializations need to be independently reproduced,
    -- we use the 'canonical' serialization with definite list length.
    Language
PlutusV2 -> forall (f :: * -> *) a.
Foldable f =>
(a -> Encoding) -> f a -> Encoding
encodeFoldableAsDefLenList forall a. EncCBOR a => a -> Encoding
encCBOR forall a b. (a -> b) -> a -> b
$ CostModel -> [Int64]
getCostModelParams CostModel
cm
    Language
PlutusV3 -> forall (f :: * -> *) a.
Foldable f =>
(a -> Encoding) -> f a -> Encoding
encodeFoldableAsDefLenList forall a. EncCBOR a => a -> Encoding
encCBOR forall a b. (a -> b) -> a -> b
$ CostModel -> [Int64]
getCostModelParams CostModel
cm

getLanguageView ::
  AlonzoEraPParams era =>
  PParams era ->
  Language ->
  LangDepView
getLanguageView :: forall era.
AlonzoEraPParams era =>
PParams era -> Language -> LangDepView
getLanguageView PParams era
pp Language
lang =
  case Language
lang of
    Language
PlutusV1 ->
      ByteString -> ByteString -> LangDepView
LangDepView -- The silly double bagging is to keep compatibility with a past bug
        (forall a. EncCBOR a => Version -> a -> ByteString
serialize' Version
version (forall a. EncCBOR a => Version -> a -> ByteString
serialize' Version
version Language
lang))
        (forall a. EncCBOR a => Version -> a -> ByteString
serialize' Version
version ByteString
costModelEncoding)
    Language
PlutusV2 -> LangDepView
latestLangDepView
    Language
PlutusV3 -> LangDepView
latestLangDepView
  where
    -- LangDepView for PlutusV1 differs from the rest
    latestLangDepView :: LangDepView
latestLangDepView = ByteString -> ByteString -> LangDepView
LangDepView (forall a. EncCBOR a => Version -> a -> ByteString
serialize' Version
version Language
lang) ByteString
costModelEncoding
    costModel :: Maybe CostModel
costModel = forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup Language
lang (CostModels -> Map Language CostModel
costModelsValid forall a b. (a -> b) -> a -> b
$ PParams era
pp forall s a. s -> Getting a s a -> a
^. forall era. AlonzoEraPParams era => Lens' (PParams era) CostModels
ppCostModelsL)
    costModelEncoding :: ByteString
costModelEncoding = forall a. EncCBOR a => Version -> a -> ByteString
serialize' Version
version forall a b. (a -> b) -> a -> b
$ forall b a. b -> (a -> b) -> Maybe a -> b
maybe Encoding
encodeNull CostModel -> Encoding
encodeCostModel Maybe CostModel
costModel
    version :: Version
version = ProtVer -> Version
BT.pvMajor forall a b. (a -> b) -> a -> b
$ PParams era
pp forall s a. s -> Getting a s a -> a
^. forall era. EraPParams era => Lens' (PParams era) ProtVer
ppProtocolVersionL

encodeLangViews :: Set LangDepView -> Encoding
encodeLangViews :: Set LangDepView -> Encoding
encodeLangViews Set LangDepView
views = Word -> Encoding
encodeMapLen Word
n forall a. Semigroup a => a -> a -> a
<> forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap LangDepView -> Encoding
encPair [LangDepView]
ascending
  where
    n :: Word
n = forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Set a -> Int
Set.size Set LangDepView
views) :: Word
    ascending :: [LangDepView]
ascending = forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy (ByteString -> ByteString -> Ordering
shortLex forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` LangDepView -> ByteString
tag) forall a b. (a -> b) -> a -> b
$ forall a. Set a -> [a]
Set.toList Set LangDepView
views
    encPair :: LangDepView -> Encoding
encPair (LangDepView ByteString
k ByteString
v) = ByteString -> Encoding
encodePreEncoded ByteString
k forall a. Semigroup a => a -> a -> a
<> ByteString -> Encoding
encodePreEncoded ByteString
v
    shortLex :: ByteString -> ByteString -> Ordering
    shortLex :: ByteString -> ByteString -> Ordering
shortLex ByteString
a ByteString
b
      | ByteString -> Int
BS.length ByteString
a forall a. Ord a => a -> a -> Bool
< ByteString -> Int
BS.length ByteString
b = Ordering
LT
      | ByteString -> Int
BS.length ByteString
a forall a. Ord a => a -> a -> Bool
> ByteString -> Int
BS.length ByteString
b = Ordering
GT
      | Bool
otherwise = forall a. Ord a => a -> a -> Ordering
compare ByteString
a ByteString
b

-- | Given the missing pieces, turn a ShelleyPParams into a AlonzoPParams
upgradeAlonzoPParams ::
  forall f era1 era2.
  HKDFunctor f =>
  UpgradeAlonzoPParams f ->
  ShelleyPParams f era1 ->
  AlonzoPParams f era2
upgradeAlonzoPParams :: forall (f :: * -> *) era1 era2.
HKDFunctor f =>
UpgradeAlonzoPParams f
-> ShelleyPParams f era1 -> AlonzoPParams f era2
upgradeAlonzoPParams UpgradeAlonzoPParams {HKD f Natural
HKD f ExUnits
HKD f Prices
HKD f CostModels
HKD f CoinPerWord
uappMaxCollateralInputs :: HKD f Natural
uappCollateralPercentage :: HKD f Natural
uappMaxValSize :: HKD f Natural
uappMaxBlockExUnits :: HKD f ExUnits
uappMaxTxExUnits :: HKD f ExUnits
uappPrices :: HKD f Prices
uappCostModels :: HKD f CostModels
uappCoinsPerUTxOWord :: HKD f CoinPerWord
uappMaxCollateralInputs :: forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f Natural
uappCollateralPercentage :: forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f Natural
uappMaxValSize :: forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f Natural
uappMaxBlockExUnits :: forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f ExUnits
uappMaxTxExUnits :: forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f ExUnits
uappPrices :: forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f Prices
uappCostModels :: forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f CostModels
uappCoinsPerUTxOWord :: forall (f :: * -> *). UpgradeAlonzoPParams f -> HKD f CoinPerWord
..} ShelleyPParams {HKD f Natural
HKD f Word16
HKD f Word32
HKD f Coin
HKD f ProtVer
HKD f NonNegativeInterval
HKD f UnitInterval
HKD f Nonce
HKD f EpochInterval
sppMinFeeA :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f Coin
sppMinFeeB :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f Coin
sppMaxBBSize :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f Word32
sppMaxTxSize :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f Word32
sppMaxBHSize :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f Word16
sppKeyDeposit :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f Coin
sppPoolDeposit :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f Coin
sppEMax :: forall (f :: * -> *) era.
ShelleyPParams f era -> HKD f EpochInterval
sppNOpt :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f Natural
sppA0 :: forall (f :: * -> *) era.
ShelleyPParams f era -> HKD f NonNegativeInterval
sppRho :: forall (f :: * -> *) era.
ShelleyPParams f era -> HKD f UnitInterval
sppTau :: forall (f :: * -> *) era.
ShelleyPParams f era -> HKD f UnitInterval
sppD :: forall (f :: * -> *) era.
ShelleyPParams f era -> HKD f UnitInterval
sppExtraEntropy :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f Nonce
sppProtocolVersion :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f ProtVer
sppMinUTxOValue :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f Coin
sppMinPoolCost :: forall (f :: * -> *) era. ShelleyPParams f era -> HKD f Coin
sppMinPoolCost :: HKD f Coin
sppMinUTxOValue :: HKD f Coin
sppProtocolVersion :: HKD f ProtVer
sppExtraEntropy :: HKD f Nonce
sppD :: HKD f UnitInterval
sppTau :: HKD f UnitInterval
sppRho :: HKD f UnitInterval
sppA0 :: HKD f NonNegativeInterval
sppNOpt :: HKD f Natural
sppEMax :: HKD f EpochInterval
sppPoolDeposit :: HKD f Coin
sppKeyDeposit :: HKD f Coin
sppMaxBHSize :: HKD f Word16
sppMaxTxSize :: HKD f Word32
sppMaxBBSize :: HKD f Word32
sppMinFeeB :: HKD f Coin
sppMinFeeA :: HKD f Coin
..} =
  AlonzoPParams
    { appMinFeeA :: HKD f Coin
appMinFeeA = HKD f Coin
sppMinFeeA
    , appMinFeeB :: HKD f Coin
appMinFeeB = HKD f Coin
sppMinFeeB
    , appMaxBBSize :: HKD f Word32
appMaxBBSize = HKD f Word32
sppMaxBBSize
    , appMaxTxSize :: HKD f Word32
appMaxTxSize = HKD f Word32
sppMaxTxSize
    , appMaxBHSize :: HKD f Word16
appMaxBHSize = HKD f Word16
sppMaxBHSize
    , appKeyDeposit :: HKD f Coin
appKeyDeposit = HKD f Coin
sppKeyDeposit
    , appPoolDeposit :: HKD f Coin
appPoolDeposit = HKD f Coin
sppPoolDeposit
    , appEMax :: HKD f EpochInterval
appEMax = HKD f EpochInterval
sppEMax
    , appNOpt :: HKD f Natural
appNOpt = HKD f Natural
sppNOpt
    , appA0 :: HKD f NonNegativeInterval
appA0 = HKD f NonNegativeInterval
sppA0
    , appRho :: HKD f UnitInterval
appRho = HKD f UnitInterval
sppRho
    , appTau :: HKD f UnitInterval
appTau = HKD f UnitInterval
sppTau
    , appD :: HKD f UnitInterval
appD = HKD f UnitInterval
sppD
    , appExtraEntropy :: HKD f Nonce
appExtraEntropy = HKD f Nonce
sppExtraEntropy
    , appProtocolVersion :: HKD f ProtVer
appProtocolVersion = HKD f ProtVer
sppProtocolVersion
    , appMinPoolCost :: HKD f Coin
appMinPoolCost = HKD f Coin
sppMinPoolCost
    , -- new in alonzo
      appCoinsPerUTxOWord :: HKD f CoinPerWord
appCoinsPerUTxOWord = HKD f CoinPerWord
uappCoinsPerUTxOWord
    , appCostModels :: HKD f CostModels
appCostModels = HKD f CostModels
uappCostModels
    , appPrices :: HKD f Prices
appPrices = HKD f Prices
uappPrices
    , appMaxTxExUnits :: HKD f OrdExUnits
appMaxTxExUnits = forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap (forall {k} (t :: k). Proxy t
Proxy @f) ExUnits -> OrdExUnits
OrdExUnits HKD f ExUnits
uappMaxTxExUnits
    , appMaxBlockExUnits :: HKD f OrdExUnits
appMaxBlockExUnits = forall (f :: * -> *) (proxy :: (* -> *) -> *) a b.
HKDFunctor f =>
proxy f -> (a -> b) -> HKD f a -> HKD f b
hkdMap (forall {k} (t :: k). Proxy t
Proxy @f) ExUnits -> OrdExUnits
OrdExUnits HKD f ExUnits
uappMaxBlockExUnits
    , appMaxValSize :: HKD f Natural
appMaxValSize = HKD f Natural
uappMaxValSize
    , appCollateralPercentage :: HKD f Natural
appCollateralPercentage = HKD f Natural
uappCollateralPercentage
    , appMaxCollateralInputs :: HKD f Natural
appMaxCollateralInputs = HKD f Natural
uappMaxCollateralInputs
    }

-- | Turn an AlonzoPParams into a ShelleyParams
downgradeAlonzoPParams :: DowngradeAlonzoPParams f -> AlonzoPParams f era2 -> ShelleyPParams f era1
downgradeAlonzoPParams :: forall (f :: * -> *) era2 era1.
DowngradeAlonzoPParams f
-> AlonzoPParams f era2 -> ShelleyPParams f era1
downgradeAlonzoPParams DowngradeAlonzoPParams {HKD f Coin
dappMinUTxOValue :: HKD f Coin
dappMinUTxOValue :: forall (f :: * -> *). DowngradeAlonzoPParams f -> HKD f Coin
dappMinUTxOValue} AlonzoPParams {HKD f Natural
HKD f Word16
HKD f Word32
HKD f Prices
HKD f Coin
HKD f ProtVer
HKD f NonNegativeInterval
HKD f UnitInterval
HKD f Nonce
HKD f CostModels
HKD f EpochInterval
HKD f OrdExUnits
HKD f CoinPerWord
appMaxCollateralInputs :: HKD f Natural
appCollateralPercentage :: HKD f Natural
appMaxValSize :: HKD f Natural
appMaxBlockExUnits :: HKD f OrdExUnits
appMaxTxExUnits :: HKD f OrdExUnits
appPrices :: HKD f Prices
appCostModels :: HKD f CostModels
appCoinsPerUTxOWord :: HKD f CoinPerWord
appMinPoolCost :: HKD f Coin
appProtocolVersion :: HKD f ProtVer
appExtraEntropy :: HKD f Nonce
appD :: HKD f UnitInterval
appTau :: HKD f UnitInterval
appRho :: HKD f UnitInterval
appA0 :: HKD f NonNegativeInterval
appNOpt :: HKD f Natural
appEMax :: HKD f EpochInterval
appPoolDeposit :: HKD f Coin
appKeyDeposit :: HKD f Coin
appMaxBHSize :: HKD f Word16
appMaxTxSize :: HKD f Word32
appMaxBBSize :: HKD f Word32
appMinFeeB :: HKD f Coin
appMinFeeA :: HKD f Coin
appMaxCollateralInputs :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appCollateralPercentage :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appMaxValSize :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appMaxBlockExUnits :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f OrdExUnits
appMaxTxExUnits :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f OrdExUnits
appPrices :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Prices
appCostModels :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f CostModels
appCoinsPerUTxOWord :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f CoinPerWord
appMinPoolCost :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appProtocolVersion :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f ProtVer
appExtraEntropy :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Nonce
appD :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appTau :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appRho :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f UnitInterval
appA0 :: forall (f :: * -> *) era.
AlonzoPParams f era -> HKD f NonNegativeInterval
appNOpt :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Natural
appEMax :: forall (f :: * -> *) era.
AlonzoPParams f era -> HKD f EpochInterval
appPoolDeposit :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appKeyDeposit :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMaxBHSize :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word16
appMaxTxSize :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word32
appMaxBBSize :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Word32
appMinFeeB :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
appMinFeeA :: forall (f :: * -> *) era. AlonzoPParams f era -> HKD f Coin
..} =
  ShelleyPParams
    { sppMinFeeA :: HKD f Coin
sppMinFeeA = HKD f Coin
appMinFeeA
    , sppMinFeeB :: HKD f Coin
sppMinFeeB = HKD f Coin
appMinFeeB
    , sppMaxBBSize :: HKD f Word32
sppMaxBBSize = HKD f Word32
appMaxBBSize
    , sppMaxTxSize :: HKD f Word32
sppMaxTxSize = HKD f Word32
appMaxTxSize
    , sppMaxBHSize :: HKD f Word16
sppMaxBHSize = HKD f Word16
appMaxBHSize
    , sppKeyDeposit :: HKD f Coin
sppKeyDeposit = HKD f Coin
appKeyDeposit
    , sppPoolDeposit :: HKD f Coin
sppPoolDeposit = HKD f Coin
appPoolDeposit
    , sppEMax :: HKD f EpochInterval
sppEMax = HKD f EpochInterval
appEMax
    , sppNOpt :: HKD f Natural
sppNOpt = HKD f Natural
appNOpt
    , sppA0 :: HKD f NonNegativeInterval
sppA0 = HKD f NonNegativeInterval
appA0
    , sppRho :: HKD f UnitInterval
sppRho = HKD f UnitInterval
appRho
    , sppTau :: HKD f UnitInterval
sppTau = HKD f UnitInterval
appTau
    , sppD :: HKD f UnitInterval
sppD = HKD f UnitInterval
appD
    , sppExtraEntropy :: HKD f Nonce
sppExtraEntropy = HKD f Nonce
appExtraEntropy
    , sppProtocolVersion :: HKD f ProtVer
sppProtocolVersion = HKD f ProtVer
appProtocolVersion
    , sppMinUTxOValue :: HKD f Coin
sppMinUTxOValue = HKD f Coin
dappMinUTxOValue -- <- parameter that was dropped in Alonzo
    , sppMinPoolCost :: HKD f Coin
sppMinPoolCost = HKD f Coin
appMinPoolCost
    }