apply remaining suggestions
This commit is contained in:
parent
646f4900ff
commit
4141873cce
5 changed files with 22 additions and 12 deletions
|
|
@ -1,7 +1,9 @@
|
||||||
{- |
|
{- |
|
||||||
Module : Agora.AuthorityToken
|
Module : Agora.AuthorityToken
|
||||||
Maintainer : emi@haskell.fyi
|
Maintainer : emi@haskell.fyi
|
||||||
Description: Tokens acting as redeemable proofs of DAO authority
|
Description: Tokens acting as redeemable proofs of DAO authority.
|
||||||
|
|
||||||
|
Tokens acting as redeemable proofs of DAO authority.
|
||||||
-}
|
-}
|
||||||
module Agora.AuthorityToken (
|
module Agora.AuthorityToken (
|
||||||
authorityTokenPolicy,
|
authorityTokenPolicy,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
{- |
|
{- |
|
||||||
Module : Agora.SafeMoney
|
Module : Agora.SafeMoney
|
||||||
Maintainer : emi@haskell.fyi
|
Maintainer : emi@haskell.fyi
|
||||||
Description: Phantom-type protected types for handling money in Plutus
|
Description: Phantom-type protected types for handling money in Plutus.
|
||||||
|
|
||||||
|
Phantom-type protected types for handling money in Plutus.
|
||||||
-}
|
-}
|
||||||
module Agora.SafeMoney (
|
module Agora.SafeMoney (
|
||||||
-- * Types
|
-- * Types
|
||||||
|
|
@ -43,7 +45,7 @@ import Agora.Utils
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- | Type-level unique identifier for an AssetClass
|
-- | Type-level unique identifier for an `AssetClass`
|
||||||
type MoneyClass =
|
type MoneyClass =
|
||||||
( -- AssetClass
|
( -- AssetClass
|
||||||
Symbol
|
Symbol
|
||||||
|
|
@ -53,12 +55,12 @@ type MoneyClass =
|
||||||
Nat
|
Nat
|
||||||
)
|
)
|
||||||
|
|
||||||
-- | A PDiscrete amount of currency tagged on the type level with the MoneyClass it belong sto
|
-- | A `PDiscrete` amount of currency tagged on the type level with the `MoneyClass` it belong sto
|
||||||
newtype PDiscrete (mc :: MoneyClass) (s :: S)
|
newtype PDiscrete (mc :: MoneyClass) (s :: S)
|
||||||
= PDiscrete (Term s PInteger)
|
= PDiscrete (Term s PInteger)
|
||||||
deriving (PlutusType, PIsData, PEq, POrd) via (DerivePNewtype (PDiscrete mc) PInteger)
|
deriving (PlutusType, PIsData, PEq, POrd) via (DerivePNewtype (PDiscrete mc) PInteger)
|
||||||
|
|
||||||
-- | Add two `PDiscrete` values of the same MoneyClass.
|
-- | Add two `PDiscrete` values of the same `MoneyClass`.
|
||||||
paddDiscrete :: Term s (PDiscrete mc :--> PDiscrete mc :--> PDiscrete mc)
|
paddDiscrete :: Term s (PDiscrete mc :--> PDiscrete mc :--> PDiscrete mc)
|
||||||
paddDiscrete = phoistAcyclic $
|
paddDiscrete = phoistAcyclic $
|
||||||
-- In the future, this should use plutarch-numeric
|
-- In the future, this should use plutarch-numeric
|
||||||
|
|
@ -77,7 +79,7 @@ type ADA = '("", "", 6)
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- | Downcast a 'PValue' to a 'PDiscrete' unit.
|
-- | Downcast a `PValue` to a `PDiscrete` unit.
|
||||||
pvalueDiscrete ::
|
pvalueDiscrete ::
|
||||||
forall (moneyClass :: MoneyClass) (ac :: Symbol) (n :: Symbol) (scale :: Nat) s.
|
forall (moneyClass :: MoneyClass) (ac :: Symbol) (n :: Symbol) (scale :: Nat) s.
|
||||||
( KnownSymbol ac
|
( KnownSymbol ac
|
||||||
|
|
@ -92,8 +94,8 @@ pvalueDiscrete = phoistAcyclic $
|
||||||
# pconstant (fromString $ symbolVal $ Proxy @n)
|
# pconstant (fromString $ symbolVal $ Proxy @n)
|
||||||
# f
|
# f
|
||||||
|
|
||||||
{- | Get a 'PValue' from a 'PDiscrete'.
|
{- | Get a `PValue` from a `PDiscrete`.
|
||||||
NOTE: pdiscreteValue after pvaluePDiscrete is loses information
|
__NOTE__: `pdiscreteValue` after `pvalueDiscrete` is loses information
|
||||||
-}
|
-}
|
||||||
pdiscreteValue ::
|
pdiscreteValue ::
|
||||||
forall (moneyClass :: MoneyClass) (ac :: Symbol) (n :: Symbol) (scale :: Nat) s.
|
forall (moneyClass :: MoneyClass) (ac :: Symbol) (n :: Symbol) (scale :: Nat) s.
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@
|
||||||
{- |
|
{- |
|
||||||
Module : Agora.SafeMoney.QQ
|
Module : Agora.SafeMoney.QQ
|
||||||
Maintainer : emi@haskell.fyi
|
Maintainer : emi@haskell.fyi
|
||||||
Description: Quasiquoter for SafeMoney types
|
Description: Quasiquoter for SafeMoney types.
|
||||||
|
|
||||||
|
Quasiquoter for SafeMoney types.
|
||||||
-}
|
-}
|
||||||
module Agora.SafeMoney.QQ (discrete) where
|
module Agora.SafeMoney.QQ (discrete) where
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
Module : Agora.Stake
|
Module : Agora.Stake
|
||||||
Maintainer : emi@haskell.fyi
|
Maintainer : emi@haskell.fyi
|
||||||
Description: Vote-lockable stake UTXOs holding GT.
|
Description: Vote-lockable stake UTXOs holding GT.
|
||||||
|
|
||||||
|
Vote-lockable stake UTXOs holding GT.
|
||||||
-}
|
-}
|
||||||
module Agora.Stake (
|
module Agora.Stake (
|
||||||
PStakeDatum (..),
|
PStakeDatum (..),
|
||||||
|
|
@ -105,7 +107,7 @@ newtype PStakeDatum (gt :: MoneyClass) (s :: S) = PStakeDatum
|
||||||
-}
|
-}
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- | Policy for Stake state threads
|
-- | Policy for Stake state threads.
|
||||||
stakePolicy ::
|
stakePolicy ::
|
||||||
forall (gt :: MoneyClass) ac n scale s.
|
forall (gt :: MoneyClass) ac n scale s.
|
||||||
( KnownSymbol ac
|
( KnownSymbol ac
|
||||||
|
|
@ -186,7 +188,7 @@ stakePolicy _stake =
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- | Validator intended for Stake UTXOs to live in
|
-- | Validator intended for Stake UTXOs to live in.
|
||||||
stakeValidator ::
|
stakeValidator ::
|
||||||
forall (gt :: MoneyClass) ac n scale s.
|
forall (gt :: MoneyClass) ac n scale s.
|
||||||
( KnownSymbol ac
|
( KnownSymbol ac
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
{- |
|
{- |
|
||||||
Module : Agora.Utils
|
Module : Agora.Utils
|
||||||
Maintainer : emi@haskell.fyi
|
Maintainer : emi@haskell.fyi
|
||||||
Description: Plutarch utility functions that should be upstreamed or don't belong anywhere else
|
Description: Plutarch utility functions that should be upstreamed or don't belong anywhere else.
|
||||||
|
|
||||||
|
Plutarch utility functions that should be upstreamed or don't belong anywhere else.
|
||||||
-}
|
-}
|
||||||
module Agora.Utils (
|
module Agora.Utils (
|
||||||
-- * Validator-level utility functions
|
-- * Validator-level utility functions
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue