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

View file

@ -555,7 +555,7 @@ mustFindDatum' = phoistAcyclic $
PJust dt <- pmatch $ pfindDatum # dh # info PJust dt <- pmatch $ pfindDatum # dh # info
pfromData $ punsafeCoerce dt 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. If there's no value, throw an error with the given message.
-} -}
mustBePJust :: forall a s. Term s (PString :--> PMaybe a :--> a) mustBePJust :: forall a s. Term s (PString :--> PMaybe a :--> a)
@ -564,7 +564,7 @@ mustBePJust = phoistAcyclic $
PJust v -> v PJust v -> v
_ -> ptraceError emsg _ -> 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. If there's no value, throw an error with the given message.
-} -}
mustBePDJust :: forall a s. (PIsData a) => Term s (PString :--> PMaybeData a :--> a) mustBePDJust :: forall a s. (PIsData a) => Term s (PString :--> PMaybeData a :--> a)