move pgetNextProposalId from Proposal module to Governor module
This commit is contained in:
parent
62c359aac3
commit
8630b7190d
2 changed files with 7 additions and 12 deletions
|
|
@ -27,6 +27,7 @@ module Agora.Governor (
|
||||||
-- * Utilities
|
-- * Utilities
|
||||||
gstAssetClass,
|
gstAssetClass,
|
||||||
gatSymbol,
|
gatSymbol,
|
||||||
|
pgetNextProposalId
|
||||||
) where
|
) where
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
@ -44,7 +45,7 @@ import Agora.AuthorityToken (
|
||||||
)
|
)
|
||||||
import Agora.Proposal (
|
import Agora.Proposal (
|
||||||
PProposalDatum (..),
|
PProposalDatum (..),
|
||||||
PProposalId,
|
PProposalId(..),
|
||||||
PProposalStatus (PFinished),
|
PProposalStatus (PFinished),
|
||||||
PProposalThresholds,
|
PProposalThresholds,
|
||||||
PResultTag,
|
PResultTag,
|
||||||
|
|
@ -52,7 +53,6 @@ import Agora.Proposal (
|
||||||
ProposalId,
|
ProposalId,
|
||||||
ProposalStatus (Draft, Locked),
|
ProposalStatus (Draft, Locked),
|
||||||
ProposalThresholds,
|
ProposalThresholds,
|
||||||
pnextProposalId,
|
|
||||||
proposalDatumValid,
|
proposalDatumValid,
|
||||||
proposalPolicy,
|
proposalPolicy,
|
||||||
proposalValidator,
|
proposalValidator,
|
||||||
|
|
@ -392,7 +392,7 @@ governorValidator gov =
|
||||||
|
|
||||||
case redeemer of
|
case redeemer of
|
||||||
PCreateProposal _ -> P.do
|
PCreateProposal _ -> P.do
|
||||||
let expectedNextProposalId = pnextProposalId # oldParams.nextProposalId
|
let expectedNextProposalId = pgetNextProposalId # oldParams.nextProposalId
|
||||||
expectedNewDatum =
|
expectedNewDatum =
|
||||||
pcon $
|
pcon $
|
||||||
PGovernorDatum $
|
PGovernorDatum $
|
||||||
|
|
@ -789,3 +789,7 @@ gatSymbol gov = mintingPolicySymbol policy
|
||||||
where
|
where
|
||||||
at = AuthorityToken $ gstAssetClass gov
|
at = AuthorityToken $ gstAssetClass gov
|
||||||
policy = mkMintingPolicy $ authorityTokenPolicy at
|
policy = mkMintingPolicy $ authorityTokenPolicy at
|
||||||
|
|
||||||
|
-- | Get next proposal id.
|
||||||
|
pgetNextProposalId :: Term s (PProposalId :--> PProposalId)
|
||||||
|
pgetNextProposalId = phoistAcyclic $ plam $ \(pto -> pid) -> pcon $ PProposalId $ pid + 1
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,6 @@ module Agora.Proposal (
|
||||||
|
|
||||||
-- * Plutarch helpers
|
-- * Plutarch helpers
|
||||||
proposalDatumValid,
|
proposalDatumValid,
|
||||||
|
|
||||||
-- * Utils
|
|
||||||
pnextProposalId,
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import GHC.Generics qualified as GHC
|
import GHC.Generics qualified as GHC
|
||||||
|
|
@ -437,9 +434,3 @@ proposalDatumValid proposal =
|
||||||
, ptraceIfFalse "Proposal has fewer cosigners than the limit" $ plength # (pfromData datum.cosigners) #<= pconstant proposal.maximumCosigners
|
, ptraceIfFalse "Proposal has fewer cosigners than the limit" $ plength # (pfromData datum.cosigners) #<= pconstant proposal.maximumCosigners
|
||||||
, ptraceIfFalse "Proposal votes and effects are compatible with each other" $ pkeysEqual # datum.effects # pto (pfromData datum.votes)
|
, ptraceIfFalse "Proposal votes and effects are compatible with each other" $ pkeysEqual # datum.effects # pto (pfromData datum.votes)
|
||||||
]
|
]
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- | Get next proposal id.
|
|
||||||
pnextProposalId :: Term s (PProposalId :--> PProposalId)
|
|
||||||
pnextProposalId = phoistAcyclic $ plam $ \(pto -> pid) -> pcon $ PProposalId $ pid + 1
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue