7
7
{-# LANGUAGE TypeApplications #-}
8
8
9
9
module Cardano.Testnet.Test.LedgerEvents.Gov.PredefinedAbstainDRep
10
- ( hprop_check_predefined_abstain_drep
10
+ ( AutomaticDRepFlag (.. )
11
+ , hprop_check_predefined_abstain_drep
11
12
, delegateToAutomaticDRep
12
13
, desiredPoolNumberProposalTest
13
14
, getDesiredPoolNumberValue
@@ -120,37 +121,22 @@ hprop_check_predefined_abstain_drep = H.integrationWorkspace "test-activity" $ \
120
121
void $ desiredPoolNumberProposalTest execConfig epochStateView configurationFile socketPath ceo gov " firstProposal"
121
122
wallet0 Nothing [(1 , " yes" )] newNumberOfDesiredPools 3 (Just initialDesiredNumberOfPools) 10
122
123
123
- -- Take the last two stake delegators and delegate them to "Abstain ".
124
- delegateToAlwaysAbstain execConfig epochStateView configurationFile socketPath sbe gov " delegateToAbstain1"
125
- wallet1 (defaultDelegatorStakeKeyPair 2 )
126
- delegateToAlwaysAbstain execConfig epochStateView configurationFile socketPath sbe gov " delegateToAbstain2"
127
- wallet2 (defaultDelegatorStakeKeyPair 3 )
124
+ -- Take the last two stake delegators and delegate them to "AlwaysAbstainDRep ".
125
+ delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath sbe gov " delegateToAbstain1"
126
+ AlwaysAbstainDRep wallet1 (defaultDelegatorStakeKeyPair 2 )
127
+ delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath sbe gov " delegateToAbstain2"
128
+ AlwaysAbstainDRep wallet2 (defaultDelegatorStakeKeyPair 3 )
128
129
129
130
-- Do some other proposal and vote yes with first DRep only
130
131
-- and assert the new proposal passes now.
131
132
let newNumberOfDesiredPools2 = newNumberOfDesiredPools + 1
132
133
void $ desiredPoolNumberProposalTest execConfig epochStateView configurationFile socketPath ceo gov " secondProposal"
133
134
wallet0 Nothing [(1 , " yes" )] newNumberOfDesiredPools2 0 (Just newNumberOfDesiredPools2) 10
134
135
135
- -- | Delegates a staking key pair to the "always abstain" automated DRep
136
- delegateToAlwaysAbstain
137
- :: (HasCallStack , MonadTest m , MonadIO m , H. MonadAssertion m , MonadCatch m )
138
- => H. ExecConfig -- ^ Specifies the CLI execution configuration.
139
- -> EpochStateView -- ^ Current epoch state view for transaction building. It can be obtained
140
- -- using the 'getEpochStateView' function.
141
- -> FilePath -- ^ Path to the node configuration file as returned by 'cardanoTestnetDefault'.
142
- -> FilePath -- ^ Path to the cardano-node unix socket file.
143
- -> ShelleyBasedEra ConwayEra -- ^ The Shelley based era witness for ConwayEra
144
- -> FilePath -- ^ Base directory path where generated files will be stored.
145
- -> String -- ^ Name for the subfolder that will be created under 'work' folder.
146
- -> PaymentKeyInfo -- ^ Wallet that will pay for the transaction.
147
- -> StakingKeyPair -- ^ Staking key pair used for delegation.
148
- -> m ()
149
- delegateToAlwaysAbstain execConfig epochStateView configurationFile socketPath sbe work prefix =
150
- delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath sbe work prefix
151
- " --always-abstain"
136
+ -- | Which automatic DRep to delegate to
137
+ data AutomaticDRepFlag = AlwaysAbstainDRep
138
+ | NoConfidenceDRep
152
139
153
- -- | Delegates a staking key pair to an automatic DRep.
154
140
delegateToAutomaticDRep
155
141
:: (HasCallStack , MonadTest m , MonadIO m , H. MonadAssertion m , MonadCatch m )
156
142
=> H. ExecConfig -- ^ Specifies the CLI execution configuration.
@@ -161,13 +147,11 @@ delegateToAutomaticDRep
161
147
-> ShelleyBasedEra ConwayEra -- ^ The Shelley based era witness for ConwayEra
162
148
-> FilePath -- ^ Base directory path where generated files will be stored.
163
149
-> String -- ^ Name for the subfolder that will be created under 'work' folder.
164
- -> String -- ^ Additional command-line argument for the delegation .
150
+ -> AutomaticDRepFlag -- ^ Which type of automatic DRep to delegate to .
165
151
-> PaymentKeyInfo -- ^ Wallet that will pay for the transaction.
166
152
-> StakingKeyPair -- ^ Staking key pair used for delegation.
167
153
-> m ()
168
- delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath sbe work prefix
169
- flag payingWallet skeyPair@ (StakingKeyPair vKeyFile _sKeyFile) = do
170
-
154
+ delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath sbe work prefix flag payingWallet skeyPair@ (StakingKeyPair vKeyFile _sKeyFile) = do
171
155
let era = toCardanoEra sbe
172
156
cEra = AnyCardanoEra era
173
157
@@ -177,7 +161,9 @@ delegateToAutomaticDRep execConfig epochStateView configurationFile socketPath s
177
161
let voteDelegationCertificatePath = baseDir </> " delegation-certificate.delegcert"
178
162
void $ H. execCli' execConfig
179
163
[ " conway" , " stake-address" , " vote-delegation-certificate"
180
- , flag
164
+ , case flag of
165
+ AlwaysAbstainDRep -> " --always-abstain"
166
+ NoConfidenceDRep -> " --always-no-confidence"
181
167
, " --stake-verification-key-file" , vKeyFile
182
168
, " --out-file" , voteDelegationCertificatePath
183
169
]
0 commit comments