get rid of pownCurrencySymbol
This commit is contained in:
parent
8630b7190d
commit
c47d0ca857
2 changed files with 8 additions and 17 deletions
|
|
@ -78,8 +78,7 @@ import Agora.Utils (
|
||||||
pfindTxInByTxOutRef,
|
pfindTxInByTxOutRef,
|
||||||
pisDJust,
|
pisDJust,
|
||||||
pisJust,
|
pisJust,
|
||||||
pisUxtoSpent,
|
pisUTXOSpent,
|
||||||
pownCurrencySymbol,
|
|
||||||
psymbolValueOf,
|
psymbolValueOf,
|
||||||
ptxSignedBy,
|
ptxSignedBy,
|
||||||
pvalueSpent,
|
pvalueSpent,
|
||||||
|
|
@ -95,7 +94,7 @@ import Plutarch.Api.V1 (
|
||||||
PDatumHash,
|
PDatumHash,
|
||||||
PMap,
|
PMap,
|
||||||
PMintingPolicy,
|
PMintingPolicy,
|
||||||
PScriptPurpose (PSpending),
|
PScriptPurpose (PSpending, PMinting),
|
||||||
PTxOut,
|
PTxOut,
|
||||||
PValidator,
|
PValidator,
|
||||||
PValidatorHash,
|
PValidatorHash,
|
||||||
|
|
@ -244,12 +243,13 @@ governorPolicy :: Governor -> ClosedTerm PMintingPolicy
|
||||||
governorPolicy gov =
|
governorPolicy gov =
|
||||||
plam $ \_ ctx' -> P.do
|
plam $ \_ ctx' -> P.do
|
||||||
let oref = pconstant gov.gstOutRef
|
let oref = pconstant gov.gstOutRef
|
||||||
ownSymbol = pownCurrencySymbol # ctx'
|
|
||||||
|
PMinting ((pfield @"_0" #) -> ownSymbol) <- pmatch (pfromData $ pfield @"purpose" # ctx')
|
||||||
|
|
||||||
mintValue <- plet $ pownMintValue # ctx'
|
mintValue <- plet $ pownMintValue # ctx'
|
||||||
|
|
||||||
passert "Referenced utxo should be spent" $
|
passert "Referenced utxo should be spent" $
|
||||||
pisUxtoSpent # oref #$ pfield @"txInfo" # ctx'
|
pisUTXOSpent # oref #$ pfield @"txInfo" # ctx'
|
||||||
|
|
||||||
passert "Exactly one token should be minted" $
|
passert "Exactly one token should be minted" $
|
||||||
psymbolValueOf # ownSymbol # mintValue #== 1
|
psymbolValueOf # ownSymbol # mintValue #== 1
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,7 @@ module Agora.Utils (
|
||||||
pnub,
|
pnub,
|
||||||
pisUniq,
|
pisUniq,
|
||||||
pisDJust,
|
pisDJust,
|
||||||
pownCurrencySymbol,
|
pisUTXOSpent,
|
||||||
pisUxtoSpent,
|
|
||||||
|
|
||||||
-- * Functions which should (probably) not be upstreamed
|
-- * Functions which should (probably) not be upstreamed
|
||||||
anyOutput,
|
anyOutput,
|
||||||
|
|
@ -379,18 +378,10 @@ pisDJust = phoistAcyclic $
|
||||||
_ -> pconstant False
|
_ -> pconstant False
|
||||||
)
|
)
|
||||||
|
|
||||||
-- | The 'CurrencySymbol' of the current minting policy.
|
|
||||||
-- FIXME: Yeet/reimplement this function, since passing the whole script context is highly inefficient.
|
|
||||||
pownCurrencySymbol :: Term s (PScriptContext :--> PCurrencySymbol)
|
|
||||||
pownCurrencySymbol = phoistAcyclic $
|
|
||||||
plam $ \ctx -> P.do
|
|
||||||
PMinting m <- pmatch $ pfield @"purpose" # ctx
|
|
||||||
pfield @"_0" # m
|
|
||||||
|
|
||||||
-- | Determines if a given UTXO is spent.
|
-- | Determines if a given UTXO is spent.
|
||||||
-- TODO: no need to pass the whole TxInfo here.
|
-- TODO: no need to pass the whole TxInfo here.
|
||||||
pisUxtoSpent :: Term s (PTxOutRef :--> PTxInfo :--> PBool)
|
pisUTXOSpent :: Term s (PTxOutRef :--> PTxInfo :--> PBool)
|
||||||
pisUxtoSpent = phoistAcyclic $
|
pisUTXOSpent = phoistAcyclic $
|
||||||
plam $ \oref info -> P.do
|
plam $ \oref info -> P.do
|
||||||
pisJust #$ pfindTxInByTxOutRef # oref # info
|
pisJust #$ pfindTxInByTxOutRef # oref # info
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue