move pgetNextProposalId from Proposal module to Governor module
This commit is contained in:
parent
c1976b86fc
commit
c3a10f8bbd
2 changed files with 7 additions and 12 deletions
|
|
@ -27,6 +27,7 @@ module Agora.Governor (
|
|||
-- * Utilities
|
||||
gstAssetClass,
|
||||
gatSymbol,
|
||||
pgetNextProposalId
|
||||
) where
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
@ -44,7 +45,7 @@ import Agora.AuthorityToken (
|
|||
)
|
||||
import Agora.Proposal (
|
||||
PProposalDatum (..),
|
||||
PProposalId,
|
||||
PProposalId(..),
|
||||
PProposalStatus (PFinished),
|
||||
PProposalThresholds,
|
||||
PResultTag,
|
||||
|
|
@ -52,7 +53,6 @@ import Agora.Proposal (
|
|||
ProposalId,
|
||||
ProposalStatus (Draft, Locked),
|
||||
ProposalThresholds,
|
||||
pnextProposalId,
|
||||
proposalDatumValid,
|
||||
proposalPolicy,
|
||||
proposalValidator,
|
||||
|
|
@ -392,7 +392,7 @@ governorValidator gov =
|
|||
|
||||
case redeemer of
|
||||
PCreateProposal _ -> P.do
|
||||
let expectedNextProposalId = pnextProposalId # oldParams.nextProposalId
|
||||
let expectedNextProposalId = pgetNextProposalId # oldParams.nextProposalId
|
||||
expectedNewDatum =
|
||||
pcon $
|
||||
PGovernorDatum $
|
||||
|
|
@ -789,3 +789,7 @@ gatSymbol gov = mintingPolicySymbol policy
|
|||
where
|
||||
at = AuthorityToken $ gstAssetClass gov
|
||||
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
|
||||
proposalDatumValid,
|
||||
|
||||
-- * Utils
|
||||
pnextProposalId,
|
||||
) where
|
||||
|
||||
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 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