{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Cardano.Rpc.Server.Internal.UtxoRpc.Query
  ( readParamsMethod
  )
where

import Cardano.Api
import Cardano.Api.Ledger qualified as L
import Cardano.Rpc.Proto.Api.UtxoRpc.Query qualified as UtxoRpc
import Cardano.Rpc.Server.Internal.Error
import Cardano.Rpc.Server.Internal.Monad
import Cardano.Rpc.Server.Internal.Orphans ()

import Cardano.Ledger.Api qualified as L
import Cardano.Ledger.BaseTypes (WithOrigin (..))
import Cardano.Ledger.Binary.Version qualified as L
import Cardano.Ledger.Conway.Core qualified as L
import Cardano.Ledger.Conway.PParams qualified as L
import Cardano.Ledger.Plutus qualified as L

import RIO

import Data.ByteString.Short qualified as SBS
import Data.Map.Strict qualified as M
import Data.ProtoLens (defMessage)
import Network.GRPC.Spec

readParamsMethod
  :: MonadRpc e m
  => Proto UtxoRpc.ReadParamsRequest
  -> m (Proto UtxoRpc.ReadParamsResponse)
readParamsMethod :: forall e (m :: * -> *).
MonadRpc e m =>
Proto ReadParamsRequest -> m (Proto ReadParamsResponse)
readParamsMethod Proto ReadParamsRequest
_req = do
  -- TODO: implement field masks - they are ignored for now
  -- they need to be normalised beforehand, see: https://github.com/protocolbuffers/protobuf/blob/main/java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java#L76
  -- let fieldMask :: [Text] = req ^. #fieldMask . #paths
  nodeConnInfo <- m LocalNodeConnectInfo
forall field env (m :: * -> *).
(Has field env, MonadReader env m) =>
m field
grab
  AnyCardanoEra era <- liftIO . throwExceptT $ determineEra nodeConnInfo
  eon <- forEraInEon era (error "Minimum Conway era required") pure
  let sbe = ConwayEraOnwards era -> ShelleyBasedEra era
forall era. ConwayEraOnwards era -> ShelleyBasedEra era
forall a (f :: a -> *) (g :: a -> *) (era :: a).
Convert f g =>
f era -> g era
convert ConwayEraOnwards era
eon

  let target = Target point
forall point. Target point
VolatileTip
  (pparams, chainPoint, blockNo) <- liftIO . (throwEither =<<) $ executeLocalStateQueryExpr nodeConnInfo target $ do
    pparams <- throwEither =<< throwEither =<< queryProtocolParameters sbe
    chainPoint <- throwEither =<< queryChainPoint
    blockNo <- throwEither =<< queryChainBlockNo
    pure (pparams, chainPoint, blockNo)

  let pparamsCostModels :: Map L.Language [Int64] =
        babbageEraOnwardsConstraints (convert eon) $
          L.getCostModelParams <$> pparams ^. L.ppCostModelsL . to L.costModelsValid
      poolVotingThresholds :: L.PoolVotingThresholds =
        conwayEraOnwardsConstraints eon $
          pparams ^. L.ppPoolVotingThresholdsL
      drepVotingThresholds :: L.DRepVotingThresholds =
        conwayEraOnwardsConstraints eon $
          pparams ^. L.ppDRepVotingThresholdsL

  let pparamsMsg =
        ConwayEraOnwards era
-> (ConwayEraOnwardsConstraints era => Proto PParams)
-> Proto PParams
forall era a.
ConwayEraOnwards era -> (ConwayEraOnwardsConstraints era => a) -> a
conwayEraOnwardsConstraints ConwayEraOnwards era
eon ((ConwayEraOnwardsConstraints era => Proto PParams)
 -> Proto PParams)
-> (ConwayEraOnwardsConstraints era => Proto PParams)
-> Proto PParams
forall a b. (a -> b) -> a -> b
$
          Proto PParams
forall msg. Message msg => msg
defMessage
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#coinsPerUtxoByte ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (CoinPerByte -> Const Word64 CoinPerByte)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era.
BabbageEraPParams era =>
Lens' (PParams era) CoinPerByte
Lens' (PParams (ShelleyLedgerEra era)) CoinPerByte
L.ppCoinsPerUTxOByteL ((CoinPerByte -> Const Word64 CoinPerByte)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> CoinPerByte -> Const Word64 CoinPerByte)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (CoinPerByte -> Coin) -> SimpleGetter CoinPerByte Coin
forall s a. (s -> a) -> SimpleGetter s a
to CoinPerByte -> Coin
L.unCoinPerByte Getting Word64 CoinPerByte Coin
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> (Word64 -> Const Word64 Word64)
-> CoinPerByte
-> Const Word64 CoinPerByte
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#maxTxSize ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Word32 -> Const Word64 Word32)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) Word32
Lens' (PParams (ShelleyLedgerEra era)) Word32
L.ppMaxTxSizeL ((Word32 -> Const Word64 Word32)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#minFeeCoefficient ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) Coin
Lens' (PParams (ShelleyLedgerEra era)) Coin
L.ppMinFeeBL ((Coin -> Const Word64 Coin)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#minFeeConstant ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) Coin
Lens' (PParams (ShelleyLedgerEra era)) Coin
L.ppMinFeeAL ((Coin -> Const Word64 Coin)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#maxBlockBodySize ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Word32 -> Const Word64 Word32)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) Word32
Lens' (PParams (ShelleyLedgerEra era)) Word32
L.ppMaxBBSizeL ((Word32 -> Const Word64 Word32)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#maxBlockHeaderSize ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Word16 -> Const Word64 Word16)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) Word16
Lens' (PParams (ShelleyLedgerEra era)) Word16
L.ppMaxBHSizeL ((Word16 -> Const Word64 Word16)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> Word16 -> Const Word64 Word16)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word16 -> Word64) -> SimpleGetter Word16 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word16 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#stakeKeyDeposit ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) Coin
Lens' (PParams (ShelleyLedgerEra era)) Coin
L.ppKeyDepositL ((Coin -> Const Word64 Coin)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#poolDeposit ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) Coin
Lens' (PParams (ShelleyLedgerEra era)) Coin
L.ppPoolDepositL ((Coin -> Const Word64 Coin)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#poolRetirementEpochBound ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (EpochInterval -> Const Word64 EpochInterval)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) EpochInterval
Lens' (PParams (ShelleyLedgerEra era)) EpochInterval
L.ppEMaxL ((EpochInterval -> Const Word64 EpochInterval)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> EpochInterval -> Const Word64 EpochInterval)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (EpochInterval -> Word32) -> SimpleGetter EpochInterval Word32
forall s a. (s -> a) -> SimpleGetter s a
to EpochInterval -> Word32
L.unEpochInterval Getting Word64 EpochInterval Word32
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> (Word64 -> Const Word64 Word64)
-> EpochInterval
-> Const Word64 EpochInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#desiredNumberOfPools ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Word16 -> Const Word64 Word16)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) Word16
Lens' (PParams (ShelleyLedgerEra era)) Word16
L.ppNOptL ((Word16 -> Const Word64 Word16)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> Word16 -> Const Word64 Word16)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word16 -> Word64) -> SimpleGetter Word16 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word16 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
#poolInfluence ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
-> Proto RationalNumber -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting
     (Proto RationalNumber)
     (PParams (ShelleyLedgerEra era))
     (Proto RationalNumber)
-> Proto RationalNumber
forall s a. s -> Getting a s a -> a
^. (NonNegativeInterval
 -> Const (Proto RationalNumber) NonNegativeInterval)
-> PParams (ShelleyLedgerEra era)
-> Const (Proto RationalNumber) (PParams (ShelleyLedgerEra era))
forall era.
EraPParams era =>
Lens' (PParams era) NonNegativeInterval
Lens' (PParams (ShelleyLedgerEra era)) NonNegativeInterval
L.ppA0L ((NonNegativeInterval
  -> Const (Proto RationalNumber) NonNegativeInterval)
 -> PParams (ShelleyLedgerEra era)
 -> Const (Proto RationalNumber) (PParams (ShelleyLedgerEra era)))
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> NonNegativeInterval
    -> Const (Proto RationalNumber) NonNegativeInterval)
-> Getting
     (Proto RationalNumber)
     (PParams (ShelleyLedgerEra era))
     (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonNegativeInterval -> Rational)
-> SimpleGetter NonNegativeInterval Rational
forall s a. (s -> a) -> SimpleGetter s a
to NonNegativeInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational Getting (Proto RationalNumber) NonNegativeInterval Rational
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Rational -> Const (Proto RationalNumber) Rational)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> NonNegativeInterval
-> Const (Proto RationalNumber) NonNegativeInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rational -> Proto RationalNumber)
-> SimpleGetter Rational (Proto RationalNumber)
forall s a. (s -> a) -> SimpleGetter s a
to Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#desiredNumberOfPools ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Word16 -> Const Word64 Word16)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) Word16
Lens' (PParams (ShelleyLedgerEra era)) Word16
L.ppNOptL ((Word16 -> Const Word64 Word16)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> Word16 -> Const Word64 Word16)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word16 -> Word64) -> SimpleGetter Word16 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word16 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
#monetaryExpansion ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
-> Proto RationalNumber -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting
     (Proto RationalNumber)
     (PParams (ShelleyLedgerEra era))
     (Proto RationalNumber)
-> Proto RationalNumber
forall s a. s -> Getting a s a -> a
^. (UnitInterval -> Const (Proto RationalNumber) UnitInterval)
-> PParams (ShelleyLedgerEra era)
-> Const (Proto RationalNumber) (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) UnitInterval
Lens' (PParams (ShelleyLedgerEra era)) UnitInterval
L.ppRhoL ((UnitInterval -> Const (Proto RationalNumber) UnitInterval)
 -> PParams (ShelleyLedgerEra era)
 -> Const (Proto RationalNumber) (PParams (ShelleyLedgerEra era)))
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> UnitInterval -> Const (Proto RationalNumber) UnitInterval)
-> Getting
     (Proto RationalNumber)
     (PParams (ShelleyLedgerEra era))
     (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (UnitInterval -> Rational) -> SimpleGetter UnitInterval Rational
forall s a. (s -> a) -> SimpleGetter s a
to UnitInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational Getting (Proto RationalNumber) UnitInterval Rational
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Rational -> Const (Proto RationalNumber) Rational)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> UnitInterval
-> Const (Proto RationalNumber) UnitInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rational -> Proto RationalNumber)
-> SimpleGetter Rational (Proto RationalNumber)
forall s a. (s -> a) -> SimpleGetter s a
to Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#minPoolCost ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) Coin
Lens' (PParams (ShelleyLedgerEra era)) Coin
L.ppMinPoolCostL ((Coin -> Const Word64 Coin)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
-> Proto PParams -> Identity (Proto PParams)
#protocolVersion ((Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
 -> Proto PParams -> Identity (Proto PParams))
-> ((Word32 -> Identity Word32)
    -> Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
-> ASetter (Proto PParams) (Proto PParams) Word32 Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Identity Word32)
-> Proto ProtocolVersion -> Identity (Proto ProtocolVersion)
#major ASetter (Proto PParams) (Proto PParams) Word32 Word32
-> Word32 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word32 (PParams (ShelleyLedgerEra era)) Word32 -> Word32
forall s a. s -> Getting a s a -> a
^. (ProtVer -> Const Word32 ProtVer)
-> PParams (ShelleyLedgerEra era)
-> Const Word32 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) ProtVer
Lens' (PParams (ShelleyLedgerEra era)) ProtVer
L.ppProtocolVersionL ((ProtVer -> Const Word32 ProtVer)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word32 (PParams (ShelleyLedgerEra era)))
-> ((Word32 -> Const Word32 Word32)
    -> ProtVer -> Const Word32 ProtVer)
-> Getting Word32 (PParams (ShelleyLedgerEra era)) Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ProtVer -> Version) -> SimpleGetter ProtVer Version
forall s a. (s -> a) -> SimpleGetter s a
to ProtVer -> Version
L.pvMajor Getting Word32 ProtVer Version
-> ((Word32 -> Const Word32 Word32)
    -> Version -> Const Word32 Version)
