Giter Club home page Giter Club logo

celonft's Introduction

MyNft is an ERC721 token contract implemented in Solidity. It inherits various features from OpenZeppelin's ERC721 implementation and its extensions, providing functionalities such as minting, pausing, burning, and voting.

Contract Dependencies

MyNft - ERC721 Token Contract

Overview

The MyNft ERC721 token contract is designed to provide a versatile and comprehensive implementation for non-fungible tokens (NFTs) with additional features. It incorporates functionalities such as pausing, burning, and tracking successful minting.

Contract Dependencies

  • ERC721: The core ERC721 token implementation, handling basic NFT functionality.
  • ERC721Enumerable: Extends ERC721 to provide enumeration capabilities, allowing for efficient querying of token IDs.
  • ERC721URIStorage: Extends ERC721 to store and retrieve token URIs associated with each token ID.
  • ERC721Pausable: Extends ERC721 to add pausable functionality, allowing the contract owner to pause certain operations.
  • Ownable: Provides basic access control, allowing the contract owner to execute certain functions.
  • ERC721Burnable: Extends ERC721 to add burning functionality, allowing token owners to destroy their tokens.
  • EIP712: A utility library providing EIP-712 signature verification functionalities.
  • ERC721Votes: Extends ERC721 to enable voting mechanisms on token-related proposals.

ERC721 and Extensions ERC721: The core ERC721 contract provides basic functionalities for managing non-fungible tokens (NFTs), including ownership and transfer mechanisms.

ERC721Enumerable: This extension adds enumeration support, allowing efficient querying of token IDs.

ERC721URIStorage: Extends ERC721 to handle token URIs, providing a way to associate metadata with each token.

ERC721Pausable: This extension adds the ability to pause and unpause certain contract operations, giving the contract owner control over critical functions.

Access Control Ownable: The Ownable contract ensures that only the owner (deployer) of the contract has certain privileges, such as pausing and administrative actions. Token Burning ERC721Burnable: This extension allows token owners to burn (destroy) their tokens, removing them from circulation. Cryptographic Utilities EIP712: EIP-712 is a standard for typed structured data hashing and signing. This library provides utilities for handling EIP-712 signatures. Voting Mechanisms ERC721Votes: Extends ERC721 to enable voting mechanisms for proposals related to token governance. These dependencies make the MyNft contract a feature-rich ERC721 token, suitable for various NFT use cases with additional functionalities provided by OpenZeppelin libraries.

Private Variables

  • _nextTokenId: Private variable to keep track of the next token ID to be minted.
  • _mintedSuccessfully: Mapping to track addresses that have successfully minted tokens.

Constructor

The constructor initializes the contract with the given initialOwner address. It sets up configurations for ERC721, Ownable, and EIP712, providing a solid foundation for the contract's functionality.

Pausing/Unpausing

  • pause(): Function to pause the contract, accessible only by the owner.
  • unpause(): Function to unpause the contract, accessible only by the owner.

Minting

  • safeMint(address to, string memory uri): Function to safely mint a new token for the specified address (to). It generates a new token ID, mints the token, sets its URI, and marks the address as successfully minted.

Checking Minting Status

  • hasMintedSuccessfully(address account): Function to check if a specific address has successfully minted a token.
  • getAllMintedSuccessfully(): Function to get an array of addresses that have successfully minted tokens.

Overrides

The contract includes overrides for functions like _update(), _increaseBalance(), tokenURI(), and supportsInterface() due to inheritance from various ERC721-related contracts. These overrides ensure compliance with ERC721 standards and seamlessly incorporate additional functionalities.

Overall Summary

The MyNft contract provides a comprehensive ERC721 implementation with additional features for pausing, burning, and tracking successful minting. Its design allows for flexibility and compatibility with various use cases in the NFT space, making it a versatile and robust token contract. The contract can be easily integrated into external systems, providing a powerful foundation for NFT-related applications.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.