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