add all agora types

This commit is contained in:
fanghr 2022-05-13 20:03:17 +08:00
parent 9a26439397
commit 538e809d2c
No known key found for this signature in database
GPG key ID: 35CD9A71CD5D5870
8 changed files with 145 additions and 7 deletions

View file

@ -11,6 +11,8 @@ module Agora.AuthorityToken (
AuthorityToken (..),
) where
--------------------------------------------------------------------------------
import Plutarch.Api.V1 (
PAddress (..),
PCredential (..),
@ -25,8 +27,11 @@ import Plutarch.Api.V1.AssocMap (PMap (PMap))
import Plutarch.Api.V1.Value (PValue (PValue))
import Plutarch.Builtin (pforgetData)
import Plutus.V1.Ledger.Value (AssetClass (AssetClass))
import Plutarch.Api.V1.Extra (passetClass, passetClassValueOf)
import Prelude
--------------------------------------------------------------------------------
import GHC.Generics qualified as GHC
--------------------------------------------------------------------------------
@ -38,7 +43,6 @@ import Agora.Utils (
tcassert,
tcmatch,
)
import Plutarch.Api.V1.Extra (passetClass, passetClassValueOf)
--------------------------------------------------------------------------------
@ -51,7 +55,7 @@ import Plutarch.Api.V1.Extra (passetClass, passetClassValueOf)
newtype AuthorityToken = AuthorityToken
{ authority :: AssetClass
-- ^ Token that must move in order for minting this to be valid.
}
} deriving stock (GHC.Generic)
--------------------------------------------------------------------------------

View file

@ -21,6 +21,7 @@ module Agora.Governor (
) where
import Agora.Proposal (ProposalId, ProposalThresholds)
import GHC.Generics qualified as GHC
import Plutarch.Api.V1 (PMintingPolicy, PValidator)
import PlutusTx qualified
@ -31,6 +32,7 @@ data GovernorDatum = GovernorDatum
, nextProposalId :: ProposalId
-- ^ What tag the next proposal will get upon creating.
}
deriving stock (GHC.Generic)
PlutusTx.makeIsDataIndexed ''GovernorDatum [('GovernorDatum, 0)]
@ -46,12 +48,14 @@ data GovernorRedeemer
| -- | Checks that a SINGLE proposal finished correctly,
-- and allows minting GATs for each effect script.
MintGATs
deriving stock (GHC.Generic)
PlutusTx.makeIsDataIndexed ''GovernorRedeemer [('CreateProposal, 0), ('MintGATs, 1)]
-- | Parameters for creating Governor scripts.
data Governor
= Governor
deriving stock (GHC.Generic)
--------------------------------------------------------------------------------

View file

@ -82,7 +82,7 @@ newtype ProposalId = ProposalId {proposalTag :: Integer}
@
-}
newtype ResultTag = ResultTag {getResultTag :: Integer}
deriving stock (Eq, Show, Ord)
deriving stock (Eq, Show, Ord, GHC.Generic)
deriving newtype (PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
{- | The "status" of the proposal. This is only useful for state transitions that
@ -247,7 +247,7 @@ data Proposal = Proposal
, maximumCosigners :: Integer
-- ^ Arbitrary limit for maximum amount of cosigners on a proposal.
}
deriving stock (Show, Eq)
deriving stock (Show, Eq, GHC.Generic)
--------------------------------------------------------------------------------
-- Plutarch-land

View file

@ -81,7 +81,7 @@ data Stake = Stake
{ gtClassRef :: Tagged GTTag AssetClass
-- ^ Used when inlining the AssetClass of a 'PDiscrete' in the script code.
, proposalSTClass :: AssetClass
}
} deriving stock (GHC.Generic)
{- | A lock placed on a Stake datum in order to prevent
depositing and withdrawing when votes are in place.