-> (Word32 -> Const Word32 Word32)
-> ProtVer
-> Const Word32 ProtVer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Version -> Word32) -> SimpleGetter Version Word32
forall s a. (s -> a) -> SimpleGetter s a
to Version -> Word32
forall i. Integral i => Version -> i
L.getVersion
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
-> Proto PParams -> Identity (Proto PParams)
#protocolVersion ((Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
 -> Proto PParams -> Identity (Proto PParams))
-> ((Word32 -> Identity Word32)
    -> Proto ProtocolVersion -> Identity (Proto ProtocolVersion))
-> ASetter (Proto PParams) (Proto PParams) Word32 Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Identity Word32)
-> Proto ProtocolVersion -> Identity (Proto ProtocolVersion)
#minor ASetter (Proto PParams) (Proto PParams) Word32 Word32
-> Word32 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word32 (PParams (ShelleyLedgerEra era)) Word32 -> Word32
forall s a. s -> Getting a s a -> a
^. (ProtVer -> Const Word32 ProtVer)
-> PParams (ShelleyLedgerEra era)
-> Const Word32 (PParams (ShelleyLedgerEra era))
forall era. EraPParams era => Lens' (PParams era) ProtVer
Lens' (PParams (ShelleyLedgerEra era)) ProtVer
L.ppProtocolVersionL ((ProtVer -> Const Word32 ProtVer)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word32 (PParams (ShelleyLedgerEra era)))
-> ((Word32 -> Const Word32 Word32)
    -> ProtVer -> Const Word32 ProtVer)
-> Getting Word32 (PParams (ShelleyLedgerEra era)) Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ProtVer -> Natural) -> SimpleGetter ProtVer Natural
forall s a. (s -> a) -> SimpleGetter s a
to ProtVer -> Natural
L.pvMinor Getting Word32 ProtVer Natural
-> ((Word32 -> Const Word32 Word32)
    -> Natural -> Const Word32 Natural)
-> (Word32 -> Const Word32 Word32)
-> ProtVer
-> Const Word32 ProtVer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Word32) -> SimpleGetter Natural Word32
forall s a. (s -> a) -> SimpleGetter s a
to Natural -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#maxValueSize ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Natural -> Const Word64 Natural)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
Lens' (PParams (ShelleyLedgerEra era)) Natural
L.ppMaxValSizeL ((Natural -> Const Word64 Natural)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> Natural -> Const Word64 Natural)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Word64) -> SimpleGetter Natural Word64
forall s a. (s -> a) -> SimpleGetter s a
to Natural -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#collateralPercentage ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Natural -> Const Word64 Natural)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
Lens' (PParams (ShelleyLedgerEra era)) Natural
L.ppCollateralPercentageL ((Natural -> Const Word64 Natural)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> Natural -> Const Word64 Natural)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Word64) -> SimpleGetter Natural Word64
forall s a. (s -> a) -> SimpleGetter s a
to Natural -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#maxCollateralInputs ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Natural -> Const Word64 Natural)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. AlonzoEraPParams era => Lens' (PParams era) Natural
Lens' (PParams (ShelleyLedgerEra era)) Natural
L.ppMaxCollateralInputsL ((Natural -> Const Word64 Natural)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> Natural -> Const Word64 Natural)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Word64) -> SimpleGetter Natural Word64
forall s a. (s -> a) -> SimpleGetter s a
to Natural -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto CostModels -> Identity (Proto CostModels))
-> Proto PParams -> Identity (Proto PParams)
#costModels ((Proto CostModels -> Identity (Proto CostModels))
 -> Proto PParams -> Identity (Proto PParams))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModels -> Identity (Proto CostModels))
-> ([Int64] -> Identity [Int64])
-> Proto PParams
-> Identity (Proto PParams)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Proto CostModel -> Identity (Proto CostModel))
-> Proto CostModels -> Identity (Proto CostModels)
#plutusV1 ((Proto CostModel -> Identity (Proto CostModel))
 -> Proto CostModels -> Identity (Proto CostModels))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModel -> Identity (Proto CostModel))
-> ([Int64] -> Identity [Int64])
-> Proto CostModels
-> Identity (Proto CostModels)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Int64] -> Identity [Int64])
-> Proto CostModel -> Identity (Proto CostModel)
#values (([Int64] -> Identity [Int64])
 -> Proto PParams -> Identity (Proto PParams))
-> [Int64] -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ([[Int64]] -> [Int64]
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join ([[Int64]] -> [Int64])
-> (Maybe [Int64] -> [[Int64]]) -> Maybe [Int64] -> [Int64]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe [Int64] -> [[Int64]]
forall a. Maybe a -> [a]
maybeToList) (Language -> Map Language [Int64] -> Maybe [Int64]
forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup Language
L.PlutusV1 Map Language [Int64]
pparamsCostModels)
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto CostModels -> Identity (Proto CostModels))
-> Proto PParams -> Identity (Proto PParams)
#costModels ((Proto CostModels -> Identity (Proto CostModels))
 -> Proto PParams -> Identity (Proto PParams))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModels -> Identity (Proto CostModels))
-> ([Int64] -> Identity [Int64])
-> Proto PParams
-> Identity (Proto PParams)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Proto CostModel -> Identity (Proto CostModel))
-> Proto CostModels -> Identity (Proto CostModels)
#plutusV2 ((Proto CostModel -> Identity (Proto CostModel))
 -> Proto CostModels -> Identity (Proto CostModels))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModel -> Identity (Proto CostModel))
-> ([Int64] -> Identity [Int64])
-> Proto CostModels
-> Identity (Proto CostModels)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Int64] -> Identity [Int64])
-> Proto CostModel -> Identity (Proto CostModel)
#values (([Int64] -> Identity [Int64])
 -> Proto PParams -> Identity (Proto PParams))
-> [Int64] -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ([[Int64]] -> [Int64]
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join ([[Int64]] -> [Int64])
-> (Maybe [Int64] -> [[Int64]]) -> Maybe [Int64] -> [Int64]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe [Int64] -> [[Int64]]
forall a. Maybe a -> [a]
maybeToList) (Language -> Map Language [Int64] -> Maybe [Int64]
forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup Language
L.PlutusV2 Map Language [Int64]
pparamsCostModels)
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto CostModels -> Identity (Proto CostModels))
-> Proto PParams -> Identity (Proto PParams)
#costModels ((Proto CostModels -> Identity (Proto CostModels))
 -> Proto PParams -> Identity (Proto PParams))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModels -> Identity (Proto CostModels))
-> ([Int64] -> Identity [Int64])
-> Proto PParams
-> Identity (Proto PParams)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Proto CostModel -> Identity (Proto CostModel))
-> Proto CostModels -> Identity (Proto CostModels)
#plutusV3 ((Proto CostModel -> Identity (Proto CostModel))
 -> Proto CostModels -> Identity (Proto CostModels))
-> (([Int64] -> Identity [Int64])
    -> Proto CostModel -> Identity (Proto CostModel))
-> ([Int64] -> Identity [Int64])
-> Proto CostModels
-> Identity (Proto CostModels)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Int64] -> Identity [Int64])
-> Proto CostModel -> Identity (Proto CostModel)
#values (([Int64] -> Identity [Int64])
 -> Proto PParams -> Identity (Proto PParams))
-> [Int64] -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ([[Int64]] -> [Int64]
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join ([[Int64]] -> [Int64])
-> (Maybe [Int64] -> [[Int64]]) -> Maybe [Int64] -> [Int64]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe [Int64] -> [[Int64]]
forall a. Maybe a -> [a]
maybeToList) (Language -> Map Language [Int64] -> Maybe [Int64]
forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup Language
L.PlutusV3 Map Language [Int64]
pparamsCostModels)
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto ExPrices -> Identity (Proto ExPrices))
-> Proto PParams -> Identity (Proto PParams)
#prices ((Proto ExPrices -> Identity (Proto ExPrices))
 -> Proto PParams -> Identity (Proto PParams))
-> ((Proto RationalNumber -> Identity (Proto RationalNumber))
    -> Proto ExPrices -> Identity (Proto ExPrices))
-> ASetter
     (Proto PParams)
     (Proto PParams)
     (Proto RationalNumber)
     (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Proto RationalNumber -> Identity (Proto RationalNumber))
-> Proto ExPrices -> Identity (Proto ExPrices)
#steps ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
-> Proto RationalNumber -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting
     (Proto RationalNumber)
     (PParams (ShelleyLedgerEra era))
     (Proto RationalNumber)
-> Proto RationalNumber
forall s a. s -> Getting a s a -> a
^. (Prices -> Const (Proto RationalNumber) Prices)
-> PParams (ShelleyLedgerEra era)
-> Const (Proto RationalNumber) (PParams (ShelleyLedgerEra era))
forall era. AlonzoEraPParams era => Lens' (PParams era) Prices
Lens' (PParams (ShelleyLedgerEra era)) Prices
L.ppPricesL ((Prices -> Const (Proto RationalNumber) Prices)
 -> PParams (ShelleyLedgerEra era)
 -> Const (Proto RationalNumber) (PParams (ShelleyLedgerEra era)))
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Prices -> Const (Proto RationalNumber) Prices)
-> Getting
     (Proto RationalNumber)
     (PParams (ShelleyLedgerEra era))
     (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Prices -> NonNegativeInterval)
-> SimpleGetter Prices NonNegativeInterval
forall s a. (s -> a) -> SimpleGetter s a
to Prices -> NonNegativeInterval
L.prSteps Getting (Proto RationalNumber) Prices NonNegativeInterval
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> NonNegativeInterval
    -> Const (Proto RationalNumber) NonNegativeInterval)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> Prices
-> Const (Proto RationalNumber) Prices
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonNegativeInterval -> Rational)
-> SimpleGetter NonNegativeInterval Rational
forall s a. (s -> a) -> SimpleGetter s a
to NonNegativeInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational Getting (Proto RationalNumber) NonNegativeInterval Rational
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Rational -> Const (Proto RationalNumber) Rational)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> NonNegativeInterval
-> Const (Proto RationalNumber) NonNegativeInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rational -> Proto RationalNumber)
-> SimpleGetter Rational (Proto RationalNumber)
forall s a. (s -> a) -> SimpleGetter s a
to Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto ExPrices -> Identity (Proto ExPrices))
-> Proto PParams -> Identity (Proto PParams)
#prices ((Proto ExPrices -> Identity (Proto ExPrices))
 -> Proto PParams -> Identity (Proto PParams))
-> ((Proto RationalNumber -> Identity (Proto RationalNumber))
    -> Proto ExPrices -> Identity (Proto ExPrices))
-> ASetter
     (Proto PParams)
     (Proto PParams)
     (Proto RationalNumber)
     (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Proto RationalNumber -> Identity (Proto RationalNumber))
-> Proto ExPrices -> Identity (Proto ExPrices)
#memory ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
-> Proto RationalNumber -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting
     (Proto RationalNumber)
     (PParams (ShelleyLedgerEra era))
     (Proto RationalNumber)
-> Proto RationalNumber
forall s a. s -> Getting a s a -> a
^. (Prices -> Const (Proto RationalNumber) Prices)
-> PParams (ShelleyLedgerEra era)
-> Const (Proto RationalNumber) (PParams (ShelleyLedgerEra era))
forall era. AlonzoEraPParams era => Lens' (PParams era) Prices
Lens' (PParams (ShelleyLedgerEra era)) Prices
L.ppPricesL ((Prices -> Const (Proto RationalNumber) Prices)
 -> PParams (ShelleyLedgerEra era)
 -> Const (Proto RationalNumber) (PParams (ShelleyLedgerEra era)))
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Prices -> Const (Proto RationalNumber) Prices)
-> Getting
     (Proto RationalNumber)
     (PParams (ShelleyLedgerEra era))
     (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Prices -> NonNegativeInterval)
-> SimpleGetter Prices NonNegativeInterval
forall s a. (s -> a) -> SimpleGetter s a
to Prices -> NonNegativeInterval
L.prMem Getting (Proto RationalNumber) Prices NonNegativeInterval
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> NonNegativeInterval
    -> Const (Proto RationalNumber) NonNegativeInterval)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> Prices
-> Const (Proto RationalNumber) Prices
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonNegativeInterval -> Rational)
-> SimpleGetter NonNegativeInterval Rational
forall s a. (s -> a) -> SimpleGetter s a
to NonNegativeInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational Getting (Proto RationalNumber) NonNegativeInterval Rational
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Rational -> Const (Proto RationalNumber) Rational)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> NonNegativeInterval
-> Const (Proto RationalNumber) NonNegativeInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rational -> Proto RationalNumber)
-> SimpleGetter Rational (Proto RationalNumber)
forall s a. (s -> a) -> SimpleGetter s a
to Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto PParams) (Proto PParams) (Proto ExUnits) (Proto ExUnits)
#maxExecutionUnitsPerTransaction ASetter
  (Proto PParams) (Proto PParams) (Proto ExUnits) (Proto ExUnits)
-> Proto ExUnits -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting
     (Proto ExUnits) (PParams (ShelleyLedgerEra era)) (Proto ExUnits)
-> Proto ExUnits
forall s a. s -> Getting a s a -> a
^. (ExUnits -> Const (Proto ExUnits) ExUnits)
-> PParams (ShelleyLedgerEra era)
-> Const (Proto ExUnits) (PParams (ShelleyLedgerEra era))
forall era. AlonzoEraPParams era => Lens' (PParams era) ExUnits
Lens' (PParams (ShelleyLedgerEra era)) ExUnits
L.ppMaxTxExUnitsL ((ExUnits -> Const (Proto ExUnits) ExUnits)
 -> PParams (ShelleyLedgerEra era)
 -> Const (Proto ExUnits) (PParams (ShelleyLedgerEra era)))
-> ((Proto ExUnits -> Const (Proto ExUnits) (Proto ExUnits))
    -> ExUnits -> Const (Proto ExUnits) ExUnits)
-> Getting
     (Proto ExUnits) (PParams (ShelleyLedgerEra era)) (Proto ExUnits)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ExUnits -> Proto ExUnits) -> SimpleGetter ExUnits (Proto ExUnits)
forall s a. (s -> a) -> SimpleGetter s a
to ExUnits -> Proto ExUnits
forall t s. Inject t s => t -> s
inject
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto PParams) (Proto PParams) (Proto ExUnits) (Proto ExUnits)
#maxExecutionUnitsPerBlock ASetter
  (Proto PParams) (Proto PParams) (Proto ExUnits) (Proto ExUnits)
