add samples: proposalCreation, mutateState and mintGAT

This commit is contained in:
fanghr 2022-05-03 18:38:06 +08:00
parent 63c87667c3
commit c404cef850
5 changed files with 510 additions and 6 deletions

View file

@ -17,8 +17,9 @@ module Agora.Governor (
PGovernorDatum (..),
PGovernorRedeemer (..),
-- * Plutus Utilities
-- * Utilities
pgetNextProposalId,
getNextProposalId,
) where
--------------------------------------------------------------------------------
@ -32,7 +33,7 @@ import Generics.SOP (Generic, I (I))
import Agora.Proposal (
PProposalId (..),
PProposalThresholds,
ProposalId,
ProposalId (ProposalId),
ProposalThresholds,
)
import Agora.SafeMoney (GTTag)
@ -153,6 +154,10 @@ deriving via PAsData (PIsDataReprInstances PGovernorRedeemer) instance PTryFrom
--------------------------------------------------------------------------------
-- | Get next proposal id.
-- | Plutrach version of 'getNextProposalId'.
pgetNextProposalId :: Term s (PProposalId :--> PProposalId)
pgetNextProposalId = phoistAcyclic $ plam $ \(pto -> pid) -> pcon $ PProposalId $ pid + 1
-- | Get next proposal id.
getNextProposalId :: ProposalId -> ProposalId
getNextProposalId (ProposalId pid) = ProposalId $ pid + 1