Remove address check for state thread token output

This commit is contained in:
Daniel Farrelly 2023-04-13 19:17:25 +01:00 committed by Emily Martins
parent 0570ce08cc
commit 7c475a4977
4 changed files with 9 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -27,7 +27,7 @@ import Agora.Governor (
)
import Agora.Proposal (PProposalId)
import Agora.SafeMoney (AuthorityTokenTag, GovernorSTTag)
import Agora.Utils (pfindInputWithStateThreadToken, pfindOutputWithStateThreadTokenAndAddress)
import Agora.Utils (pfindInputWithStateThreadToken, pfindOutputWithStateThreadToken)
import Generics.SOP qualified as SOP
import Plutarch.Api.V1 (PCurrencySymbol)
import Plutarch.Api.V2 (
@ -204,8 +204,6 @@ mutateGovernorValidator =
governorRef = pfield @"outRef" # governorInput
governorInputAddress = pfield @"address" #$ pfield @"resolved" # governorInput
governorInputDatum =
ptrace "Resolve governor input datum" $
pfromData $
@ -256,9 +254,8 @@ mutateGovernorValidator =
governorOutput =
passertPJust
# "No governor output found"
#$ pfindOutputWithStateThreadTokenAndAddress
#$ pfindOutputWithStateThreadToken
# pfromData gstSymbol
# governorInputAddress
# pfromData txInfoF.outputs
governorOutputDatum =

View file

@ -21,7 +21,7 @@ module Agora.Utils (
puncurryTuple,
psubtractSortedValue,
pfindInputWithStateThreadToken,
pfindOutputWithStateThreadTokenAndAddress,
pfindOutputWithStateThreadToken,
pisSubValueOf,
) where
@ -31,7 +31,6 @@ import Plutarch.Api.V1.AssocMap qualified as AssocMap
import Plutarch.Api.V1.Scripts (PDatumHash (PDatumHash))
import Plutarch.Api.V2 (
AmountGuarantees (NoGuarantees),
PAddress,
PCurrencySymbol,
PMaybeData (PDNothing),
PTuple,
@ -203,19 +202,17 @@ pfindInputWithStateThreadToken = plam $ \tokenSymbol inputs ->
# inputs
{- | Find an output containing exactly one token with the given currency symbol,
and with a PAddress that matches the given one.
@since 1.0.0
-}
pfindOutputWithStateThreadTokenAndAddress ::
pfindOutputWithStateThreadToken ::
forall tag.
ClosedTerm
( PTagged tag PCurrencySymbol
:--> PAddress
:--> PBuiltinList PTxOut
:--> PMaybe PTxOut
)
pfindOutputWithStateThreadTokenAndAddress = plam $ \tokenSymbol address outputs ->
pfindOutputWithStateThreadToken = plam $ \tokenSymbol outputs ->
pfind
# ( plam $ \output ->
( ptaggedSymbolValueOf
@ -223,7 +220,6 @@ pfindOutputWithStateThreadTokenAndAddress = plam $ \tokenSymbol address outputs
# (pfield @"value" # output)
#== 1
)
#&& (address #== (pfield @"address" # output))
)
# outputs