The POOLREAP Transition System
{-# OPTIONS --safe #-}
open import Ledger.Conway.Specification.Abstract
open import Ledger.Conway.Specification.Transaction
module Ledger.Conway.Specification.PoolReap
(txs : _) (open TransactionStructure txs)
(abs : AbstractFunctions txs)
where
open import Ledger.Prelude
open import Ledger.Conway.Specification.Utxo txs abs
open import Ledger.Conway.Specification.Certs govStructure
record PoolReapState : Type where
inductive
constructor ⟦_,_,_,_⟧ᵖ
field
utxoSt : UTxOState
acnt : Acnt
dState : DState
pState : PState
instance
unquoteDecl HasCast-PoolReapState = derive-HasCast
[ (quote PoolReapState , HasCast-PoolReapState) ]
private variable
e lastEpoch : Epoch
poolReapState : PoolReapState
data
_⊢_⇀⦇_,POOLREAP⦈_ : ⊤ → PoolReapState → Epoch → PoolReapState → Type where
POOLREAP : let
open PoolReapState poolReapState
open StakePoolParams
open UTxOState
open PState
open DState
open Acnt
open PParams
retired = pState .retiring ⁻¹ e
rewardAcnts : DepositPurpose ⇀ Credential
rewardAcnts =
mapKeys PoolDeposit $
mapValues rewardAccount $
pState .pools ∣ retired
rewardAcnts' : Credential ⇀ Coin
rewardAcnts' = aggregateBy (rewardAcnts ˢ) (utxoSt .deposits)
refunds : Credential ⇀ Coin
refunds = rewardAcnts' ∣ dom (dState .rewards)
mRefunds = rewardAcnts' ∣ dom (dState .rewards) ᶜ
unclaimed = getCoin mRefunds
retiredDeposits : ℙ DepositPurpose
retiredDeposits = mapˢ PoolDeposit retired
utxoSt' = record utxoSt { deposits = utxoSt .deposits ∣ retiredDeposits ᶜ }
acnt' = record acnt { treasury = acnt .treasury + unclaimed }
dState' =
$\begin{pmatrix} \,\href{Ledger.Conway.Specification.PoolReap.html#819}{\htmlId{2115}{\htmlClass{Function}{\text{dState}}}}\, \,\htmlId{2122}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Ledger.Conway.Specification.Certs.html#4480}{\htmlId{2123}{\htmlClass{Field}{\text{voteDelegs}}}}\,
\\ \,\href{Ledger.Conway.Specification.PoolReap.html#819}{\htmlId{2142}{\htmlClass{Function}{\text{dState}}}}\, \,\htmlId{2149}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Ledger.Conway.Specification.Certs.html#4510}{\htmlId{2150}{\htmlClass{Field}{\text{stakeDelegs}}}}\, \,\href{Axiom.Set.Map.html#17850}{\htmlId{2162}{\htmlClass{Function Operator}{\text{∣\^{}}}}}\, \,\href{Ledger.Conway.Specification.PoolReap.html#1390}{\htmlId{2165}{\htmlClass{Bound}{\text{retired}}}}\, \,\href{Axiom.Set.Map.html#17850}{\htmlId{2173}{\htmlClass{Function Operator}{\text{ᶜ}}}}\,
\\ \,\href{Ledger.Conway.Specification.PoolReap.html#819}{\htmlId{2183}{\htmlClass{Function}{\text{dState}}}}\, \,\htmlId{2190}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Ledger.Conway.Specification.Certs.html#4541}{\htmlId{2191}{\htmlClass{Field}{\text{rewards}}}}\, \,\href{Axiom.Set.Map.Dec.html#2149}{\htmlId{2199}{\htmlClass{Function Operator}{\text{∪⁺}}}}\, \,\href{Ledger.Conway.Specification.PoolReap.html#1688}{\htmlId{2202}{\htmlClass{Bound}{\text{refunds}}}}\,
\end{pmatrix}$
pState' =
$\begin{pmatrix} \,\href{Ledger.Conway.Specification.PoolReap.html#868}{\htmlId{2241}{\htmlClass{Function}{\text{pState}}}}\, \,\htmlId{2248}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Ledger.Conway.Specification.Certs.html#4604}{\htmlId{2249}{\htmlClass{Field}{\text{pools}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{2255}{\htmlClass{Function Operator}{\text{∣}}}}\, \,\href{Ledger.Conway.Specification.PoolReap.html#1390}{\htmlId{2257}{\htmlClass{Bound}{\text{retired}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{2265}{\htmlClass{Function Operator}{\text{ᶜ}}}}\,
\\ \,\href{Ledger.Conway.Specification.PoolReap.html#868}{\htmlId{2275}{\htmlClass{Function}{\text{pState}}}}\, \,\htmlId{2282}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Ledger.Conway.Specification.Certs.html#4626}{\htmlId{2283}{\htmlClass{Field}{\text{fPools}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{2290}{\htmlClass{Function Operator}{\text{∣}}}}\, \,\href{Ledger.Conway.Specification.PoolReap.html#1390}{\htmlId{2292}{\htmlClass{Bound}{\text{retired}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{2300}{\htmlClass{Function Operator}{\text{ᶜ}}}}\,
\\ \,\href{Ledger.Conway.Specification.PoolReap.html#868}{\htmlId{2310}{\htmlClass{Function}{\text{pState}}}}\, \,\htmlId{2317}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Ledger.Conway.Specification.Certs.html#4648}{\htmlId{2318}{\htmlClass{Field}{\text{retiring}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{2327}{\htmlClass{Function Operator}{\text{∣}}}}\, \,\href{Ledger.Conway.Specification.PoolReap.html#1390}{\htmlId{2329}{\htmlClass{Bound}{\text{retired}}}}\, \,\href{Axiom.Set.Map.html#13606}{\htmlId{2337}{\htmlClass{Function Operator}{\text{ᶜ}}}}\,
\end{pmatrix}$
in
────────────────────────────────
_ ⊢ $\begin{pmatrix} \,\href{Ledger.Conway.Specification.PoolReap.html#733}{\htmlId{2402}{\htmlClass{Function}{\text{utxoSt}}}}\, \\ \,\href{Ledger.Conway.Specification.PoolReap.html#776}{\htmlId{2411}{\htmlClass{Function}{\text{acnt}}}}\, \\ \,\href{Ledger.Conway.Specification.PoolReap.html#819}{\htmlId{2418}{\htmlClass{Function}{\text{dState}}}}\, \\ \,\href{Ledger.Conway.Specification.PoolReap.html#868}{\htmlId{2427}{\htmlClass{Function}{\text{pState}}}}\, \end{pmatrix}$ ⇀⦇ e ,POOLREAP⦈ $\begin{pmatrix} \,\href{Ledger.Conway.Specification.PoolReap.html#1949}{\htmlId{2454}{\htmlClass{Bound}{\text{utxoSt'}}}}\, \\ \,\href{Ledger.Conway.Specification.PoolReap.html#2030}{\htmlId{2464}{\htmlClass{Bound}{\text{acnt'}}}}\, \\ \,\href{Ledger.Conway.Specification.PoolReap.html#2097}{\htmlId{2472}{\htmlClass{Bound}{\text{dState'}}}}\, \\ \,\href{Ledger.Conway.Specification.PoolReap.html#2223}{\htmlId{2482}{\htmlClass{Bound}{\text{pState'}}}}\, \end{pmatrix}$