diff --git a/agora/Agora/AuthorityToken.hs b/agora/Agora/AuthorityToken.hs index 9692ed3..06c5bb1 100644 --- a/agora/Agora/AuthorityToken.hs +++ b/agora/Agora/AuthorityToken.hs @@ -37,7 +37,6 @@ import GHC.Generics qualified as GHC -------------------------------------------------------------------------------- import Agora.Utils ( - allOutputs, plookup, psymbolValueOf, ptokenSpent, @@ -134,7 +133,7 @@ authorityTokenPolicy params = pmatch ctx' $ \(PScriptContext ctx') -> unTermCont $ do ctx <- tcont $ pletFields @'["txInfo", "purpose"] ctx' PTxInfo txInfo' <- tcmatch $ pfromData ctx.txInfo - txInfo <- tcont $ pletFields @'["inputs", "mint"] txInfo' + txInfo <- tcont $ pletFields @'["inputs", "mint", "outputs"] txInfo' let inputs = txInfo.inputs mintedValue = pfromData txInfo.mint AssetClass (govCs, govTn) = params.authority @@ -151,10 +150,12 @@ authorityTokenPolicy params = ( unTermCont $ do tcassert "Parent token did not move in minting GATs" govTokenSpent tcassert "All outputs only emit valid GATs" $ - allOutputs @PData # pfromData ctx.txInfo #$ plam $ \txOut _value _address _datum -> - authorityTokensValidIn - # ownSymbol - # txOut + pall + # plam + ( (authorityTokensValidIn # ownSymbol #) + . pfromData + ) + # txInfo.outputs pure $ popaque $ pconstant () ) (popaque $ pconstant ()) diff --git a/agora/Agora/Utils.hs b/agora/Agora/Utils.hs index 5cd6f40..2ef0a90 100644 --- a/agora/Agora/Utils.hs +++ b/agora/Agora/Utils.hs @@ -45,7 +45,6 @@ module Agora.Utils ( -- * Functions which should (probably) not be upstreamed anyOutput, - allOutputs, findTxOutByTxOutRef, scriptHashFromAddress, findOutputsToAddress, @@ -581,30 +580,6 @@ anyOutput = phoistAcyclic $ ) # pfromData txInfo.outputs --- | Check if all outputs match the predicate. -allOutputs :: - forall (datum :: PType) s. - ( PIsData datum - , PTryFrom PData (PAsData datum) - ) => - Term s (PTxInfo :--> (PTxOut :--> PValue :--> PAddress :--> datum :--> PBool) :--> PBool) -allOutputs = phoistAcyclic $ - plam $ \txInfo' predicate -> unTermCont $ do - txInfo <- tcont $ pletFields @'["outputs", "datums"] txInfo' - pure $ - pall - # plam - ( \txOut'' -> unTermCont $ do - PTxOut txOut' <- tcmatch (pfromData txOut'') - txOut <- tcont $ pletFields @'["value", "datumHash", "address"] txOut' - PDJust dh <- tcmatch txOut.datumHash - pure $ - pmatch (ptryFindDatum @(PAsData datum) # (pfield @"_0" # dh) # txInfo.datums) $ \case - PJust datum -> predicate # pfromData txOut'' # txOut.value # txOut.address # pfromData datum - PNothing -> pcon PFalse - ) - # pfromData txInfo.outputs - -- | Create a value with a single asset class. psingletonValue :: forall s. Term s (PCurrencySymbol :--> PTokenName :--> PInteger :--> PValue) psingletonValue = phoistAcyclic $