{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE EmptyDataDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}

module Shelley.Spec.Ledger.STS.PoolReap
  ( POOLREAP,
    PoolreapState (..),
    PredicateFailure,
    PoolreapPredicateFailure,
  )
where

import Cardano.Ledger.Shelley (ShelleyBased)
import Cardano.Ledger.Val ((<+>), (<->))
import Control.SetAlgebra (dom, eval, setSingleton, (∈), (∪+), (⋪), (⋫), (▷), (◁))
import Control.State.Transition
  ( Assertion (..),
    STS (..),
    TRC (..),
    TransitionRule,
    judgmentContext,
  )
import Data.Foldable (fold)
import qualified Data.Map.Strict as Map
import qualified Data.Set as Set
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import NoThunks.Class (NoThunks (..))
import Shelley.Spec.Ledger.BaseTypes (ShelleyBase)
import Shelley.Spec.Ledger.EpochBoundary (obligation)
import Shelley.Spec.Ledger.LedgerState
  ( AccountState (..),
    DState (..),
    PState (..),
    UTxOState (..),
    emptyAccount,
    emptyDState,
    emptyPState,
    emptyUTxOState,
  )
import Shelley.Spec.Ledger.PParams (PParams, PParams' (..))
import Shelley.Spec.Ledger.Slot (EpochNo (..))
import Shelley.Spec.Ledger.TxBody (getRwdCred, _poolRAcnt)

data POOLREAP era

data PoolreapState era = PoolreapState
  { PoolreapState era -> UTxOState era
prUTxOSt :: UTxOState era,
    PoolreapState era -> AccountState
prAcnt :: AccountState,
    PoolreapState era -> DState era
prDState :: DState era,
    PoolreapState era -> PState era
prPState :: PState era
  }

deriving stock instance
  ShelleyBased era =>
  Show (PoolreapState era)

data PoolreapPredicateFailure era -- No predicate Falures
  deriving (Int -> PoolreapPredicateFailure era -> ShowS
[PoolreapPredicateFailure era] -> ShowS
PoolreapPredicateFailure era -> String
(Int -> PoolreapPredicateFailure era -> ShowS)
-> (PoolreapPredicateFailure era -> String)
-> ([PoolreapPredicateFailure era] -> ShowS)
-> Show (PoolreapPredicateFailure era)
forall era. Int -> PoolreapPredicateFailure era -> ShowS
forall era. [PoolreapPredicateFailure era] -> ShowS
forall era. PoolreapPredicateFailure era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PoolreapPredicateFailure era] -> ShowS
$cshowList :: forall era. [PoolreapPredicateFailure era] -> ShowS
show :: PoolreapPredicateFailure era -> String
$cshow :: forall era. PoolreapPredicateFailure era -> String
showsPrec :: Int -> PoolreapPredicateFailure era -> ShowS
$cshowsPrec :: forall era. Int -> PoolreapPredicateFailure era -> ShowS
Show, PoolreapPredicateFailure era
-> PoolreapPredicateFailure era -> Bool
(PoolreapPredicateFailure era
 -> PoolreapPredicateFailure era -> Bool)
-> (PoolreapPredicateFailure era
    -> PoolreapPredicateFailure era -> Bool)
-> Eq (PoolreapPredicateFailure era)
forall era.
PoolreapPredicateFailure era
-> PoolreapPredicateFailure era -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PoolreapPredicateFailure era
-> PoolreapPredicateFailure era -> Bool
$c/= :: forall era.
PoolreapPredicateFailure era
-> PoolreapPredicateFailure era -> Bool
== :: PoolreapPredicateFailure era
-> PoolreapPredicateFailure era -> Bool
$c== :: forall era.
PoolreapPredicateFailure era
-> PoolreapPredicateFailure era -> Bool
Eq, (forall x.
 PoolreapPredicateFailure era
 -> Rep (PoolreapPredicateFailure era) x)
-> (forall x.
    Rep (PoolreapPredicateFailure era) x
    -> PoolreapPredicateFailure era)
-> Generic (PoolreapPredicateFailure era)
forall x.
Rep (PoolreapPredicateFailure era) x
-> PoolreapPredicateFailure era
forall x.
PoolreapPredicateFailure era
-> Rep (PoolreapPredicateFailure era) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall era x.
Rep (PoolreapPredicateFailure era) x
-> PoolreapPredicateFailure era
forall era x.
PoolreapPredicateFailure era
-> Rep (PoolreapPredicateFailure era) x
$cto :: forall era x.
Rep (PoolreapPredicateFailure era) x
-> PoolreapPredicateFailure era
$cfrom :: forall era x.
PoolreapPredicateFailure era
-> Rep (PoolreapPredicateFailure era) x
Generic)