-> Proto ExUnits -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting
     (Proto ExUnits) (PParams (ShelleyLedgerEra era)) (Proto ExUnits)
-> Proto ExUnits
forall s a. s -> Getting a s a -> a
^. (ExUnits -> Const (Proto ExUnits) ExUnits)
-> PParams (ShelleyLedgerEra era)
-> Const (Proto ExUnits) (PParams (ShelleyLedgerEra era))
forall era. AlonzoEraPParams era => Lens' (PParams era) ExUnits
Lens' (PParams (ShelleyLedgerEra era)) ExUnits
L.ppMaxBlockExUnitsL ((ExUnits -> Const (Proto ExUnits) ExUnits)
 -> PParams (ShelleyLedgerEra era)
 -> Const (Proto ExUnits) (PParams (ShelleyLedgerEra era)))
-> ((Proto ExUnits -> Const (Proto ExUnits) (Proto ExUnits))
    -> ExUnits -> Const (Proto ExUnits) ExUnits)
-> Getting
     (Proto ExUnits) (PParams (ShelleyLedgerEra era)) (Proto ExUnits)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ExUnits -> Proto ExUnits) -> SimpleGetter ExUnits (Proto ExUnits)
forall s a. (s -> a) -> SimpleGetter s a
to ExUnits -> Proto ExUnits
forall t s. Inject t s => t -> s
inject
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
#minFeeScriptRefCostPerByte
              ASetter
  (Proto PParams)
  (Proto PParams)
  (Proto RationalNumber)
  (Proto RationalNumber)
-> Proto RationalNumber -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting
     (Proto RationalNumber)
     (PParams (ShelleyLedgerEra era))
     (Proto RationalNumber)
-> Proto RationalNumber
forall s a. s -> Getting a s a -> a
^. (NonNegativeInterval
 -> Const (Proto RationalNumber) NonNegativeInterval)
-> PParams (ShelleyLedgerEra era)
-> Const (Proto RationalNumber) (PParams (ShelleyLedgerEra era))
forall era.
ConwayEraPParams era =>
Lens' (PParams era) NonNegativeInterval
Lens' (PParams (ShelleyLedgerEra era)) NonNegativeInterval
L.ppMinFeeRefScriptCostPerByteL ((NonNegativeInterval
  -> Const (Proto RationalNumber) NonNegativeInterval)
 -> PParams (ShelleyLedgerEra era)
 -> Const (Proto RationalNumber) (PParams (ShelleyLedgerEra era)))
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> NonNegativeInterval
    -> Const (Proto RationalNumber) NonNegativeInterval)
-> Getting
     (Proto RationalNumber)
     (PParams (ShelleyLedgerEra era))
     (Proto RationalNumber)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonNegativeInterval -> Rational)
-> SimpleGetter NonNegativeInterval Rational
forall s a. (s -> a) -> SimpleGetter s a
to NonNegativeInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational Getting (Proto RationalNumber) NonNegativeInterval Rational
-> ((Proto RationalNumber
     -> Const (Proto RationalNumber) (Proto RationalNumber))
    -> Rational -> Const (Proto RationalNumber) Rational)
-> (Proto RationalNumber
    -> Const (Proto RationalNumber) (Proto RationalNumber))
-> NonNegativeInterval
-> Const (Proto RationalNumber) NonNegativeInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Rational -> Proto RationalNumber)
-> SimpleGetter Rational (Proto RationalNumber)
forall s a. (s -> a) -> SimpleGetter s a
to Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto VotingThresholds -> Identity (Proto VotingThresholds))
-> Proto PParams -> Identity (Proto PParams)
#poolVotingThresholds ((Proto VotingThresholds -> Identity (Proto VotingThresholds))
 -> Proto PParams -> Identity (Proto PParams))
-> (([Proto RationalNumber] -> Identity [Proto RationalNumber])
    -> Proto VotingThresholds -> Identity (Proto VotingThresholds))
-> ([Proto RationalNumber] -> Identity [Proto RationalNumber])
-> Proto PParams
-> Identity (Proto PParams)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Proto RationalNumber] -> Identity [Proto RationalNumber])
-> Proto VotingThresholds -> Identity (Proto VotingThresholds)
#thresholds
              (([Proto RationalNumber] -> Identity [Proto RationalNumber])
 -> Proto PParams -> Identity (Proto PParams))
-> [Proto RationalNumber] -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ( Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject (Rational -> Proto RationalNumber)
-> (UnitInterval -> Rational)
-> UnitInterval
-> Proto RationalNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnitInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational
                     -- order taken from https://github.com/cardano-foundation/CIPs/blob/acb4b2348c968003dfc370cd3769615bfca1f159/CIP-1694/README.md#requirements
                     (UnitInterval -> Proto RationalNumber)
-> [UnitInterval] -> [Proto RationalNumber]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ PoolVotingThresholds
poolVotingThresholds PoolVotingThresholds
-> Getting UnitInterval PoolVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval PoolVotingThresholds UnitInterval
Lens' PoolVotingThresholds UnitInterval
L.pvtMotionNoConfidenceL
                         , PoolVotingThresholds
poolVotingThresholds PoolVotingThresholds
-> Getting UnitInterval PoolVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval PoolVotingThresholds UnitInterval
Lens' PoolVotingThresholds UnitInterval
L.pvtCommitteeNormalL
                         , PoolVotingThresholds
poolVotingThresholds PoolVotingThresholds
-> Getting UnitInterval PoolVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval PoolVotingThresholds UnitInterval
Lens' PoolVotingThresholds UnitInterval
L.pvtCommitteeNoConfidenceL
                         , PoolVotingThresholds
poolVotingThresholds PoolVotingThresholds
-> Getting UnitInterval PoolVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval PoolVotingThresholds UnitInterval
Lens' PoolVotingThresholds UnitInterval
L.pvtHardForkInitiationL
                         , PoolVotingThresholds
poolVotingThresholds PoolVotingThresholds
-> Getting UnitInterval PoolVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval PoolVotingThresholds UnitInterval
Lens' PoolVotingThresholds UnitInterval
L.pvtPPSecurityGroupL
                         ]
                 )
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& (Proto VotingThresholds -> Identity (Proto VotingThresholds))
-> Proto PParams -> Identity (Proto PParams)
#drepVotingThresholds ((Proto VotingThresholds -> Identity (Proto VotingThresholds))
 -> Proto PParams -> Identity (Proto PParams))
-> (([Proto RationalNumber] -> Identity [Proto RationalNumber])
    -> Proto VotingThresholds -> Identity (Proto VotingThresholds))
-> ([Proto RationalNumber] -> Identity [Proto RationalNumber])
-> Proto PParams
-> Identity (Proto PParams)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Proto RationalNumber] -> Identity [Proto RationalNumber])
-> Proto VotingThresholds -> Identity (Proto VotingThresholds)
#thresholds
              (([Proto RationalNumber] -> Identity [Proto RationalNumber])
 -> Proto PParams -> Identity (Proto PParams))
-> [Proto RationalNumber] -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ( Rational -> Proto RationalNumber
forall t s. Inject t s => t -> s
inject (Rational -> Proto RationalNumber)
-> (UnitInterval -> Rational)
-> UnitInterval
-> Proto RationalNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UnitInterval -> Rational
forall r. BoundedRational r => r -> Rational
L.unboundRational
                     -- order taken from https://github.com/cardano-foundation/CIPs/blob/acb4b2348c968003dfc370cd3769615bfca1f159/CIP-1694/README.md#requirements
                     (UnitInterval -> Proto RationalNumber)
-> [UnitInterval] -> [Proto RationalNumber]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtMotionNoConfidenceL
                         , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtCommitteeNormalL
                         , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtCommitteeNoConfidenceL
                         , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtUpdateToConstitutionL
                         , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtHardForkInitiationL
                         , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtPPNetworkGroupL
                         , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtPPEconomicGroupL
                         , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtPPTechnicalGroupL
                         , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtPPGovGroupL
                         , DRepVotingThresholds
drepVotingThresholds DRepVotingThresholds
-> Getting UnitInterval DRepVotingThresholds UnitInterval
-> UnitInterval
forall s a. s -> Getting a s a -> a
^. Getting UnitInterval DRepVotingThresholds UnitInterval
Lens' DRepVotingThresholds UnitInterval
L.dvtTreasuryWithdrawalL
                         ]
                 )
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word32 Word32
#minCommitteeSize ASetter (Proto PParams) (Proto PParams) Word32 Word32
-> Word32 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word32 (PParams (ShelleyLedgerEra era)) Word32 -> Word32
forall s a. s -> Getting a s a -> a
^. (Natural -> Const Word32 Natural)
-> PParams (ShelleyLedgerEra era)
-> Const Word32 (PParams (ShelleyLedgerEra era))
forall era. ConwayEraPParams era => Lens' (PParams era) Natural
Lens' (PParams (ShelleyLedgerEra era)) Natural
L.ppCommitteeMinSizeL ((Natural -> Const Word32 Natural)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word32 (PParams (ShelleyLedgerEra era)))
-> ((Word32 -> Const Word32 Word32)
    -> Natural -> Const Word32 Natural)
-> Getting Word32 (PParams (ShelleyLedgerEra era)) Word32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Natural -> Word32) -> SimpleGetter Natural Word32
forall s a. (s -> a) -> SimpleGetter s a
to Natural -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#committeeTermLimit
              ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (EpochInterval -> Const Word64 EpochInterval)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era.
ConwayEraPParams era =>
Lens' (PParams era) EpochInterval
Lens' (PParams (ShelleyLedgerEra era)) EpochInterval
L.ppCommitteeMaxTermLengthL ((EpochInterval -> Const Word64 EpochInterval)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> EpochInterval -> Const Word64 EpochInterval)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (EpochInterval -> Word32) -> SimpleGetter EpochInterval Word32
forall s a. (s -> a) -> SimpleGetter s a
to EpochInterval -> Word32
L.unEpochInterval Getting Word64 EpochInterval Word32
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> (Word64 -> Const Word64 Word64)
-> EpochInterval
-> Const Word64 EpochInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#governanceActionValidityPeriod
              ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (EpochInterval -> Const Word64 EpochInterval)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era.
