ERC1155OpenEdition

The ERC1155OpenEdition smart contract is a self-sovereign ERC-1155 minter preset. This contract allows for the creation of open edition tokens with a defined maximum supply, unit price, and mint end time. It also tracks both royalties and token market (primary and secondary) according to the ERC-2981 royalty standard.

View on GitHub

Usage

import "@ninfa-labs/contracts/token/ERC1155/presets/ERC1155OpenEdition.sol";

This contract inherits from ERC1155Base and extends it with the required functionality for open edition minting. It is not meant to be imported but rather used as standalone. All the extensions used by ERC1155Base are therefore inherited by ERC1155OpenEdition as well and can be accessed or overridden by this implementation.

Here is how to use the contract:



contract MyToken is ERC1155OpenEdition {

    constructor(address factory_) ERC1155OpenEdition(factory_) { }
    
}

Features

  • Open Edition Minting: Allows the creation of open edition tokens with a defined maximum supply, unit price, and mint end time. This is done through the mint function.

  • Order Tracking: The contract tracks the details of each order, including the unit price, mint end time, maximum supply, and the address of the creator.

  • Minting and Buying: The contract includes functions for both minting new tokens (mint) and buying existing tokens (mint). These functions handle the necessary checks and operations for each process.

  • Order Settings: The contract allows for the adjustment of the mint end time, unit price, and maximum supply of a token. This is done through the setMintEnd, setUnitPrice, and setMaxSupply functions.

  • Payment Handling: The contract handles the payment process for both minting and buying operations. This includes the calculation and distribution of royalties.

  • Access Control: The contract uses the AccessControl extension for role-based access control. This allows for the restriction of certain operations to specific roles, such as the MINTER_ROLE.

  • Royalty Tracking: The contract tracks both royalties and token market (primary and secondary) using the ERC-2981 royalty standard.

Last updated