instance NoThunks (PoolreapPredicateFailure era)

instance Typeable era => STS (POOLREAP era) where
  type State (POOLREAP era) = PoolreapState era
  type Signal (POOLREAP era) = EpochNo
  type Environment (POOLREAP era) = PParams era
  type BaseM (POOLREAP era) = ShelleyBase
  type PredicateFailure (POOLREAP era) = PoolreapPredicateFailure era
  initialRules :: [InitialRule (POOLREAP era)]
initialRules =
    [ PoolreapState era
-> F (Clause (POOLREAP era) 'Initial) (PoolreapState era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PoolreapState era
 -> F (Clause (POOLREAP era) 'Initial) (PoolreapState era))
-> PoolreapState era
-> F (Clause (POOLREAP era) 'Initial) (PoolreapState era)
forall a b. (a -> b) -> a -> b
$
        UTxOState era
-> AccountState -> DState era -> PState era -> PoolreapState era
forall era.
UTxOState era
-> AccountState -> DState era -> PState era -> PoolreapState era
PoolreapState UTxOState era
forall era. UTxOState era
emptyUTxOState AccountState
emptyAccount DState era
forall era. DState era
emptyDState PState era
forall era. PState era
emptyPState
    ]
  transitionRules :: [TransitionRule (POOLREAP era)]
transitionRules = [TransitionRule (POOLREAP era)
forall era. TransitionRule (POOLREAP era)
poolReapTransition]

  assertions :: [Assertion (POOLREAP era)]
assertions =
    [ String
-> (TRC (POOLREAP era) -> State (POOLREAP era) -> Bool)
-> Assertion (POOLREAP era)
forall sts.
String -> (TRC sts -> State sts -> Bool) -> Assertion sts
PostCondition
        String
"Deposit pot must equal obligation"
        ( \(TRC (Environment (POOLREAP era)
pp, State (POOLREAP era)
_, Signal (POOLREAP era)
_)) State (POOLREAP era)
st ->
            PParams era
-> Map (Credential 'Staking era) Coin
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
-> Coin
forall era.
PParams era
-> Map (Credential 'Staking era) Coin
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
-> Coin
obligation Environment (POOLREAP era)
PParams era
pp (DState era -> Map (Credential 'Staking era) Coin
forall era. DState era -> RewardAccounts era
_rewards (DState era -> Map (Credential 'Staking era) Coin)
-> DState era -> Map (Credential 'Staking era) Coin
forall a b. (a -> b) -> a -> b
$ PoolreapState era -> DState era
forall era. PoolreapState era -> DState era
prDState State (POOLREAP era)
PoolreapState era
st) (PState era
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
forall era.
PState era
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
_pParams (PState era
 -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era))
-> PState era
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
forall a b. (a -> b) -> a -> b
$ PoolreapState era -> PState era
forall era. PoolreapState era -> PState era
prPState State (POOLREAP era)
PoolreapState era
st)
              Coin -> Coin -> Bool
forall a. Eq a => a -> a -> Bool
== UTxOState era -> Coin
forall era. UTxOState era -> Coin
_deposited (PoolreapState era -> UTxOState era
forall era. PoolreapState era -> UTxOState era
prUTxOSt State (POOLREAP era)
PoolreapState era
st)
        ),
      String
-> (TRC (POOLREAP era) -> State (POOLREAP era) -> Bool)
-> Assertion (POOLREAP era)
forall sts.
String -> (TRC sts -> State sts -> Bool) -> Assertion sts
PostCondition
        String
"PoolReap may not create or remove reward accounts"
        ( \(TRC (Environment (POOLREAP era)
_, State (POOLREAP era)
st, Signal (POOLREAP era)
_)) State (POOLREAP era)
st' ->
            let r :: PoolreapState era -> RewardAccounts era
r = DState era -> RewardAccounts era
forall era. DState era -> RewardAccounts era
_rewards (DState era -> RewardAccounts era)
-> (PoolreapState era -> DState era)
-> PoolreapState era
-> RewardAccounts era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PoolreapState era -> DState era
forall era. PoolreapState era -> DState era
prDState
             in Map (Credential 'Staking era) Coin -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length (PoolreapState era -> Map (Credential 'Staking era) Coin
forall era. PoolreapState era -> RewardAccounts era
r State (POOLREAP era)
PoolreapState era
st) Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Map (Credential 'Staking era) Coin -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length (PoolreapState era -> Map (Credential 'Staking era) Coin
forall era. PoolreapState era -> RewardAccounts era
r State (POOLREAP era)
PoolreapState era
st')
        )
    ]

poolReapTransition :: TransitionRule (POOLREAP era)
poolReapTransition :: TransitionRule (POOLREAP era)
poolReapTransition = do
  TRC (Environment (POOLREAP era)
pp, PoolreapState us a ds ps, Signal (POOLREAP era)
e) <- F (Clause (POOLREAP era) 'Transition) (TRC (POOLREAP era))
forall sts (rtype :: RuleType).
Rule sts rtype (RuleContext rtype sts)
judgmentContext

  let retired :: Set (KeyHash 'StakePool (Crypto era))
retired = Exp (Sett (KeyHash 'StakePool (Crypto era)) ())
-> Set (KeyHash 'StakePool (Crypto era))
forall s t. Embed s t => Exp t -> s
eval (Exp (Map (KeyHash 'StakePool (Crypto era)) EpochNo)
-> Exp (Sett (KeyHash 'StakePool (Crypto era)) ())
forall k s (f :: * -> * -> *) v.
(Ord k, HasExp s (f k v)) =>
s -> Exp (Sett k ())
dom ((PState era -> Map (KeyHash 'StakePool (Crypto era)) EpochNo
forall era.
PState era -> Map (KeyHash 'StakePool (Crypto era)) EpochNo
_retiring PState era
ps) Map (KeyHash 'StakePool (Crypto era)) EpochNo
-> Exp (Single EpochNo ())
-> Exp (Map (KeyHash 'StakePool (Crypto era)) EpochNo)
forall k (g :: * -> * -> *) v s1 (f :: * -> * -> *) s2.
(Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) =>
s1 -> s2 -> Exp (f k v)
 EpochNo -> Exp (Single EpochNo ())
forall k. Ord k => k -> Exp (Single k ())
setSingleton EpochNo
Signal (POOLREAP era)
e))
      pr :: Map (KeyHash 'StakePool (Crypto era)) Coin
pr = [(KeyHash 'StakePool (Crypto era), Coin)]
-> Map (KeyHash 'StakePool (Crypto era)) Coin
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(KeyHash 'StakePool (Crypto era), Coin)]
 -> Map (KeyHash 'StakePool (Crypto era)) Coin)
-> [(KeyHash 'StakePool (Crypto era), Coin)]
-> Map (KeyHash 'StakePool (Crypto era)) Coin
forall a b. (a -> b) -> a -> b
$ (KeyHash 'StakePool (Crypto era)
 -> (KeyHash 'StakePool (Crypto era), Coin))
-> [KeyHash 'StakePool (Crypto era)]
-> [(KeyHash 'StakePool (Crypto era), Coin)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\KeyHash 'StakePool (Crypto era)
kh -> (KeyHash 'StakePool (Crypto era)
kh, PParams' Identity era -> HKD Identity Coin
forall (f :: * -> *) era. PParams' f era -> HKD f Coin
_poolDeposit Environment (POOLREAP era)
PParams' Identity era
pp)) (Set (KeyHash 'StakePool (Crypto era))
-> [KeyHash 'StakePool (Crypto era)]
forall a. Set a -> [a]
Set.toList Set (KeyHash 'StakePool (Crypto era))
retired)
      rewardAcnts :: Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era)
rewardAcnts = (PoolParams era -> RewardAcnt era)
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
-> Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era)
forall a b k. (a -> b) -> Map k a -> Map k b
Map.map PoolParams era -> RewardAcnt era
forall era. PoolParams era -> RewardAcnt era
_poolRAcnt (Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
 -> Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era))
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
-> Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era)
forall a b. (a -> b) -> a -> b
$ Exp (Map (KeyHash 'StakePool (Crypto era)) (PoolParams era))
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
forall s t. Embed s t => Exp t -> s
eval (Set (KeyHash 'StakePool (Crypto era))
retired Set (KeyHash 'StakePool (Crypto era))
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
-> Exp (Map (KeyHash 'StakePool (Crypto era)) (PoolParams era))
forall k s1 s2 (f :: * -> * -> *) v.
(Ord k, HasExp s1 (Sett k ()), HasExp s2 (f k v)) =>
s1 -> s2 -> Exp (f k v)
 (PState era
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
forall era.
PState era
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
_pParams PState era
ps))
      rewardAcnts' :: Map (RewardAcnt era) Coin
rewardAcnts' =
        (Coin -> Coin -> Coin)
-> [(RewardAcnt era, Coin)] -> Map (RewardAcnt era) Coin
forall k a. Ord k => (a -> a -> a) -> [(k, a)] -> Map k a
Map.fromListWith Coin -> Coin -> Coin
forall t. Val t => t -> t -> t
(<+>)
          ([(RewardAcnt era, Coin)] -> Map (RewardAcnt era) Coin)
-> (Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era, Coin)
    -> [(RewardAcnt era, Coin)])
-> Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era, Coin)
-> Map (RewardAcnt era) Coin
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era, Coin)
-> [(RewardAcnt era, Coin)]
forall k a. Map k a -> [a]
Map.elems
          (Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era, Coin)
 -> Map (RewardAcnt era) Coin)
-> Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era, Coin)
-> Map (RewardAcnt era) Coin
forall a b. (a -> b) -> a -> b
$ (RewardAcnt era -> Coin -> (RewardAcnt era, Coin))
-> Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era)
-> Map (KeyHash 'StakePool (Crypto era)) Coin
-> Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era, Coin)
forall k a b c.
Ord k =>
(a -> b -> c) -> Map k a -> Map k b -> Map k c
Map.intersectionWith (,) Map (KeyHash 'StakePool (Crypto era)) (RewardAcnt era)
rewardAcnts Map (KeyHash 'StakePool (Crypto era)) Coin
pr
      (Map (Credential 'Staking era) Coin
refunds, Map (Credential 'Staking era) Coin
mRefunds) =
        (Credential 'Staking era -> Coin -> Bool)
-> Map (Credential 'Staking era) Coin
-> (Map (Credential 'Staking era) Coin,
    Map (Credential 'Staking era) Coin)
forall k a. (k -> a -> Bool) -> Map k a -> (Map k a, Map k a)
Map.partitionWithKey
          (\Credential 'Staking era
k Coin
_ -> Exp Bool -> Bool
forall s t. Embed s t => Exp t -> s
eval (Credential 'Staking era
k Credential 'Staking era
-> Exp (Sett (Credential 'Staking era) ()) -> Exp Bool
forall k (g :: * -> * -> *) s.
(Show k, Ord k, Iter g, HasExp s (g k ())) =>
k -> s -> Exp Bool
 Map (Credential 'Staking era) Coin
-> Exp (Sett (Credential 'Staking era) ())
forall k s (f :: * -> * -> *) v.
(Ord k, HasExp s (f k v)) =>
s -> Exp (Sett k ())
dom (DState era -> Map (Credential 'Staking era) Coin
forall era. DState era -> RewardAccounts era
_rewards DState era
ds)))
          ((RewardAcnt era -> Credential 'Staking era)
-> Map (RewardAcnt era) Coin -> Map (Credential 'Staking era) Coin
forall k2 k1 a. Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a
Map.mapKeys RewardAcnt era -> Credential 'Staking era
forall era. RewardAcnt era -> Credential 'Staking era
getRwdCred Map (RewardAcnt era) Coin
rewardAcnts')
      refunded :: Coin
refunded = [Coin] -> Coin
forall (t :: * -> *) m. (Foldable t, Monoid m) => t m -> m
fold ([Coin] -> Coin) -> [Coin] -> Coin
forall a b. (a -> b) -> a -> b
$ Map (Credential 'Staking era) Coin -> [Coin]
forall k a. Map k a -> [a]
Map.elems Map (Credential 'Staking era) Coin
refunds
      unclaimed :: Coin
unclaimed = [Coin] -> Coin
forall (t :: * -> *) m. (Foldable t, Monoid m) => t m -> m
fold ([Coin] -> Coin) -> [Coin] -> Coin
forall a b. (a -> b) -> a -> b
$ Map (Credential 'Staking era) Coin -> [Coin]
forall k a. Map k a -> [a]
Map.elems Map (Credential 'Staking era) Coin
mRefunds

  PoolreapState era
-> F (Clause (POOLREAP era) 'Transition) (PoolreapState era)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PoolreapState era
 -> F (Clause (POOLREAP era) 'Transition) (PoolreapState era))
-> PoolreapState era
-> F (Clause (POOLREAP era) 'Transition) (PoolreapState era)
forall a b. (a -> b) -> a -> b
$
    UTxOState era
-> AccountState -> DState era -> PState era -> PoolreapState era
forall era.
UTxOState era
-> AccountState -> DState era -> PState era -> PoolreapState era
PoolreapState
      UTxOState era
us {_deposited :: Coin
_deposited = UTxOState era -> Coin
forall era. UTxOState era -> Coin
_deposited UTxOState era
us Coin -> Coin -> Coin
forall t. Val t => t -> t -> t
<-> (Coin
unclaimed Coin -> Coin -> Coin
forall t. Val t => t -> t -> t
<+> Coin
refunded)}
      AccountState
a {_treasury :: Coin
_treasury = AccountState -> Coin
_treasury AccountState
a Coin -> Coin -> Coin
forall t. Val t => t -> t -> t
<+> Coin
unclaimed}
      DState era
ds
        { _rewards :: Map (Credential 'Staking era) Coin
_rewards = Exp (Map (Credential 'Staking era) Coin)
-> Map (Credential 'Staking era) Coin
forall s t. Embed s t => Exp t -> s
eval (DState era -> Map (Credential 'Staking era) Coin
forall era. DState era -> RewardAccounts era
_rewards DState era
ds Map (Credential 'Staking era) Coin
-> Map (Credential 'Staking era) Coin
-> Exp (Map (Credential 'Staking era) Coin)
forall k n s1 (f :: * -> * -> *) s2.
(Ord k, Monoid n, HasExp s1 (f k n), HasExp s2 (f k n)) =>
s1 -> s2 -> Exp (f k n)
∪+ Map (Credential 'Staking era) Coin
refunds),
          _delegations :: Map (Credential 'Staking era) (KeyHash 'StakePool (Crypto era))
_delegations = Exp
  (Map (Credential 'Staking era) (KeyHash 'StakePool (Crypto era)))
-> Map (Credential 'Staking era) (KeyHash 'StakePool (Crypto era))
forall s t. Embed s t => Exp t -> s
eval (DState era
-> Map (Credential 'Staking era) (KeyHash 'StakePool (Crypto era))
forall era.
DState era
-> Map (Credential 'Staking era) (KeyHash 'StakePool (Crypto era))
_delegations DState era
ds Map (Credential 'Staking era) (KeyHash 'StakePool (Crypto era))
-> Set (KeyHash 'StakePool (Crypto era))
-> Exp
     (Map (Credential 'Staking era) (KeyHash 'StakePool (Crypto era)))
forall k (g :: * -> * -> *) v s1 (f :: * -> * -> *) s2.
(Ord k, Iter g, Ord v, HasExp s1 (f k v), HasExp s2 (g v ())) =>
s1 -> s2 -> Exp (f k v)
 Set (KeyHash 'StakePool (Crypto era))
retired)
        }
      PState era
ps
        { _pParams :: Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
_pParams = Exp (Map (KeyHash 'StakePool (Crypto era)) (PoolParams era))
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
forall s t. Embed s t => Exp t -> s
eval (Set (KeyHash 'StakePool (Crypto era))
retired Set (KeyHash 'StakePool (Crypto era))
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
-> Exp (Map (KeyHash 'StakePool (Crypto era)) (PoolParams era))
forall k (g :: * -> * -> *) s1 s2 (f :: * -> * -> *) v.
(Ord k, Iter g, HasExp s1 (g k ()), HasExp s2 (f k v)) =>
s1 -> s2 -> Exp (f k v)
 PState era
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
forall era.
PState era
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
_pParams PState era
ps),
          _fPParams :: Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
_fPParams = Exp (Map (KeyHash 'StakePool (Crypto era)) (PoolParams era))
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
forall s t. Embed s t => Exp t -> s
eval (Set (KeyHash 'StakePool (Crypto era))
retired Set (KeyHash 'StakePool (Crypto era))
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
-> Exp (Map (KeyHash 'StakePool (Crypto era)) (PoolParams era))
forall k (g :: * -> * -> *) s1 s2 (f :: * -> * -> *) v.
(Ord k, Iter g, HasExp s1 (g k ()), HasExp s2 (f k v)) =>
s1 -> s2 -> Exp (f k v)
 PState era
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
forall era.
PState era
-> Map (KeyHash 'StakePool (Crypto era)) (PoolParams era)
_fPParams PState era
ps),
          _retiring :: Map (KeyHash 'StakePool (Crypto era)) EpochNo
_retiring = Exp (Map (KeyHash 'StakePool (Crypto era)) EpochNo)
-> Map (KeyHash 'StakePool (Crypto era)) EpochNo
forall s t. Embed s t => Exp t -> s
eval (Set (KeyHash 'StakePool (Crypto era))
retired Set (KeyHash 'StakePool (Crypto era))
-> Map (KeyHash 'StakePool (Crypto era)) EpochNo
-> Exp (Map (KeyHash 'StakePool (Crypto era)) EpochNo)
forall k (g :: * -> * -> *) s1 s2 (f :: * -> * -> *) v.
(Ord k, Iter g, HasExp s1 (g k ()), HasExp s2 (f k v)) =>
s1 -> s2 -> Exp (f k v)
 PState era -> Map (KeyHash 'StakePool (Crypto era)) EpochNo
forall era.
PState era -> Map (KeyHash 'StakePool (Crypto era)) EpochNo
_retiring PState era
ps)
        }