Permissions

Admin and Minter Role

  • Admin: Can update sales, airdrop tokens, metadata, and withdraw ETH

  • Minter: Can mint and airdrop tokens

Assigning Mint Access

By giving an address mint access it will be able to mint NFTs from the contract.

However, this means different sales strategies can be created for the contract and given access to manage minting.

The minter role can be granted at either the contract or token level.

The roles are stored at different bit amounts.

uint256 PERMISSION_BIT_ADMIN = 2**1;
uint256 PERMISSION_BIT_MINTER = 2**2;

Note, contract metadata and other settings are stored at tokenId 0.

To specify an update for the contract level, tokenId 0 can be used instead of an individual token.

uint256 CONTRACT_BASE_ID = 0;

Checking for Admin or Role

The isAdminOrRole checks if an address either has a minter role for a token or if they are the admin.

Passing in tokenId 0 will return the role for the contract level.

Contract Level Permissions

Setting the Owner

Set the owner of the contract. This function can only be called by the contract admin.

Owner is set to the defaultAdmin when the contract is created.

Setting a Contract Role

For granting permission at the contract level, 0 is passed in as the tokenId Only an admin can add an address as a role.

By default, both the minters have the contract level minter role in the contract.

Token Level Permissions

Add a role to a user for a specific token.

Removing a Role

Remove a role from a user for a token or the contract (tokenId 0).

Updating Royalties

Updates the royalty configuration for a token or the contract (tokenId 0).

  • royaltyMintSchedule: 1/N tokens are minted to the royalty recipient

  • royaltyBPS: The royalty amount in basis points for secondary sales.

  • royaltyRecipient: The address that will receive the royalty payments.

Last updated