This PR adds public minting support for SPG functions that handle minting. It replaces the onlyCallerWithMinterRole access control modifier with onlyMintAuthorized, which checks if the caller is authorized to mint—either by having the minter role in the given SPG NFT contract or if the contract has publicMinting enabled.
Test Plan
Added test_SPG_revert_mintAndRegisterIp_callerNotAuthorizedToMint to verify that minting is blocked when the caller doesn't have the minter role and public minting is disabled in the collection.
Added test_SPG_mintAndRegisterIp_publicMint to test that minting is allowed when public minting is enabled, even if the caller doesn't have the minter role.
Existing tests already cover cases where the caller has the minter role, but public minting is disabled.
Description
This PR adds public minting support for SPG functions that handle minting. It replaces the
onlyCallerWithMinterRole
access control modifier withonlyMintAuthorized
, which checks if the caller is authorized to mint—either by having the minter role in the given SPG NFT contract or if the contract haspublicMinting
enabled.Test Plan
test_SPG_revert_mintAndRegisterIp_callerNotAuthorizedToMint
to verify that minting is blocked when the caller doesn't have the minter role and public minting is disabled in the collection.test_SPG_mintAndRegisterIp_publicMint
to test that minting is allowed when public minting is enabled, even if the caller doesn't have the minter role.All new and existing tests pass locally.
Related Issue