ConwayEraPParams era =>
Lens' (PParams era) EpochInterval
Lens' (PParams (ShelleyLedgerEra era)) EpochInterval
L.ppGovActionLifetimeL ((EpochInterval -> Const Word64 EpochInterval)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> EpochInterval -> Const Word64 EpochInterval)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (EpochInterval -> Word32) -> SimpleGetter EpochInterval Word32
forall s a. (s -> a) -> SimpleGetter s a
to EpochInterval -> Word32
L.unEpochInterval Getting Word64 EpochInterval Word32
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> (Word64 -> Const Word64 Word64)
-> EpochInterval
-> Const Word64 EpochInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#governanceActionDeposit ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. ConwayEraPParams era => Lens' (PParams era) Coin
Lens' (PParams (ShelleyLedgerEra era)) Coin
L.ppGovActionDepositL ((Coin -> Const Word64 Coin)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#drepDeposit ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (Coin -> Const Word64 Coin)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era. ConwayEraPParams era => Lens' (PParams era) Coin
Lens' (PParams (ShelleyLedgerEra era)) Coin
L.ppDRepDepositL ((Coin -> Const Word64 Coin)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64) -> Coin -> Const Word64 Coin)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Word64) -> SimpleGetter Coin Word64
forall s a. (s -> a) -> SimpleGetter s a
to Coin -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
            Proto PParams -> (Proto PParams -> Proto PParams) -> Proto PParams
forall a b. a -> (a -> b) -> b
& ASetter (Proto PParams) (Proto PParams) Word64 Word64
#drepInactivityPeriod ASetter (Proto PParams) (Proto PParams) Word64 Word64
-> Word64 -> Proto PParams -> Proto PParams
forall s t a b. ASetter s t a b -> b -> s -> t
.~ PParams (ShelleyLedgerEra era)
pparams PParams (ShelleyLedgerEra era)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64 -> Word64
forall s a. s -> Getting a s a -> a
^. (EpochInterval -> Const Word64 EpochInterval)
-> PParams (ShelleyLedgerEra era)
-> Const Word64 (PParams (ShelleyLedgerEra era))
forall era.
ConwayEraPParams era =>
Lens' (PParams era) EpochInterval
Lens' (PParams (ShelleyLedgerEra era)) EpochInterval
L.ppDRepActivityL ((EpochInterval -> Const Word64 EpochInterval)
 -> PParams (ShelleyLedgerEra era)
 -> Const Word64 (PParams (ShelleyLedgerEra era)))
-> ((Word64 -> Const Word64 Word64)
    -> EpochInterval -> Const Word64 EpochInterval)
-> Getting Word64 (PParams (ShelleyLedgerEra era)) Word64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (EpochInterval -> Word32) -> SimpleGetter EpochInterval Word32
forall s a. (s -> a) -> SimpleGetter s a
to EpochInterval -> Word32
L.unEpochInterval Getting Word64 EpochInterval Word32
-> ((Word64 -> Const Word64 Word64)
    -> Word32 -> Const Word64 Word32)
-> (Word64 -> Const Word64 Word64)
-> EpochInterval
-> Const Word64 EpochInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word32 -> Word64) -> SimpleGetter Word32 Word64
forall s a. (s -> a) -> SimpleGetter s a
to Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral
  pure $
    defMessage
      & #ledgerTip .~ mkChainPointMsg chainPoint blockNo
      & #values . #cardano .~ pparamsMsg

mkChainPointMsg
  :: ChainPoint
  -> WithOrigin BlockNo
  -> Proto UtxoRpc.ChainPoint
mkChainPointMsg :: ChainPoint -> WithOrigin BlockNo -> Proto ChainPoint
mkChainPointMsg ChainPoint
chainPoint WithOrigin BlockNo
blockNo = do
  let (Word64
slotNo, ByteString
blockHash) = case ChainPoint
chainPoint of
        ChainPoint
ChainPointAtGenesis -> (Word64
0, ByteString
forall a. Monoid a => a
mempty)
        ChainPoint (SlotNo Word64
slot) (HeaderHash ShortByteString
hash) -> (Word64
slot, ShortByteString -> ByteString
SBS.fromShort ShortByteString
hash)
      blockHeight :: Word64
blockHeight = case WithOrigin BlockNo
blockNo of
        WithOrigin BlockNo
Origin -> Word64
0
        At (BlockNo Word64
h) -> Word64
h
  Proto ChainPoint
forall msg. Message msg => msg
defMessage
    Proto ChainPoint
-> (Proto ChainPoint -> Proto ChainPoint) -> Proto ChainPoint
forall a b. a -> (a -> b) -> b
& ASetter (Proto ChainPoint) (Proto ChainPoint) Word64 Word64
#slot ASetter (Proto ChainPoint) (Proto ChainPoint) Word64 Word64
-> Word64 -> Proto ChainPoint -> Proto ChainPoint
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Word64
slotNo
    Proto ChainPoint
-> (Proto ChainPoint -> Proto ChainPoint) -> Proto ChainPoint
forall a b. a -> (a -> b) -> b
& ASetter (Proto ChainPoint) (Proto ChainPoint) ByteString ByteString
#hash ASetter (Proto ChainPoint) (Proto ChainPoint) ByteString ByteString
-> ByteString -> Proto ChainPoint -> Proto ChainPoint
forall s t a b. ASetter s t a b -> b -> s -> t
.~ ByteString
blockHash
    Proto ChainPoint
-> (Proto ChainPoint -> Proto ChainPoint) -> Proto ChainPoint
forall a b. a -> (a -> b) -> b
& ASetter (Proto ChainPoint) (Proto ChainPoint) Word64 Word64
#height ASetter (Proto ChainPoint) (Proto ChainPoint) Word64 Word64
-> Word64 -> Proto ChainPoint -> Proto ChainPoint
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Word64
blockHeight

-- & #timestamp .~ timestamp -- not supported currently