Certs
module Ledger.Conway.Foreign.HSLedger.Certs where open import Ledger.Conway.Foreign.HSLedger.Address open import Ledger.Conway.Foreign.HSLedger.BaseTypes renaming (⟦_,_,_⟧ᵈ to ⟦_,_,_⟧ᵈ'; DState to DState' ; ⟦_,_⟧ᵛ to ⟦_,_⟧ᵛ'; GState to GState') hiding (CertEnv) open import Ledger.Conway.Foreign.HSLedger.Gov.Core open import Ledger.Conway.Foreign.HSLedger.PParams open import Ledger.Conway.Conformance.Certs govStructure using (⟦_,_,_,_⟧ᵈ; ⟦_,_,_⟧ᵛ; DState; GState; CertEnv) open import Ledger.Conway.Specification.Certs.Properties.Computational govStructure using (Computational-POOL) open import Ledger.Conway.Conformance.Certs.Properties govStructure using ( Computational-DELEG ; Computational-GOVCERT ) instance HsTy-StakePoolParams = autoHsType StakePoolParams Conv-StakePoolParams = autoConvert StakePoolParams HsTy-DepositPurpose = autoHsType DepositPurpose Conv-DepositPurpose = autoConvert DepositPurpose HsTy-DelegEnv = autoHsType DelegEnv ⊣ withConstructor "MkDelegEnv" • fieldPrefix "de" • withName "DelegEnv" Conv-DelegEnv = autoConvert DelegEnv HsTy-PState = autoHsType PState ⊣ withConstructor "MkPState" • fieldPrefix "ps" Conv-PState = autoConvert PState record CertEnv' : Type where field epoch : Epoch pp : PParams votes : List GovVote' wdrls : RewardAddress ⇀ Coin coldCreds : ℙ Credential instance HsTy-CertEnv' = autoHsType CertEnv' ⊣ withConstructor "MkCertEnv" • withName "CertEnv" • fieldPrefix "ce" Conv-CertEnv' = autoConvert CertEnv' mkCertEnv' : Convertible CertEnv CertEnv' mkCertEnv' = λ where .to ce → let module ce = CertEnv ce in record { epoch = ce.epoch ; pp = ce.pp ; votes = to ce.votes ; wdrls = ce.wdrls ; coldCreds = ce.coldCreds } .from ce → let module ce = CertEnv' ce in record { epoch = ce.epoch ; pp = ce.pp ; votes = from ce.votes ; wdrls = ce.wdrls ; coldCreds = ce.coldCreds } HsTy-CertEnv = MkHsType CertEnv (HsType CertEnv') Conv-CertEnv = mkCertEnv' ⨾ Conv-CertEnv' instance HsTy-DState = autoHsType DState ⊣ withConstructor "MkDState" • withName "DState" • fieldPrefix "ds" Conv-DState = autoConvert DState HsTy-DCert = autoHsType DCert Conv-DCert = autoConvert DCert HsTy-GState = autoHsType GState ⊣ withConstructor "MkGState" • fieldPrefix "gs" Conv-GState = autoConvert GState Conv-DState-DState' : Convertible DState DState' Conv-DState-DState' .to $\begin{pmatrix} \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2657}{\htmlId{2657}{\htmlClass{Bound}{\text{voteDelegs}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2670}{\htmlId{2670}{\htmlClass{Bound}{\text{stakeDelegs}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2684}{\htmlId{2684}{\htmlClass{Bound}{\text{rewards}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2694}{\htmlId{2694}{\htmlClass{Bound}{\text{deposits}}}}\, \end{pmatrix}$ = $\begin{pmatrix} \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2657}{\htmlId{2710}{\htmlClass{Bound}{\text{voteDelegs}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2670}{\htmlId{2723}{\htmlClass{Bound}{\text{stakeDelegs}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2670}{\htmlId{2737}{\htmlClass{Bound}{\text{stakeDelegs}}}}\, \end{pmatrix}$ Conv-DState-DState' .from $\begin{pmatrix} \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2783}{\htmlId{2783}{\htmlClass{Bound}{\text{voteDelegs}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2796}{\htmlId{2796}{\htmlClass{Bound}{\text{stakeDelegs}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2810}{\htmlId{2810}{\htmlClass{Bound}{\text{rewards}}}}\, \end{pmatrix}$ = $\begin{pmatrix} \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2783}{\htmlId{2834}{\htmlClass{Bound}{\text{voteDelegs}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2796}{\htmlId{2847}{\htmlClass{Bound}{\text{stakeDelegs}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2796}{\htmlId{2861}{\htmlClass{Bound}{\text{stakeDelegs}}}}\, \\ \,\href{Class.HasEmptySet.html#287}{\htmlId{2875}{\htmlClass{Field}{\text{∅}}}}\, \end{pmatrix}$ Conv-GState-GState' : Convertible GState GState' Conv-GState-GState' .to $\begin{pmatrix} \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2960}{\htmlId{2960}{\htmlClass{Bound}{\text{dreps}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2968}{\htmlId{2968}{\htmlClass{Bound}{\text{ccHotKeys}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2980}{\htmlId{2980}{\htmlClass{Bound}{\text{deposits}}}}\, \end{pmatrix}$ = $\begin{pmatrix} \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2960}{\htmlId{2996}{\htmlClass{Bound}{\text{dreps}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#2968}{\htmlId{3004}{\htmlClass{Bound}{\text{ccHotKeys}}}}\, \end{pmatrix}$ Conv-GState-GState' .from $\begin{pmatrix} \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#3048}{\htmlId{3048}{\htmlClass{Bound}{\text{dreps}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#3056}{\htmlId{3056}{\htmlClass{Bound}{\text{ccHotKeys}}}}\, \end{pmatrix}$ = $\begin{pmatrix} \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#3048}{\htmlId{3082}{\htmlClass{Bound}{\text{dreps}}}}\, \\ \,\href{Ledger.Conway.Foreign.HSLedger.Certs.html#3056}{\htmlId{3090}{\htmlClass{Bound}{\text{ccHotKeys}}}}\, \\ \,\href{Class.HasEmptySet.html#287}{\htmlId{3102}{\htmlClass{Field}{\text{∅}}}}\, \end{pmatrix}$ deleg-step : HsType (DelegEnv → DState → DCert → ComputationResult String DState) deleg-step = to (compute Computational-DELEG) {-# COMPILE GHC deleg-step as delegStep #-} pool-step : HsType (PParams → PState → DCert → ComputationResult String PState) pool-step = to (compute Computational-POOL) {-# COMPILE GHC pool-step as poolStep #-} govcert-step : HsType (CertEnv → GState → DCert → ComputationResult String GState) govcert-step = to (compute Computational-GOVCERT) {-# COMPILE GHC govcert-step as govCertStep #-}