Skip to content

Commit

Permalink
Merge pull request #254 from input-output-hk/newhoggy/remove-EraBased…
Browse files Browse the repository at this point in the history
…-prefix-and-add-Cmd-suffix

Remove `EraBased` prefix and add `Cmd` suffix
  • Loading branch information
newhoggy authored Sep 8, 2023
2 parents 1cd635e + a33520e commit 51fb8ee
Show file tree
Hide file tree
Showing 13 changed files with 237 additions and 248 deletions.
60 changes: 30 additions & 30 deletions cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
module Cardano.CLI.EraBased.Commands.Governance.Actions
( AnyStakeIdentifier(..)
, GovernanceActionCmds(..)
, EraBasedNewCommittee(..)
, EraBasedNewConstitution(..)
, EraBasedNoConfidence(..)
, EraBasedTreasuryWithdrawal(..)
, NewCommitteeCmd(..)
, NewConstitutionCmd(..)
, NoConfidenceCmd(..)
, TreasuryWithdrawalCmd(..)
, renderGovernanceActionCmds
) where

Expand All @@ -24,32 +24,32 @@ import Data.Text (Text)
import Data.Word

data GovernanceActionCmds era
= GovernanceActionCreateConstitution
= GovernanceActionCreateConstitutionCmd
(ConwayEraOnwards era)
EraBasedNewConstitution
| GoveranceActionCreateNewCommittee
NewConstitutionCmd
| GoveranceActionCreateNewCommitteeCmd
(ConwayEraOnwards era)
EraBasedNewCommittee
| GovernanceActionCreateNoConfidence
NewCommitteeCmd
| GovernanceActionCreateNoConfidenceCmd
(ConwayEraOnwards era)
EraBasedNoConfidence
| GovernanceActionProtocolParametersUpdate
NoConfidenceCmd
| GovernanceActionProtocolParametersUpdateCmd
(ShelleyBasedEra era)
EpochNo
[VerificationKeyFile In]
(EraBasedProtocolParametersUpdate era)
(File () Out)
| GovernanceActionTreasuryWithdrawal
| GovernanceActionTreasuryWithdrawalCmd
(ConwayEraOnwards era)
EraBasedTreasuryWithdrawal
| GoveranceActionInfo -- TODO: Conway era - ledger currently provides a placeholder constructor
TreasuryWithdrawalCmd
| GoveranceActionInfoCmd -- TODO: Conway era - ledger currently provides a placeholder constructor
(ConwayEraOnwards era)
(File () In)
(File () Out)
deriving Show

data EraBasedNewCommittee
= EraBasedNewCommittee
data NewCommitteeCmd
= NewCommitteeCmd
{ ebNetwork :: Ledger.Network
, ebDeposit :: Lovelace
, ebReturnAddress :: AnyStakeIdentifier
Expand All @@ -62,8 +62,8 @@ data EraBasedNewCommittee
, ebFilePath :: File () Out
} deriving Show

data EraBasedNewConstitution
= EraBasedNewConstitution
data NewConstitutionCmd
= NewConstitutionCmd
{ encNetwork :: Ledger.Network
, encDeposit :: Lovelace
, encStakeCredential :: AnyStakeIdentifier
Expand All @@ -75,8 +75,8 @@ data EraBasedNewConstitution
, encFilePath :: File () Out
} deriving Show

data EraBasedNoConfidence
= EraBasedNoConfidence
data NoConfidenceCmd
= NoConfidenceCmd
{ ncNetwork :: Ledger.Network
, ncDeposit :: Lovelace
, ncStakeCredential :: AnyStakeIdentifier
Expand All @@ -87,37 +87,37 @@ data EraBasedNoConfidence
, ncFilePath :: File () Out
} deriving Show

data EraBasedTreasuryWithdrawal where
EraBasedTreasuryWithdrawal
data TreasuryWithdrawalCmd where
TreasuryWithdrawalCmd
:: Ledger.Network
-> Lovelace -- ^ Deposit
-> AnyStakeIdentifier -- ^ Return address
-> ProposalUrl
-> ProposalHashSource
-> [(AnyStakeIdentifier, Lovelace)]
-> File () Out
-> EraBasedTreasuryWithdrawal
-> TreasuryWithdrawalCmd

deriving instance Show EraBasedTreasuryWithdrawal
deriving instance Show TreasuryWithdrawalCmd

renderGovernanceActionCmds :: GovernanceActionCmds era -> Text
renderGovernanceActionCmds = \case
GovernanceActionCreateConstitution {} ->
GovernanceActionCreateConstitutionCmd {} ->
"governance action create-constitution"

GovernanceActionProtocolParametersUpdate {} ->
GovernanceActionProtocolParametersUpdateCmd {} ->
"governance action create-protocol-parameters-update"

GovernanceActionTreasuryWithdrawal {} ->
GovernanceActionTreasuryWithdrawalCmd {} ->
"governance action create-treasury-withdrawal"

GoveranceActionCreateNewCommittee {} ->
GoveranceActionCreateNewCommitteeCmd {} ->
"governance action create-new-committee"

GovernanceActionCreateNoConfidence {} ->
GovernanceActionCreateNoConfidenceCmd {} ->
"governance action create-no-confidence"

GoveranceActionInfo {} ->
GoveranceActionInfoCmd {} ->
"governance action create-info"

data AnyStakeIdentifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,37 @@ import Cardano.CLI.Types.Key.VerificationKey
import Data.Text (Text)

data GovernanceCommitteeCmds era
= GovernanceCommitteeKeyGenCold
= GovernanceCommitteeKeyGenColdCmd
(ConwayEraOnwards era)
(File (VerificationKey ()) Out)
(File (SigningKey ()) Out)
| GovernanceCommitteeKeyGenHot
| GovernanceCommitteeKeyGenHotCmd
(ConwayEraOnwards era)
(File (VerificationKey ()) Out)
(File (SigningKey ()) Out)
| GovernanceCommitteeKeyHash -- TODO to be moved under the top-level command group "key"
| GovernanceCommitteeKeyHashCmd -- TODO to be moved under the top-level command group "key"
(ConwayEraOnwards era)
AnyVerificationKeySource
| GovernanceCommitteeCreateHotKeyAuthorizationCertificate -- TODO to be moved under the top-level command group "key"
| GovernanceCommitteeCreateHotKeyAuthorizationCertificateCmd -- TODO to be moved under the top-level command group "key"
(ConwayEraOnwards era)
(VerificationKeyOrHashOrFile CommitteeColdKey)
(VerificationKeyOrHashOrFile CommitteeHotKey)
(File () Out)
| GovernanceCommitteeCreateColdKeyResignationCertificate
| GovernanceCommitteeCreateColdKeyResignationCertificateCmd
(ConwayEraOnwards era)
(VerificationKeyOrHashOrFile CommitteeColdKey)
(File () Out)
deriving Show

renderGovernanceCommitteeCmds :: GovernanceCommitteeCmds era -> Text
renderGovernanceCommitteeCmds = \case
GovernanceCommitteeKeyGenCold {} ->
GovernanceCommitteeKeyGenColdCmd {} ->
"governance committee key-gen-cold"
GovernanceCommitteeKeyGenHot {} ->
GovernanceCommitteeKeyGenHotCmd {} ->
"governance committee key-gen-hot"
GovernanceCommitteeKeyHash {} ->
GovernanceCommitteeKeyHashCmd {} ->
"governance committee key-hash"
GovernanceCommitteeCreateHotKeyAuthorizationCertificate {} ->
GovernanceCommitteeCreateHotKeyAuthorizationCertificateCmd {} ->
"governance committee create-hot-key-authorization-certificate"
GovernanceCommitteeCreateColdKeyResignationCertificate {} ->
GovernanceCommitteeCreateColdKeyResignationCertificateCmd {} ->
"governance committee create-cold-key-resignation-certificate"
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data GovernanceDRepCmds era
StakeIdentifier
AnyDelegationTarget
(File () Out)
| GovernanceDRepGenerateKey
| GovernanceDRepGenerateKeyCmd
(ConwayEraOnwards era)
(File (VerificationKey ()) Out)
(File (SigningKey ()) Out)
Expand All @@ -37,7 +37,7 @@ renderGovernanceDRepCmds :: ()
renderGovernanceDRepCmds = \case
GovernanceDRepDelegationCertificateCmd {} ->
"governance drep delegation-certificate"
GovernanceDRepGenerateKey{} ->
GovernanceDRepGenerateKeyCmd{} ->
"governance drep key-gen"
GovernanceDRepIdCmd {} ->
"governance drep id"
Expand Down
42 changes: 21 additions & 21 deletions cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

