fix compilation erros; format && lint

Co-authored-by: Emily Martins <emi@haskell.fyi>
This commit is contained in:
fanghr 2022-04-22 14:42:00 +08:00
parent a5c461700e
commit 54b58ad937
3 changed files with 9 additions and 9 deletions

View file

@ -87,8 +87,6 @@ import Plutarch.Api.V1 (
validatorHash, validatorHash,
) )
import Plutarch.Api.V1.Extra ( import Plutarch.Api.V1.Extra (
passetClass,
passetClassValueOf,
pownMintValue, pownMintValue,
) )
import Plutarch.DataRepr ( import Plutarch.DataRepr (
@ -220,7 +218,6 @@ governorPolicy gov =
ctx <- pletFields @'["txInfo", "purpose"] ctx' ctx <- pletFields @'["txInfo", "purpose"] ctx'
let oref = pconstant gov.gstORef let oref = pconstant gov.gstORef
ownSymbol = pownCurrencySymbol # ctx' ownSymbol = pownCurrencySymbol # ctx'
ownAssetClass = passetClass # ownSymbol # pconstant gov.gstName
mintValue <- plet $ pownMintValue # ctx' mintValue <- plet $ pownMintValue # ctx'
@ -228,7 +225,7 @@ governorPolicy gov =
passert "Exactly one token should be minted" $ passert "Exactly one token should be minted" $
psymbolValueOf # ownSymbol # mintValue #== 1 psymbolValueOf # ownSymbol # mintValue #== 1
#&& passetClassValueOf # ownSymbol # pconstant governorStateTokenName # mintValue #== 1 #&& passetClassValueOf # ownSymbol # pconstant gov.gstName # mintValue #== 1
popaque (pconstant ()) popaque (pconstant ())
@ -515,14 +512,14 @@ governorValidator gov =
stateTokenValueOf :: Term s (PValue :--> PInteger) stateTokenValueOf :: Term s (PValue :--> PInteger)
stateTokenValueOf = passetClassValueOf' stateTokenAssetClass stateTokenValueOf = passetClassValueOf' stateTokenAssetClass
gatSymbol :: CurrencySymbol gatSymbol :: CurrencySymbol
gatSymbol = mintingPolicySymbol policy gatSymbol = mintingPolicySymbol policy
where where
at = AuthorityToken $ gstAssetClass gov at = AuthorityToken $ gstAssetClass gov
policy = mkMintingPolicy $ authorityTokenPolicy at policy = mkMintingPolicy $ authorityTokenPolicy at
pgatSym :: Term s PCurrencySymbol pgatSym :: Term s PCurrencySymbol
pgatSym = phoistAcyclic $ pconstant $ gatSymbol pgatSym = phoistAcyclic $ pconstant gatSymbol
pyesResultTag :: Term s PResultTag pyesResultTag :: Term s PResultTag
pyesResultTag = phoistAcyclic $ pcon $ PResultTag $ pconstant 1 pyesResultTag = phoistAcyclic $ pcon $ PResultTag $ pconstant 1

View file

@ -178,10 +178,10 @@ emptyVotesFor = ProposalVotes . AssocMap.mapWithKey (const . const 0)
data ProposalDatum = ProposalDatum data ProposalDatum = ProposalDatum
{ proposalId :: ProposalId { proposalId :: ProposalId
-- ^ Identification of the proposal. -- ^ Identification of the proposal.
, -- TODO: could we encode this more efficiently? -- TODO: could we encode this more efficiently?
-- This is shaped this way for future proofing. -- This is shaped this way for future proofing.
-- See https://github.com/Liqwid-Labs/agora/issues/39 -- See https://github.com/Liqwid-Labs/agora/issues/39
effects :: AssocMap.Map ResultTag [(ValidatorHash, DatumHash)] , effects :: AssocMap.Map ResultTag [(ValidatorHash, DatumHash)]
-- ^ Effect lookup table. First by result, then by effect hash. -- ^ Effect lookup table. First by result, then by effect hash.
, status :: ProposalStatus , status :: ProposalStatus
-- ^ The status the proposal is in. -- ^ The status the proposal is in.

View file

@ -510,6 +510,7 @@ findTxOutDatum = phoistAcyclic $
PDJust ((pfield @"_0" #) -> datumHash) -> pfindDatum # datumHash # datums PDJust ((pfield @"_0" #) -> datumHash) -> pfindDatum # datumHash # datums
_ -> pcon PNothing _ -> pcon PNothing
<<<<<<< HEAD
{- | Safely convert a 'PValidatorHash' into a 'PTokenName'. This can be useful for tagging {- | Safely convert a 'PValidatorHash' into a 'PTokenName'. This can be useful for tagging
tokens for extra safety. tokens for extra safety.
-} -}
@ -524,6 +525,8 @@ pvalidatorHashToTokenName vh = pcon (PTokenName (pto vh))
getMintingPolicySymbol :: ClosedTerm PMintingPolicy -> CurrencySymbol getMintingPolicySymbol :: ClosedTerm PMintingPolicy -> CurrencySymbol
getMintingPolicySymbol v = mintingPolicySymbol $ mkMintingPolicy v getMintingPolicySymbol v = mintingPolicySymbol $ mkMintingPolicy v
=======
>>>>>>> 93fe9ca (fix compilation erros; format && lint)
hasOnlyOneTokenOfAssetClass' :: AssetClass -> Term s (PValue :--> PBool) hasOnlyOneTokenOfAssetClass' :: AssetClass -> Term s (PValue :--> PBool)
hasOnlyOneTokenOfAssetClass' ac@(AssetClass (as, _)) = phoistAcyclic $ hasOnlyOneTokenOfAssetClass' ac@(AssetClass (as, _)) = phoistAcyclic $
plam $ \vs -> P.do plam $ \vs -> P.do