Actions

module Ledger.Conway.Foreign.Gov.Actions where

open import Data.Rational using ()
open import Foreign.Convertible
open import Foreign.Convertible.Deriving
open import Foreign.HaskellTypes
open import Foreign.HaskellTypes.Deriving

open import Ledger.Prelude
open import Ledger.Prelude.Foreign.HSTypes

open import Ledger.Conway.Foreign.HSStructures
open import Ledger.Conway.Foreign.PParams
open import Ledger.Core.Foreign.Address
open import Ledger.Conway.Specification.Gov.Base
open import Ledger.Conway.Specification.Gov.Actions govStructure using (Vote) public
open import Ledger.Core.Specification.ProtocolVersion

DocHash = GovStructure.DocHash govStructure

-- nondependent version of GovAction
data GovAction' : Type where
  NoConfidence        :                                             GovAction'
  UpdateCommittee     : (Credential  Epoch)   Credential      GovAction'
  NewConstitution     : DocHash  Maybe ScriptHash                 GovAction'
  TriggerHardFork     : ProtVer                                    GovAction'
  ChangePParams       : PParamsUpdate                              GovAction'
  TreasuryWithdrawal  : (RewardAddress  Treasury)                 GovAction'
  Info                :                                             GovAction'

instance
  mkGovAction' : Convertible GovAction GovAction'
  mkGovAction' = λ where
    .to $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2500}{\htmlId{1480}{\htmlClass{InductiveConstructor}{\text{NoConfidence}}}}\,        \\ \,\htmlId{1502}{\htmlClass{Symbol}{\text{\_}}}\,           \end{pmatrix}$  NoConfidence
    .to $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2538}{\htmlId{1543}{\htmlClass{InductiveConstructor}{\text{UpdateCommittee}}}}\,     \\ \,\htmlId{1565}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Conway.Foreign.Gov.Actions.html#1566}{\htmlId{1566}{\htmlClass{Bound}{\text{m}}}}\, , \,\href{Ledger.Conway.Foreign.Gov.Actions.html#1570}{\htmlId{1570}{\htmlClass{Bound}{\text{p}}}}\, , \,\href{Ledger.Conway.Foreign.Gov.Actions.html#1574}{\htmlId{1574}{\htmlClass{Bound}{\text{q}}}}\,\,\htmlId{1575}{\htmlClass{Symbol}{\text{)}}}\, \end{pmatrix}$  (UpdateCommittee m p q)
    .to $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2576}{\htmlId{1617}{\htmlClass{InductiveConstructor}{\text{NewConstitution}}}}\,     \\ \,\htmlId{1639}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Conway.Foreign.Gov.Actions.html#1640}{\htmlId{1640}{\htmlClass{Bound}{\text{dh}}}}\, , \,\href{Ledger.Conway.Foreign.Gov.Actions.html#1645}{\htmlId{1645}{\htmlClass{Bound}{\text{s}}}}\, \,\htmlId{1647}{\htmlClass{Symbol}{\text{)}}}\,   \end{pmatrix}$  (NewConstitution dh s)
    .to $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2614}{\htmlId{1690}{\htmlClass{InductiveConstructor}{\text{TriggerHardFork}}}}\,     \\ \,\href{Ledger.Conway.Foreign.Gov.Actions.html#1712}{\htmlId{1712}{\htmlClass{Bound}{\text{p}}}}\,           \end{pmatrix}$  (TriggerHardFork p)
    .to $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2652}{\htmlId{1760}{\htmlClass{InductiveConstructor}{\text{ChangePParams}}}}\,       \\ \,\href{Ledger.Conway.Foreign.Gov.Actions.html#1782}{\htmlId{1782}{\htmlClass{Bound}{\text{pu}}}}\,          \end{pmatrix}$  (ChangePParams pu)
    .to $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2690}{\htmlId{1829}{\htmlClass{InductiveConstructor}{\text{TreasuryWithdrawal}}}}\,  \\ \,\href{Ledger.Conway.Foreign.Gov.Actions.html#1851}{\htmlId{1851}{\htmlClass{Bound}{\text{m}}}}\,           \end{pmatrix}$  ((TreasuryWithdrawal m))
    .to $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2728}{\htmlId{1904}{\htmlClass{InductiveConstructor}{\text{Info}}}}\,                \\ \,\htmlId{1926}{\htmlClass{Symbol}{\text{\_}}}\,           \end{pmatrix}$  Info
    .from NoConfidence               $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2500}{\htmlId{1989}{\htmlClass{InductiveConstructor}{\text{NoConfidence}}}}\,        \\ \,\href{Agda.Builtin.Unit.html#212}{\htmlId{2011}{\htmlClass{InductiveConstructor}{\text{tt}}}}\,          \end{pmatrix}$
    .from (UpdateCommittee m p q)    $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2538}{\htmlId{2067}{\htmlClass{InductiveConstructor}{\text{UpdateCommittee}}}}\,     \\ \,\htmlId{2089}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Conway.Foreign.Gov.Actions.html#2054}{\htmlId{2090}{\htmlClass{Bound}{\text{m}}}}\, , \,\href{Ledger.Conway.Foreign.Gov.Actions.html#2056}{\htmlId{2094}{\htmlClass{Bound}{\text{p}}}}\, , \,\href{Ledger.Conway.Foreign.Gov.Actions.html#2058}{\htmlId{2098}{\htmlClass{Bound}{\text{q}}}}\,\,\htmlId{2099}{\htmlClass{Symbol}{\text{)}}}\, \end{pmatrix}$
    .from (NewConstitution dh s)     $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2576}{\htmlId{2145}{\htmlClass{InductiveConstructor}{\text{NewConstitution}}}}\,     \\ \,\htmlId{2167}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Conway.Foreign.Gov.Actions.html#2132}{\htmlId{2168}{\htmlClass{Bound}{\text{dh}}}}\, , \,\href{Ledger.Conway.Foreign.Gov.Actions.html#2135}{\htmlId{2173}{\htmlClass{Bound}{\text{s}}}}\,\,\htmlId{2174}{\htmlClass{Symbol}{\text{)}}}\,    \end{pmatrix}$
    .from (TriggerHardFork p)        $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2614}{\htmlId{2223}{\htmlClass{InductiveConstructor}{\text{TriggerHardFork}}}}\,     \\ \,\href{Ledger.Conway.Foreign.Gov.Actions.html#2210}{\htmlId{2245}{\htmlClass{Bound}{\text{p}}}}\,           \end{pmatrix}$
    .from (ChangePParams pu)         $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2652}{\htmlId{2301}{\htmlClass{InductiveConstructor}{\text{ChangePParams}}}}\,       \\ \,\href{Ledger.Conway.Foreign.Gov.Actions.html#2286}{\htmlId{2323}{\htmlClass{Bound}{\text{pu}}}}\,          \end{pmatrix}$
    .from (TreasuryWithdrawal m)     $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2690}{\htmlId{2379}{\htmlClass{InductiveConstructor}{\text{TreasuryWithdrawal}}}}\,  \\ \,\href{Ledger.Conway.Foreign.Gov.Actions.html#2369}{\htmlId{2401}{\htmlClass{Bound}{\text{m}}}}\,           \end{pmatrix}$
    .from Info                       $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#2728}{\htmlId{2457}{\htmlClass{InductiveConstructor}{\text{Info}}}}\,                \\ \,\href{Agda.Builtin.Unit.html#212}{\htmlId{2479}{\htmlClass{InductiveConstructor}{\text{tt}}}}\,          \end{pmatrix}$

  HsTy-GovAction' = autoHsType GovAction'  withName "GovAction"
  Conv-GovAction' = autoConvert GovAction'

  HsTy-GovAction = MkHsType GovAction (HsType GovAction')
  Conv-GovAction = mkGovAction'  Conv-GovAction'