module Cardano.CLI.EraBased.Commands.Governance.Query
( GovernanceQueryCmds(..)
, EraBasedNoArgQuery(..)
, EraBasedDRepStateQuery(..)
, EraBasedDRepStakeDistributionQuery(..)
, NoArgQueryCmd(..)
, DRepStateQueryCmd(..)
, DRepStakeDistributionQueryCmd(..)
, renderGovernanceQueryCmds
) where

Expand All @@ -17,39 +17,39 @@ import Cardano.CLI.Types.Key
import Data.Text (Text)

data GovernanceQueryCmds era
= GovernanceQueryConstitution
= GovernanceQueryConstitutionCmd
(ConwayEraOnwards era)
EraBasedNoArgQuery
| GovernanceQueryGovState
NoArgQueryCmd
| GovernanceQueryGovStateCmd
(ConwayEraOnwards era)
EraBasedNoArgQuery
| GovernanceQueryDRepState
NoArgQueryCmd
| GovernanceQueryDRepStateCmd
(ConwayEraOnwards era)
EraBasedDRepStateQuery
| GovernanceQueryDRepStakeDistribution
DRepStateQueryCmd
| GovernanceQueryDRepStakeDistributionCmd
(ConwayEraOnwards era)
EraBasedDRepStakeDistributionQuery
| GovernanceQueryCommitteeState
DRepStakeDistributionQueryCmd
| GovernanceQueryCommitteeStateCmd
(ConwayEraOnwards era)
EraBasedNoArgQuery
NoArgQueryCmd
deriving Show

data EraBasedNoArgQuery = EraBasedNoArgQuery
data NoArgQueryCmd = NoArgQueryCmd
{ naSocketPath :: !SocketPath
, naConsensusModeParams :: !AnyConsensusModeParams
, naNetworkId :: !NetworkId
, naOutputFile :: !(Maybe (File () Out))
} deriving Show

data EraBasedDRepStateQuery = EraBasedDRepStateQuery
data DRepStateQueryCmd = DRepStateQueryCmd
{ dsSocketPath :: !SocketPath
, dsConsensusModeParams :: !AnyConsensusModeParams
, dsNetworkId :: !NetworkId
, dsDRepKeys :: ![VerificationKeyOrHashOrFile DRepKey]
, dsOutputFile :: !(Maybe (File () Out))
} deriving Show

data EraBasedDRepStakeDistributionQuery = EraBasedDRepStakeDistributionQuery
data DRepStakeDistributionQueryCmd = DRepStakeDistributionQueryCmd
{ dsdSocketPath :: !SocketPath
, dsdConsensusModeParams :: !AnyConsensusModeParams
, dsdNetworkId :: !NetworkId
Expand All @@ -59,8 +59,8 @@ data EraBasedDRepStakeDistributionQuery = EraBasedDRepStakeDistributionQuery

renderGovernanceQueryCmds :: GovernanceQueryCmds era -> Text
renderGovernanceQueryCmds = ("governance query " <>) . \case
GovernanceQueryConstitution{} -> "constitution"
GovernanceQueryGovState{} -> "gov-state"
GovernanceQueryDRepState{} -> "drep-state"
GovernanceQueryDRepStakeDistribution{} -> "drep-stake-distribution"
GovernanceQueryCommitteeState{} -> "committee-state"
GovernanceQueryConstitutionCmd{} -> "constitution"
GovernanceQueryGovStateCmd{} -> "gov-state"
GovernanceQueryDRepStateCmd{} -> "drep-state"
GovernanceQueryDRepStakeDistributionCmd{} -> "drep-stake-distribution"
GovernanceQueryCommitteeStateCmd{} -> "committee-state"
Loading

0 comments on commit 51fb8ee

Please sign in to comment.