fix docs, hlint errors
This commit is contained in:
parent
234c277ee4
commit
449dd3f87e
9 changed files with 24 additions and 17 deletions
|
|
@ -11,7 +11,7 @@ import Test.Tasty (defaultMain, testGroup)
|
||||||
import Spec.Model.MultiSig qualified as MultiSig
|
import Spec.Model.MultiSig qualified as MultiSig
|
||||||
import Spec.Stake qualified as Stake
|
import Spec.Stake qualified as Stake
|
||||||
|
|
||||||
-- | The Agora test suite
|
-- | The Agora test suite.
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main =
|
main =
|
||||||
defaultMain $
|
defaultMain $
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ instance HasScriptRunner MultiSigProp MultiSigModel where
|
||||||
(pcon PUnit)
|
(pcon PUnit)
|
||||||
perror
|
perror
|
||||||
|
|
||||||
-- | Consistency tests for the 'HasParameterisedGenerator' instance of 'MultiSigModel'
|
-- | Consistency tests for the 'HasParameterisedGenerator' instance of 'MultiSigModel'.
|
||||||
genTests :: TestTree
|
genTests :: TestTree
|
||||||
genTests =
|
genTests =
|
||||||
testGroup "genTests" $
|
testGroup "genTests" $
|
||||||
|
|
@ -182,7 +182,7 @@ genTests =
|
||||||
Yes
|
Yes
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | Tests for the 'HasScriptRunner' instance of 'MultiSigModel'
|
-- | Tests for the 'HasScriptRunner' instance of 'MultiSigModel'.
|
||||||
plutarchTests :: TestTree
|
plutarchTests :: TestTree
|
||||||
plutarchTests =
|
plutarchTests =
|
||||||
testGroup "plutarchTests" $
|
testGroup "plutarchTests" $
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import Spec.Util (policyFailsWith, policySucceedsWith, toDatum, validatorFailsWi
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- | Stake tests
|
-- | Stake tests.
|
||||||
tests :: [TestTree]
|
tests :: [TestTree]
|
||||||
tests =
|
tests =
|
||||||
[ testGroup
|
[ testGroup
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import Plutarch.Monadic qualified as P
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- | Helper 'template' for creating effect validator.
|
-- | Helper "template" for creating effect validator.
|
||||||
makeEffect ::
|
makeEffect ::
|
||||||
forall (datum :: PType) (s :: S).
|
forall (datum :: PType) (s :: S).
|
||||||
PIsData datum =>
|
PIsData datum =>
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,10 @@ module Agora.Governor (GovernorDatum (..), GovernorRedeemer (..)) where
|
||||||
|
|
||||||
import Agora.Proposal (ProposalThresholds)
|
import Agora.Proposal (ProposalThresholds)
|
||||||
|
|
||||||
data GovernorDatum = GovernorDatum
|
-- | Datum for the Governor script.
|
||||||
|
newtype GovernorDatum = GovernorDatum
|
||||||
{ proposalThresholds :: ProposalThresholds
|
{ proposalThresholds :: ProposalThresholds
|
||||||
-- ^ Gets copied over upon creation of a 'Proposal'.
|
-- ^ Gets copied over upon creation of a 'Agora.Proposal.ProposalDatum'.
|
||||||
}
|
}
|
||||||
|
|
||||||
{- | Redeemer for Governor script.
|
{- | Redeemer for Governor script.
|
||||||
|
|
|
||||||
|
|
@ -77,13 +77,13 @@ deriving via (DerivePConstantViaData MultiSig PMultiSig) instance (PConstant Mul
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- | Check if a Haskell-level MultiSig signs this transaction
|
-- | Check if a Haskell-level MultiSig signs this transaction.
|
||||||
validatedByMultisig :: MultiSig -> Term s (PTxInfo :--> PBool)
|
validatedByMultisig :: MultiSig -> Term s (PTxInfo :--> PBool)
|
||||||
validatedByMultisig params =
|
validatedByMultisig params =
|
||||||
phoistAcyclic $
|
phoistAcyclic $
|
||||||
pvalidatedByMultisig # pconstant params
|
pvalidatedByMultisig # pconstant params
|
||||||
|
|
||||||
-- | Check if a Plutarch-level MultiSig signs this transaction
|
-- | Check if a Plutarch-level MultiSig signs this transaction.
|
||||||
pvalidatedByMultisig :: Term s (PMultiSig :--> PTxInfo :--> PBool)
|
pvalidatedByMultisig :: Term s (PMultiSig :--> PTxInfo :--> PBool)
|
||||||
pvalidatedByMultisig =
|
pvalidatedByMultisig =
|
||||||
phoistAcyclic $
|
phoistAcyclic $
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ Proposal scripts encoding effects that operate on the system.
|
||||||
-}
|
-}
|
||||||
module Agora.Proposal (
|
module Agora.Proposal (
|
||||||
-- * Haskell-land
|
-- * Haskell-land
|
||||||
|
Proposal (..),
|
||||||
ProposalDatum (..),
|
ProposalDatum (..),
|
||||||
ProposalStatus (..),
|
ProposalStatus (..),
|
||||||
ProposalThresholds (..),
|
ProposalThresholds (..),
|
||||||
|
|
@ -50,6 +51,7 @@ import Agora.SafeMoney (Discrete, GTTag, PDiscrete)
|
||||||
@
|
@
|
||||||
-}
|
-}
|
||||||
newtype ResultTag = ResultTag {getResultTag :: Integer}
|
newtype ResultTag = ResultTag {getResultTag :: Integer}
|
||||||
|
deriving stock (Eq, Show)
|
||||||
deriving newtype (PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
|
deriving newtype (PlutusTx.ToData, PlutusTx.FromData, PlutusTx.UnsafeFromData)
|
||||||
|
|
||||||
{- | The "status" of the proposal. This is only useful for state transitions,
|
{- | The "status" of the proposal. This is only useful for state transitions,
|
||||||
|
|
@ -102,7 +104,7 @@ data ProposalThresholds = ProposalThresholds
|
||||||
PlutusTx.makeIsDataIndexed ''ProposalThresholds [('ProposalThresholds, 0)]
|
PlutusTx.makeIsDataIndexed ''ProposalThresholds [('ProposalThresholds, 0)]
|
||||||
|
|
||||||
{- | Map which encodes the total tally for each result.
|
{- | Map which encodes the total tally for each result.
|
||||||
It's important that the 'shape' is consistent with the shape of 'effects'.
|
It's important that the "shape" is consistent with the shape of 'effects'.
|
||||||
|
|
||||||
e.g. if the 'effects' field looks like the following:
|
e.g. if the 'effects' field looks like the following:
|
||||||
|
|
||||||
|
|
@ -136,6 +138,9 @@ data ProposalDatum = ProposalDatum
|
||||||
|
|
||||||
PlutusTx.makeIsDataIndexed ''ProposalDatum [('ProposalDatum, 0)]
|
PlutusTx.makeIsDataIndexed ''ProposalDatum [('ProposalDatum, 0)]
|
||||||
|
|
||||||
|
-- | Parameters that identify the Proposal validator script.
|
||||||
|
data Proposal = Proposal
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Plutarch-land
|
-- Plutarch-land
|
||||||
|
|
||||||
|
|
@ -158,7 +163,7 @@ data PProposalStatus (s :: S)
|
||||||
via PIsDataReprInstances PProposalStatus
|
via PIsDataReprInstances PProposalStatus
|
||||||
|
|
||||||
-- | Plutarch-level version of 'ProposalThresholds'.
|
-- | Plutarch-level version of 'ProposalThresholds'.
|
||||||
data PProposalThresholds (s :: S) = PProposalThresholds
|
newtype PProposalThresholds (s :: S) = PProposalThresholds
|
||||||
{ getProposalThresholds ::
|
{ getProposalThresholds ::
|
||||||
Term
|
Term
|
||||||
s
|
s
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,10 @@ import Agora.Utils (
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Example tags
|
-- Example tags
|
||||||
|
|
||||||
-- | Governance token
|
-- | Governance token.
|
||||||
data GTTag
|
data GTTag
|
||||||
|
|
||||||
-- | ADA
|
-- | ADA.
|
||||||
data ADATag
|
data ADATag
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
@ -136,6 +136,7 @@ pdiscreteValue (AssetClassRef (AssetClass (cs, tn))) = phoistAcyclic $
|
||||||
# pconstant tn
|
# pconstant tn
|
||||||
# p
|
# p
|
||||||
|
|
||||||
|
-- | Get a `Value` from a `Discrete`.
|
||||||
discreteValue ::
|
discreteValue ::
|
||||||
forall (tag :: Type).
|
forall (tag :: Type).
|
||||||
AssetClassRef tag ->
|
AssetClassRef tag ->
|
||||||
|
|
|
||||||
|
|
@ -183,21 +183,21 @@ passetClassValueOf' :: AssetClass -> Term s (PValue :--> PInteger)
|
||||||
passetClassValueOf' (AssetClass (sym, token)) =
|
passetClassValueOf' (AssetClass (sym, token)) =
|
||||||
passetClassValueOf # pconstant sym # pconstant token
|
passetClassValueOf # pconstant sym # pconstant token
|
||||||
|
|
||||||
-- | Return '>=' on two values comparing by only a particular AssetClass
|
-- | Return '>=' on two values comparing by only a particular AssetClass.
|
||||||
pgeqByClass :: Term s (PCurrencySymbol :--> PTokenName :--> PValue :--> PValue :--> PBool)
|
pgeqByClass :: Term s (PCurrencySymbol :--> PTokenName :--> PValue :--> PValue :--> PBool)
|
||||||
pgeqByClass =
|
pgeqByClass =
|
||||||
phoistAcyclic $
|
phoistAcyclic $
|
||||||
plam $ \cs tn a b ->
|
plam $ \cs tn a b ->
|
||||||
passetClassValueOf # cs # tn # b #<= passetClassValueOf # cs # tn # a
|
passetClassValueOf # cs # tn # b #<= passetClassValueOf # cs # tn # a
|
||||||
|
|
||||||
-- | Return '>=' on two values comparing by only a particular CurrencySymbol
|
-- | Return '>=' on two values comparing by only a particular CurrencySymbol.
|
||||||
pgeqBySymbol :: Term s (PCurrencySymbol :--> PValue :--> PValue :--> PBool)
|
pgeqBySymbol :: Term s (PCurrencySymbol :--> PValue :--> PValue :--> PBool)
|
||||||
pgeqBySymbol =
|
pgeqBySymbol =
|
||||||
phoistAcyclic $
|
phoistAcyclic $
|
||||||
plam $ \cs a b ->
|
plam $ \cs a b ->
|
||||||
psymbolValueOf # cs # b #<= psymbolValueOf # cs # a
|
psymbolValueOf # cs # b #<= psymbolValueOf # cs # a
|
||||||
|
|
||||||
-- | Return '>=' on two values comparing by only a particular Haskell-level AssetClass
|
-- | Return '>=' on two values comparing by only a particular Haskell-level AssetClass.
|
||||||
pgeqByClass' :: AssetClass -> Term s (PValue :--> PValue :--> PBool)
|
pgeqByClass' :: AssetClass -> Term s (PValue :--> PValue :--> PBool)
|
||||||
pgeqByClass' ac =
|
pgeqByClass' ac =
|
||||||
phoistAcyclic $
|
phoistAcyclic $
|
||||||
|
|
@ -233,7 +233,7 @@ pmapUnionWith = phoistAcyclic $
|
||||||
# ys
|
# ys
|
||||||
pcon (PMap $ pconcat # ls # rs)
|
pcon (PMap $ pconcat # ls # rs)
|
||||||
|
|
||||||
-- | Add two 'PValue's together
|
-- | Add two 'PValue's together.
|
||||||
paddValue :: forall s. Term s (PValue :--> PValue :--> PValue)
|
paddValue :: forall s. Term s (PValue :--> PValue :--> PValue)
|
||||||
paddValue = phoistAcyclic $
|
paddValue = phoistAcyclic $
|
||||||
plam $ \a' b' -> P.do
|
plam $ \a' b' -> P.do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue