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 3ba0abb179
commit 1e965a7363
No known key found for this signature in database
GPG key ID: 35CD9A71CD5D5870
3 changed files with 9 additions and 9 deletions

View file

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

View file

@ -178,10 +178,10 @@ emptyVotesFor = ProposalVotes . AssocMap.mapWithKey (const . const 0)
data ProposalDatum = ProposalDatum
{ proposalId :: ProposalId
-- ^ 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.
-- 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.
, status :: ProposalStatus
-- ^ The status the proposal is in.

View file

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