get next proposal id from pnextProposalId
This commit is contained in:
parent
731e714fc3
commit
be16b80459
2 changed files with 11 additions and 5 deletions
|
|
@ -35,6 +35,7 @@ import Agora.Proposal (
|
||||||
PProposalThresholds,
|
PProposalThresholds,
|
||||||
ProposalId,
|
ProposalId,
|
||||||
ProposalThresholds,
|
ProposalThresholds,
|
||||||
|
pnextProposalId
|
||||||
)
|
)
|
||||||
import Agora.Utils (
|
import Agora.Utils (
|
||||||
allInputs,
|
allInputs,
|
||||||
|
|
@ -208,12 +209,9 @@ governorValidator params =
|
||||||
-- check that nothing is minted
|
-- check that nothing is minted
|
||||||
passert "Nothing should be minted" $ plength # mint' #== 0
|
passert "Nothing should be minted" $ plength # mint' #== 0
|
||||||
|
|
||||||
-- check proposal id +1
|
-- check that proposal is advanced
|
||||||
-- TODO: deriving a PNum instance for PProposalId
|
|
||||||
let oldPid = pto $ pfromData $ oldParams.nextProposalId
|
|
||||||
newPid = pto $ pfromData $ newParams.nextProposalId
|
|
||||||
passert "Proposal id should be advanced by 1" $
|
passert "Proposal id should be advanced by 1" $
|
||||||
oldPid + 1 #== newPid
|
pnextProposalId # oldParams.nextProposalId #== newParams.nextProposalId
|
||||||
|
|
||||||
-- TODO: waiting for impl of proposal
|
-- TODO: waiting for impl of proposal
|
||||||
ptraceError "Not implemented yet"
|
ptraceError "Not implemented yet"
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,9 @@ 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
|
||||||
|
|
@ -434,3 +437,8 @@ 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)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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