0

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!

1 Answer 1

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.

1
  • 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! Sep 6, 2022 at 2:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.