Freee Docs
  • Guide
  • Getting Started
    • How do I connect my wallet to Freee?
    • How do I mint on Freee?
    • Gas Fees
  • Freee Create
    • What can I create on Freee?
    • Single-Edition (ERC-721)
      • How to create a Edition
      • Managing your Edition (ERC-721)
    • Drop (ERC-721)
      • How to create a Drop (ERC-721)
      • How to set up the artwork folder for your Drops collection
      • How to set up the .csv file in your Drops collection
      • Managing your Drop (ERC-721)
    • Collection (ERC-721)
      • How to create a collection (ERC721)
      • How to upload collection artworks?
      • Managing your Collection (ERC721)
        • Manage Sale Stages
        • Manage Pre-reveal & Reveal
        • General Settings
      • Others
        • In depth outline of collection artworks folder
        • In-depth Outline of collection metadata CSV
    • Multi-Edition (ERC-1155)
      • How to Create a Multi-Edition
      • Managing your Collection (Onchain)
    • More Features
      • How can I create an Airdrop?
      • How can I create an Allowlist?
      • Receive blast rewards
    • Create FAQs
      • Can I connect a multi-sig wallet?
      • How do I use a split contract with my collection?
      • How do I withdraw my earnings?
      • Do I have to pay a fee to collect my earnings?
      • Can I add a custom payout address to my collection?
  • Smart Contracts
    • Deployed Contract Addresses
      • Mainnets
      • Testnets
    • Smart Contracts Event-based Overview
    • 1155 Contracts
      • Creating a Contract
      • Creating a Token
      • Selling a Token
      • Minting Tokens
      • Permissions
    • 721 Contracts
      • NFT Creator Factory
      • NFT Implementation
      • Edition Metadata Renderer
      • Drop Metadata Renderer
      • Collection Metadata Renderer
  • Freee Platform Fees
  • Create, share, and collect to earn
    • Understanding Rewards on Freee
    • How to create to earn
    • How to share to earn
    • How to collect to earn
    • Diamond Rewards Chart
  • Freee FAQs
    • Why can't I mint from a collection ?
    • Why can't I see my minted NFT(s) ?
    • Why did my mint transaction fail ?
  • Legal
    • Privacy Policy
    • Terms of Service
Powered by GitBook
On this page
  • Admin and Minter Role
  • Assigning Mint Access
  • Checking for Admin or Role
  • Contract Level Permissions
  • Setting the Owner
  • Setting a Contract Role
  • Token Level Permissions
  • Removing a Role
  • Updating Royalties
  1. Smart Contracts
  2. 1155 Contracts

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.

function isAdminOrRole(
    address user,
    uint256 tokenId,
    uint256 role // Optional for admin checking
)

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.

function setOwner(address newOwner) external onlyAdmin(CONTRACT_BASE_ID)

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.

function addPermission(
    uint256 tokenId, // tokenId 0 for contract level
    address user,
    uint256 permissionBits
) external onlyAdmin(tokenId)

Token Level Permissions

Add a role to a user for a specific token.

function addPermission(
    uint256 tokenId,
    address user,
    uint256 permissionBits
) external onlyAdmin(tokenId)

Removing a Role

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

function removePermission(
    uint256 tokenId,
    address user,
    uint256 permissionBits
) external onlyAdmin(tokenId)

Updating Royalties

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

function updateRoyaltiesForToken(
    uint256 tokenId, 
    RoyaltyConfiguration memory newConfiguration
)
  • 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.

struct RoyaltyConfiguration {
    uint32 royaltyMintSchedule;
    uint32 royaltyBPS;
    address royaltyRecipient;
}
PreviousMinting TokensNext721 Contracts

Last updated 1 year ago