1

We want to associate multiple policy ids with the same token/nft. Is this possible?

2 Answers 2

1

as @Fermat already answered

Currently Value is parametrized by a currency symbol and a token name. Here the currency symbol is not arbitrary, it is the hash of the minting policy script. This script determines under which conditions the tokens under this policy can be minted or burned.

so NO you cannot have multiple policy ids for the same token since then we wouldn't know how to properly mint/burn it.

what you could do instead is to associate multiple validators to the policy which is supposed to mint or burn you token or NFT.

as an example say you want to check for validatorA and validatorB to both have signed the transaction (therefore have been executed with success) and validatorC to succeed in order to burn

your minting policy would look like this:

mintingPolicyLogic :: BuiltinData -> ScriptContext -> Bool
mintingPolicyLogic _red ctx =
    if isMinting then
        validatorASucceeded &&
        validatorBSucceeded
    else
        validatorCSucceeded
    where
        validatorSucceded :: ValidatorHash -> Bool
        validatorSucceded valHash = forwardToValidator valHash () ctx

        validatorASucceeded = validatorSucceded <insert validatorA hash here>
        validatorBSucceeded = validatorSucceded <insert validatorB hash here>
        validatorCSucceeded = validatorSucceded <insert validatorC hash here>

        isMinting = case Value.flattenValue (LedgerApi.txInfoMint txInfo) of
            [] -> False
            [( _sym, _tn, amount )] -> amount > 0
            _ -> traceError "multiple mints per tx not allowed"

forwardToValidator docs

NOTE: the script provided is by no mean production ready, lots of improvements can (and should) be made, the script is here for educational purposes only

2
  • Note that a mintingPolicy only uses a redeemer and the context, not a datum.
    – Fermat
    Commented Jun 22, 2022 at 12:37
  • @Fermat you're rigth, my bad Commented Jun 22, 2022 at 13:31
0

Currently Value is parametrized by a currency symbol, a tokenname and the amount of tokens of this type(1). Here the currency symbol is not arbitrary, it is the hash of the minting policy script. This script determines under which conditions the tokens under this policy can be minted or burned.

To answer your question, it depends. If you want tokens with the same Tokenname and different policies, then yes. But if you want one token with currency symbol x and tokenname y that you can mint via multiple minting policies that both hash to x, then no.

Perhaps you could specify what you want to do with the token? If you just want two condition that both can mint/burn you could always combine two minting policies to get one policy.

Your Answer

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

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