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!