2

Suppose I have one contract, Contract 1, that is parameterized by type

Contract1Params{
   tokenName :: BuiltinByteString
}

and I have a minting policy that will only mint a token with tokenName tn to the address of Contract 1 parameterized by c1p where tokenName c1p is tn.

So I need to get the address of parameterized contract from the token name of the token that is attempting to be minted from within the minting policy. Not sure how to do this with on chain code. Any ideas?

1

Your minting policy should have a parameter related to the address of the contract.

mkPolicy :: Address -> () -> ScriptContext -> Bool

In your off chain code, you send that parameter to your minting policy with something like this:

let val = Value.singleton (mySymbol $ scrAddress cp1) tn 1

Where:

  • mySymbol is the CurrencySymbol of your minting policy
  • scrAddress is the Address of your validator script
  • cp1 is the Parameter of your validator script

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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