get next proposal id from pnextProposalId
This commit is contained in:
parent
4b5875923c
commit
4c770abce6
2 changed files with 11 additions and 5 deletions
|
|
@ -35,6 +35,7 @@ import Agora.Proposal (
|
|||
PProposalThresholds,
|
||||
ProposalId,
|
||||
ProposalThresholds,
|
||||
pnextProposalId
|
||||
)
|
||||
import Agora.Utils (
|
||||
allInputs,
|
||||
|
|
@ -208,12 +209,9 @@ governorValidator params =
|
|||
-- check that nothing is minted
|
||||
passert "Nothing should be minted" $ plength # mint' #== 0
|
||||
|
||||
-- check proposal id +1
|
||||
-- TODO: deriving a PNum instance for PProposalId
|
||||
let oldPid = pto $ pfromData $ oldParams.nextProposalId
|
||||
newPid = pto $ pfromData $ newParams.nextProposalId
|
||||
-- check that proposal is advanced
|
||||
passert "Proposal id should be advanced by 1" $
|
||||
oldPid + 1 #== newPid
|
||||
pnextProposalId # oldParams.nextProposalId #== newParams.nextProposalId
|
||||
|
||||
-- TODO: waiting for impl of proposal
|
||||
ptraceError "Not implemented yet"
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ module Agora.Proposal (
|
|||
|
||||
-- * Plutarch helpers
|
||||
proposalDatumValid,
|
||||
|
||||
-- * Utils
|
||||
pnextProposalId
|
||||
) where
|
||||
|
||||
import GHC.Generics qualified as GHC
|
||||
|
|
@ -434,3 +437,8 @@ 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)
|
||||
]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
pnextProposalId :: Term s (PProposalId :--> PProposalId)
|
||||
pnextProposalId = phoistAcyclic $ plam $ \(pto -> id) -> pcon $ PProposalId $ id + 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue