diff --git a/agora/Agora/Governor.hs b/agora/Agora/Governor.hs index 49bd9f0..4e24194 100644 --- a/agora/Agora/Governor.hs +++ b/agora/Agora/Governor.hs @@ -371,8 +371,6 @@ governorValidator gov = case redeemer of PCreateProposal _ -> P.do let expectedNextProposalId = pnextProposalId # oldParams.nextProposalId - - expectedNewDatum :: Term _ PGovernorDatum expectedNewDatum = pcon $ PGovernorDatum $ @@ -380,7 +378,7 @@ governorValidator gov = #$ pdcons @"nextProposalId" # pdata expectedNextProposalId # pdnil passert "Unexpected governor state datum" $ - newDatumData #== (pforgetData $ pdata $ expectedNewDatum) + newDatumData #== pforgetData (pdata expectedNewDatum) passert "Exactly one proposal token must be minted" $ hasOnlyOneTokenOfCurrencySymbol # pproposalSymbol # txInfo.mint @@ -520,8 +518,10 @@ governorValidator gov = (pcon $ PJust pair) ) + votesList = pto $ pto $ pfromData inputProposalDatum.votes + winner' = - pfoldr # highestVoteFolder # (pcon $ PNothing) #$ pto $ pto $ pfromData inputProposalDatum.votes + pfoldr # highestVoteFolder # (pcon PNothing) # votesList winner <- plet $ mustBePJust # "Empty votes" # winner' @@ -542,13 +542,13 @@ governorValidator gov = outputsWithGAT <- plet $ pfilter - # ( phoistAcyclic $ - plam - ( \((pfield @"value" #) -> value) -> - 0 #< psymbolValueOf # pgatSym # value - ) + # phoistAcyclic + ( plam + ( \((pfield @"value" #) -> value) -> + 0 #< psymbolValueOf # pgatSym # value + ) ) - #$ pfromData txInfo.outputs + # pfromData txInfo.outputs passert "Output GATs is more than minted GATs" $ plength # outputsWithGAT #== gatCount diff --git a/agora/Agora/Utils.hs b/agora/Agora/Utils.hs index 9eb0945..fddd440 100644 --- a/agora/Agora/Utils.hs +++ b/agora/Agora/Utils.hs @@ -555,7 +555,7 @@ mustFindDatum' = phoistAcyclic $ PJust dt <- pmatch $ pfindDatum # dh # info pfromData $ punsafeCoerce dt -{- | Extract the value stored in a PMaybe container. +{- | Extract the value stored in a PMaybe container. If there's no value, throw an error with the given message. -} mustBePJust :: forall a s. Term s (PString :--> PMaybe a :--> a) @@ -564,7 +564,7 @@ mustBePJust = phoistAcyclic $ PJust v -> v _ -> ptraceError emsg -{- | Extract the value stored in a PMaybeData container. +{- | Extract the value stored in a PMaybeData container. If there's no value, throw an error with the given message. -} mustBePDJust :: forall a s. (PIsData a) => Term s (PString :--> PMaybeData a :--> a)