Skip to content

Commit

Permalink
TODO: Move me before previous commit
Browse files Browse the repository at this point in the history
Implement parser for proposing or voting reference script witnesses
  • Loading branch information
Jimbo4350 committed Jul 24, 2024
1 parent aec20dd commit 601d88f
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,23 @@ pWithdrawal balance =
parseWithdrawal =
(,) <$> parseStakeAddress <* Parsec.char '+' <*> parseLovelace

pPlutusStakeReferenceScriptWitnessFilesVotingProposing
:: String
-> BalanceTxExecUnits
-- ^ Use the @execution-units@ flag.
-> Parser (ScriptWitnessFiles WitCtxStake)
pPlutusStakeReferenceScriptWitnessFilesVotingProposing prefix autoBalanceExecUnits =
PlutusReferenceScriptWitnessFiles
<$> pReferenceTxIn prefix "plutus"
<*> plutusP prefix PlutusScriptV3 "v3"
<*> pure NoScriptDatumOrFileForStake
<*> pScriptRedeemerOrFile (prefix ++ "reference-tx-in")
<*> ( case autoBalanceExecUnits of
AutoBalance -> pure (ExecutionUnits 0 0)
ManualBalance -> pExecutionUnits $ prefix ++ "reference-tx-in"
)
<*> pure Nothing

pPlutusStakeReferenceScriptWitnessFiles
:: String
-> BalanceTxExecUnits
Expand All @@ -1738,15 +1755,15 @@ pPlutusStakeReferenceScriptWitnessFiles prefix autoBalanceExecUnits =
<*> pure Nothing

pPlutusScriptLanguage :: String -> Parser AnyScriptLanguage
pPlutusScriptLanguage prefix = plutusP PlutusScriptV2 "v2" <|> plutusP PlutusScriptV3 "v3"
where
plutusP :: PlutusScriptVersion lang -> String -> Parser AnyScriptLanguage
plutusP plutusVersion versionString =
Opt.flag'
(AnyScriptLanguage $ PlutusScriptLanguage plutusVersion)
( Opt.long (prefix <> "plutus-script-" <> versionString)
<> Opt.help ("Specify a plutus script " <> versionString <> " reference script.")
)
pPlutusScriptLanguage prefix = plutusP prefix PlutusScriptV2 "v2" <|> plutusP prefix PlutusScriptV3 "v3"

plutusP :: String -> PlutusScriptVersion lang -> String -> Parser AnyScriptLanguage
plutusP prefix plutusVersion versionString =
Opt.flag'
(AnyScriptLanguage $ PlutusScriptLanguage plutusVersion)
( Opt.long (prefix <> "plutus-script-" <> versionString)
<> Opt.help ("Specify a plutus script " <> versionString <> " reference script.")
)

pUpdateProposalFile :: Parser UpdateProposalFile
pUpdateProposalFile =
Expand Down

0 comments on commit 601d88f

Please sign in to comment.