export PGovernorRedeemer
This commit is contained in:
parent
c432a06d5e
commit
b546fc9701
1 changed files with 28 additions and 26 deletions
|
|
@ -15,6 +15,7 @@ module Agora.Governor (
|
||||||
|
|
||||||
-- * Plutarch-land
|
-- * Plutarch-land
|
||||||
PGovernorDatum (..),
|
PGovernorDatum (..),
|
||||||
|
PGovernorRedeemer (..),
|
||||||
|
|
||||||
-- * Scripts
|
-- * Scripts
|
||||||
governorPolicy,
|
governorPolicy,
|
||||||
|
|
@ -28,7 +29,7 @@ import Generics.SOP (Generic, I (I))
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
import Agora.Proposal (ProposalId, ProposalThresholds, PProposalThresholds, PProposalId)
|
import Agora.Proposal (PProposalId, PProposalThresholds, ProposalId, ProposalThresholds)
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -71,34 +72,36 @@ data GovernorRedeemer
|
||||||
| -- | Checks that a SINGLE proposal finished correctly,
|
| -- | Checks that a SINGLE proposal finished correctly,
|
||||||
-- and allows minting GATs for each effect script.
|
-- and allows minting GATs for each effect script.
|
||||||
MintGATs
|
MintGATs
|
||||||
-- | Allow effects to mutate the datum
|
| -- | Allow effects to mutate the datum
|
||||||
| MutateDatum
|
MutateDatum
|
||||||
deriving stock (Show, GHC.Generic)
|
deriving stock (Show, GHC.Generic)
|
||||||
|
|
||||||
PlutusTx.makeIsDataIndexed
|
PlutusTx.makeIsDataIndexed
|
||||||
''GovernorRedeemer
|
''GovernorRedeemer
|
||||||
[('CreateProposal,0)
|
[ ('CreateProposal, 0)
|
||||||
,('MintGATs, 1)
|
, ('MintGATs, 1)
|
||||||
,('MutateDatum, 2)
|
, ('MutateDatum, 2)
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | Parameters for creating Governor scripts.
|
-- | Parameters for creating Governor scripts.
|
||||||
data Governor
|
data Governor = Governor
|
||||||
= Governor {
|
{ datumNFT :: AssetClass
|
||||||
-- | NFT that identifies the governor datum
|
-- ^ NFT that identifies the governor datum
|
||||||
datumNFT :: AssetClass
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- | Plutarch-level datum for the Governor script.
|
-- | Plutarch-level datum for the Governor script.
|
||||||
|
newtype PGovernorDatum (s :: S) = PGovernorDatum
|
||||||
newtype PGovernorDatum (s::S)= PGovernorDatum { getGovernorDatum ::
|
{ getGovernorDatum ::
|
||||||
Term s (PDataRecord '[
|
Term
|
||||||
"proposalThresholds" ':= PProposalThresholds,
|
s
|
||||||
"nextProposalId" ':= PProposalId
|
( PDataRecord
|
||||||
])
|
'[ "proposalThresholds" ':= PProposalThresholds
|
||||||
}
|
, "nextProposalId" ':= PProposalId
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
deriving stock (GHC.Generic)
|
deriving stock (GHC.Generic)
|
||||||
deriving anyclass (Generic)
|
deriving anyclass (Generic)
|
||||||
deriving anyclass (PIsDataRepr)
|
deriving anyclass (PIsDataRepr)
|
||||||
|
|
@ -110,9 +113,8 @@ instance PUnsafeLiftDecl PGovernorDatum where type PLifted PGovernorDatum = Gove
|
||||||
deriving via (DerivePConstantViaData GovernorDatum PGovernorDatum) instance (PConstant GovernorDatum)
|
deriving via (DerivePConstantViaData GovernorDatum PGovernorDatum) instance (PConstant GovernorDatum)
|
||||||
|
|
||||||
-- | Plutarch-level version of 'GovernorRedeemer'
|
-- | Plutarch-level version of 'GovernorRedeemer'
|
||||||
|
data PGovernorRedeemer (s :: S)
|
||||||
data PGovernorRedeemer (s :: S) =
|
= PCreateProposal (Term s (PDataRecord '[]))
|
||||||
PCreateProposal (Term s (PDataRecord '[]))
|
|
||||||
| PMintGATs (Term s (PDataRecord '[]))
|
| PMintGATs (Term s (PDataRecord '[]))
|
||||||
| PMutateDatum (Term s (PDataRecord '[]))
|
| PMutateDatum (Term s (PDataRecord '[]))
|
||||||
deriving stock (GHC.Generic)
|
deriving stock (GHC.Generic)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue