From 8da0a1b0160395cc3416da6564186a00ea1459dd Mon Sep 17 00:00:00 2001 From: fanghr Date: Thu, 21 Apr 2022 22:08:37 +0800 Subject: [PATCH] ensure the proposal is in executable state while minting GATs --- agora/Agora/Governor.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/agora/Agora/Governor.hs b/agora/Agora/Governor.hs index e60b3c7..52db026 100644 --- a/agora/Agora/Governor.hs +++ b/agora/Agora/Governor.hs @@ -43,7 +43,7 @@ import Agora.AuthorityToken ( import Agora.Proposal ( PProposalDatum, PProposalId, - PProposalStatus (PFinished, PLocked), + PProposalStatus (PFinished, PExecutable), PProposalThresholds, PProposalVotes (PProposalVotes), PResultTag (PResultTag), @@ -409,11 +409,11 @@ governorValidator params = pletFields @'["id", "effects", "status", "cosigners", "thresholds", "votes"] inputProposalDatum' - let isInputLocked = pmatch (pfromData inputProposalDatum.status) $ \case - PLocked _ -> pconstant False + let isExecutable = pmatch (pfromData inputProposalDatum.status) $ \case + PExecutable _ -> pconstant True _ -> pconstant False - passert "Proposal must be in locked state in order to execute effects" $ isInputLocked + passert "Proposal must be in executable state in order to execute effects" $ isExecutable let fields = pdcons @"id" # inputProposalDatum.id @@ -439,7 +439,8 @@ governorValidator params = noVotes = plookup' # pnoResultTag # votes biggerVotes = pif (yesVotes #< noVotes) noVotes yesVotes - passert "Number of votes doesn't meet the minimum requirement" $ minimumVotes #< biggerVotes + passert "Number of votes doesn't meet the minimum requirement" $ + minimumVotes #< biggerVotes let finalResultTag = pif (yesVotes #< noVotes) pnoResultTag pyesResultTag