remove allOutputs
This commit is contained in:
parent
02bf6f49cc
commit
75c236db01
2 changed files with 7 additions and 31 deletions
|
|
@ -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 ())
|
||||
|
|
|
|||
|
|
@ -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 $
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue