fix documentation; apply suggestions
This commit is contained in:
parent
fdda162597
commit
01d0efc594
7 changed files with 26 additions and 18 deletions
|
|
@ -13,7 +13,7 @@ module Agora.AuthorityToken (
|
|||
|
||||
import Agora.Governor (PGovernorRedeemer (PMintGATs), presolveGovernorRedeemer)
|
||||
import Agora.SafeMoney (AuthorityTokenTag, GovernorSTTag)
|
||||
import Agora.Utils (psymbolValueOfT, ptag, ptoScottEncodingT, puntag)
|
||||
import Agora.Utils (ptag, ptaggedSymbolValueOf, ptoScottEncodingT, puntag)
|
||||
import Plutarch.Api.V1 (
|
||||
PCredential (..),
|
||||
PCurrencySymbol (..),
|
||||
|
|
@ -101,7 +101,7 @@ singleAuthorityTokenBurned ::
|
|||
Term s PBool
|
||||
singleAuthorityTokenBurned gatCs inputs mint = unTermCont $ do
|
||||
let gatAmountMinted :: Term _ PInteger
|
||||
gatAmountMinted = psymbolValueOfT # gatCs # mint
|
||||
gatAmountMinted = ptaggedSymbolValueOf # gatCs # mint
|
||||
|
||||
let inputsWithGAT =
|
||||
pfoldMap
|
||||
|
|
@ -117,12 +117,13 @@ singleAuthorityTokenBurned gatCs inputs mint = unTermCont $ do
|
|||
$ resolved
|
||||
|
||||
pure . pcon . PSum $
|
||||
psymbolValueOfT
|
||||
ptaggedSymbolValueOf
|
||||
# gatCs
|
||||
#$ pfield @"value"
|
||||
#$ resolved
|
||||
)
|
||||
# inputs
|
||||
|
||||
pure $
|
||||
foldr1
|
||||
(#&&)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import Agora.Governor (
|
|||
PGovernorRedeemer,
|
||||
)
|
||||
import Agora.SafeMoney (AuthorityTokenTag, GovernorSTTag)
|
||||
import Agora.Utils (psymbolValueOfT)
|
||||
import Agora.Utils (ptaggedSymbolValueOf)
|
||||
import Plutarch.Api.V1 (PCurrencySymbol, PValidatorHash)
|
||||
import Plutarch.Api.V2 (
|
||||
PScriptPurpose (PSpending),
|
||||
|
|
@ -187,7 +187,7 @@ mutateGovernorValidator =
|
|||
foldl1
|
||||
(#&&)
|
||||
[ ptraceIfFalse "Governor UTxO should carry GST" $
|
||||
psymbolValueOfT
|
||||
ptaggedSymbolValueOf
|
||||
# gstSymbol
|
||||
# (pfield @"value" # inputF.resolved)
|
||||
#== 1
|
||||
|
|
|
|||
|
|
@ -298,7 +298,11 @@ pisGovernorDatumValid = phoistAcyclic $
|
|||
pisMaxTimeRangeWidthValid # datumF.createProposalTimeRangeMaxWidth
|
||||
]
|
||||
|
||||
-- | @since 1.0.0
|
||||
{- | Find the governor input and resolve the corresponding governor redeemer,
|
||||
given the assetclass of GST.
|
||||
|
||||
@since 1.0.0
|
||||
-}
|
||||
presolveGovernorRedeemer ::
|
||||
forall (s :: S).
|
||||
Term
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import Agora.Stake (
|
|||
pnumCreatedProposals,
|
||||
presolveStakeInputDatum,
|
||||
)
|
||||
import Agora.Utils (psymbolValueOfT, ptoScottEncodingT, puntag)
|
||||
import Agora.Utils (ptaggedSymbolValueOf, ptoScottEncodingT, puntag)
|
||||
import Data.Function (on)
|
||||
import Plutarch.Api.V1 (PCurrencySymbol, PValidatorHash)
|
||||
import Plutarch.Api.V1.AssocMap (plookup)
|
||||
|
|
@ -321,7 +321,7 @@ governorValidator =
|
|||
outputF.address
|
||||
governorInputF.address
|
||||
, ptraceIfFalse "Has governor ST" $
|
||||
psymbolValueOfT # gstSymbol # outputF.value #== 1
|
||||
ptaggedSymbolValueOf # gstSymbol # outputF.value #== 1
|
||||
]
|
||||
|
||||
datum =
|
||||
|
|
@ -474,7 +474,7 @@ governorValidator =
|
|||
-- Filter out proposal inputs and ouputs using PST and the address of proposal validator.
|
||||
|
||||
pguardC "The governor can only process one proposal at a time" $
|
||||
(psymbolValueOfT # pstSymbol #$ pvalueSpent # txInfoF.inputs) #== 1
|
||||
(ptaggedSymbolValueOf # pstSymbol #$ pvalueSpent # txInfoF.inputs) #== 1
|
||||
|
||||
let proposalInputDatum =
|
||||
passertPJust
|
||||
|
|
@ -507,7 +507,7 @@ governorValidator =
|
|||
outputF <- pletFieldsC @'["address", "datum", "value"] output
|
||||
|
||||
let atAmount =
|
||||
psymbolValueOfT
|
||||
ptaggedSymbolValueOf
|
||||
# atSymbol
|
||||
# outputF.value
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import Agora.Stake (
|
|||
pisVoter,
|
||||
presolveStakeInputDatum,
|
||||
)
|
||||
import Agora.Utils (psymbolValueOfT, ptoScottEncodingT)
|
||||
import Agora.Utils (ptaggedSymbolValueOf, ptoScottEncodingT)
|
||||
import Data.Function (on)
|
||||
import Plutarch.Api.V1 (PCredential, PCurrencySymbol)
|
||||
import Plutarch.Api.V1.AssocMap (plookup)
|
||||
|
|
@ -287,7 +287,7 @@ proposalValidator =
|
|||
outputF.address
|
||||
proposalInputF.address
|
||||
, ptraceIfFalse "Has proposal ST" $
|
||||
psymbolValueOfT # pstSymbol # outputF.value #== 1
|
||||
ptaggedSymbolValueOf # pstSymbol # outputF.value #== 1
|
||||
]
|
||||
|
||||
handleProposalUTxO =
|
||||
|
|
@ -724,7 +724,7 @@ proposalValidator =
|
|||
. (pfield @"resolved" #) ->
|
||||
value
|
||||
) ->
|
||||
psymbolValueOfT # gstSymbol # value #== 1
|
||||
ptaggedSymbolValueOf # gstSymbol # value #== 1
|
||||
)
|
||||
# pfromData txInfoF.inputs
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import "liqwid-plutarch-extra" Plutarch.Extra.TermCont (pguardC, pletFieldsC, pm
|
|||
Following arguments should be provided(in this order):
|
||||
1. authority token symbol
|
||||
|
||||
@since 0.1.0
|
||||
@since 1.0.0
|
||||
-}
|
||||
treasuryValidator ::
|
||||
ClosedTerm (PTagged AuthorityTokenTag PCurrencySymbol :--> PValidator)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module Agora.Utils (
|
|||
pisNothing,
|
||||
pisDNothing,
|
||||
ptoScottEncodingT,
|
||||
psymbolValueOfT,
|
||||
ptaggedSymbolValueOf,
|
||||
ptag,
|
||||
puntag,
|
||||
) where
|
||||
|
|
@ -88,8 +88,11 @@ ptoScottEncodingT = phoistAcyclic $
|
|||
plam $ \d ->
|
||||
punsafeDowncast $ ptoScottEncoding #$ pto d
|
||||
|
||||
-- | @since 1.0.0
|
||||
psymbolValueOfT ::
|
||||
{- | Get the sum of all values belonging to a particular tagged 'CurrencySymbol'.
|
||||
|
||||
@since 1.0.0
|
||||
-}
|
||||
ptaggedSymbolValueOf ::
|
||||
forall
|
||||
{k :: Type}
|
||||
(unit :: k)
|
||||
|
|
@ -97,7 +100,7 @@ psymbolValueOfT ::
|
|||
(amounts :: AmountGuarantees)
|
||||
(s :: S).
|
||||
Term s (PTagged unit PCurrencySymbol :--> (PValue keys amounts :--> PInteger))
|
||||
psymbolValueOfT = phoistAcyclic $ plam $ \tcs -> psymbolValueOf # pto tcs
|
||||
ptaggedSymbolValueOf = phoistAcyclic $ plam $ \tcs -> psymbolValueOf # pto tcs
|
||||
|
||||
-- | @since 1.0.0
|
||||
ptag ::
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue