clean up; apply hlint suggestions; format

This commit is contained in:
fanghr 2022-04-23 18:46:38 +08:00
parent 15414aeda4
commit 01d3be029d
2 changed files with 12 additions and 12 deletions

View file

@ -371,8 +371,6 @@ governorValidator gov =
case redeemer of case redeemer of
PCreateProposal _ -> P.do PCreateProposal _ -> P.do
let expectedNextProposalId = pnextProposalId # oldParams.nextProposalId let expectedNextProposalId = pnextProposalId # oldParams.nextProposalId
expectedNewDatum :: Term _ PGovernorDatum
expectedNewDatum = expectedNewDatum =
pcon $ pcon $
PGovernorDatum $ PGovernorDatum $
@ -380,7 +378,7 @@ governorValidator gov =
#$ pdcons @"nextProposalId" # pdata expectedNextProposalId # pdnil #$ pdcons @"nextProposalId" # pdata expectedNextProposalId # pdnil
passert "Unexpected governor state datum" $ passert "Unexpected governor state datum" $
newDatumData #== (pforgetData $ pdata $ expectedNewDatum) newDatumData #== pforgetData (pdata expectedNewDatum)
passert "Exactly one proposal token must be minted" $ passert "Exactly one proposal token must be minted" $
hasOnlyOneTokenOfCurrencySymbol # pproposalSymbol # txInfo.mint hasOnlyOneTokenOfCurrencySymbol # pproposalSymbol # txInfo.mint
@ -520,8 +518,10 @@ governorValidator gov =
(pcon $ PJust pair) (pcon $ PJust pair)
) )
votesList = pto $ pto $ pfromData inputProposalDatum.votes
winner' = winner' =
pfoldr # highestVoteFolder # (pcon $ PNothing) #$ pto $ pto $ pfromData inputProposalDatum.votes pfoldr # highestVoteFolder # (pcon PNothing) # votesList
winner <- plet $ mustBePJust # "Empty votes" # winner' winner <- plet $ mustBePJust # "Empty votes" # winner'
@ -542,13 +542,13 @@ governorValidator gov =
outputsWithGAT <- outputsWithGAT <-
plet $ plet $
pfilter pfilter
# ( phoistAcyclic $ # phoistAcyclic
plam ( plam
( \((pfield @"value" #) -> value) -> ( \((pfield @"value" #) -> value) ->
0 #< psymbolValueOf # pgatSym # value 0 #< psymbolValueOf # pgatSym # value
) )
) )
#$ pfromData txInfo.outputs # pfromData txInfo.outputs
passert "Output GATs is more than minted GATs" $ passert "Output GATs is more than minted GATs" $
plength # outputsWithGAT #== gatCount plength # outputsWithGAT #== gatCount