<p>Would be good to have more context but looks like the problem could be with how you produce the CurrencySymbol. Is <code>policy</code> inlineable? If you want the current minting policy's currency symbol when use <code>ownCurrencySymbol</code>. If you want another script's currency symbol when pass it in as parameter.</p>

CC BY-SA 4.0
2022-09-06T02:17:45.727Z
The use case is I want to make sure the token spent is minted through a one-time minting policy. Thus, I want another script’s currency symbol. Since the currency symbol is dynamic (depends on the txOutRef supplies as parameter), it could not be obtained and pass it in as parameter beforehand. Lars answered this question on a live PPP Q&A session saying this is not working at the moment. I am looking for if there is any work around which could perform similar effect. Thanks anyway for suggesting!
SIDAN Whatever
CC BY-SA 4.0
2022-07-11T12:22:47.733Z
2022-07-11T12:22:47.733Z
james
<p>supposed I have a <code>mintingpolicy</code> script (simple one time minting policy, parameterizing TxOutRef) and a <code>validator</code> script. I want to validate if the token with correct <code>CurrencySymbol</code> is spent in a validator script by passing in <code>TxOutRef</code>.</p>
<pre><code>-- Inside the validator script
spentToken :: TxOutRef -&gt; PaymentPubKeyHash -&gt; TokenName -&gt; Bool
spentToken otOref pkh tn = assetClassValueOf (valuePaidTo info $ unPaymentPubKeyHash pkh) (assetClass (curSymbol otOref) tn) == 1

-- Inside the minting policy script
curSymbol :: TxOutRef -&gt; CurrencySymbol
curSymbol = scriptCurrencySymbol . policy
</code></pre>
<p>However, it is not compiled: GHC Core to PLC plugin: <code>E042:Error: Unsupported feature: Type constructor: GHC.Prim.Addr#</code></p>
<p>The closest issue I could find is this: <a href="https://cardano.stackexchange.com/questions/431/hardcoding-currency-symbol-and-token-name-in-validator-script">Hardcoding currency symbol and token name in validator script</a>. But seems it is about hardcoding strings, but not passing parameters to get the <code>CurrencySymbol</code> for validation. Appreciate any clues!</p>

<plutus><plutus-pioneer-program><minting><token><validator>
Using `curSymbol` function in Validator script
# Using `curSymbol` function in Validator script

(Asked by: username_0 on 2022-06-06)

supposed I have a mintingpolicy script (simple one time minting policy, parameterizing TxOutRef) and a validator script. I want to validate if the token with correct CurrencySymbol is spent in a validator script by passing in TxOutRef.
-- Inside the validator script
spentToken :: TxOutRef -> PaymentPubKeyHash -> TokenName -> Bool
spentToken otOref pkh tn = assetClassValueOf (valuePaidTo info $ unPaymentPubKeyHash pkh) (assetClass (curSymbol otOref) tn) == 1

-- Inside the minting policy script
curSymbol :: TxOutRef -> CurrencySymbol
curSymbol = scriptCurrencySymbol . policy

However, it is not compiled: GHC Core to PLC plugin: E042:Error: Unsupported feature: Type constructor: GHC.Prim.Addr#
The closest issue I could find is this: Hardcoding currency symbol and token name in validator script. But seems it is about hardcoding strings, but not passing parameters to get the CurrencySymbol for validation. Appreciate any clues!

**Tags:** plutus, plutus-pioneer-program, minting, token, validator

---

## 1 answers

### Answer by username_1 on 2022-07-11. Score: 0

Would be good to have more context but looks like the problem could be with how you produce the CurrencySymbol. Is `policy` inlineable? If you want the current minting policy's currency symbol when use `ownCurrencySymbol`. If you want another script's currency symbol when pass it in as parameter.

> **Comments:**
> **username_0**: The use case is I want to make sure the token spent is minted through a one-time minting policy. Thus, I want another script’s currency symbol. Since the currency symbol is dynamic (depends on the txOutRef supplies as parameter), it could not be obtained and pass it in as parameter beforehand. Lars answered this question on a live PPP Q&A session saying this is not working at the moment. I am looking for if there is any work around which could perform similar effect. Thanks anyway for suggesting!  

---

