Skip to content

Latest commit

 

History

History
94 lines (73 loc) · 3.57 KB

mep-721.md

File metadata and controls

94 lines (73 loc) · 3.57 KB
  MEP: 721
  Title: MEP-721 Non-Fungible Token Standard on MXC zkEVM Chain
  Status: Living
  Type: Standards
  Created: 2023-04-19

MEP-721: Non-Fungible Token Standard on MXC zkEVM Chain

Abstract

The MEP721 token standard defines a non-fungible token (NFT) interface for representing ownership of unique assets. It provides basic functionality to manage the ownership, transfer, and approval of NFTs. This standard allows for interoperability between different applications and platforms that support MEP721-compliant tokens.

Motivation

The motivation behind the MEP721 standard for MXC Chain is to improve brand influence and establish a recognizable identity. By introducing MEP721, MXC aims to create a distinct brand representation aligned with its core values and vision, thus enhancing brand impact and recognition within the blockchain industry.

Specification

MEP-721 Interface

interface IMEP721 is IERC165 {
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    function balanceOf(address owner) external view returns (uint256 balance);
    function ownerOf(uint256 tokenId) external view returns (address owner);
    function safeTransferFrom(address from, address to, uint256 tokenId) external;
    function transferFrom(address from, address to, uint256 tokenId) external;
    function approve(address to, uint256 tokenId) external;
    function getApproved(uint256 tokenId) external view returns (address operator);
    function setApprovalForAll(address operator, bool approved) external;
}

MEP-721 Metadata Extension Interface

interface IMEP721Metadata is IMEP721 {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

MEP-721 Receiver Interface

interface IMEP721Receiver {
    function onMEP721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}

MEP721 Metadata JSON Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "MEP721 Metadata JSON Schema",
    "type": "object",
    "properties": {
        "name": {
            "type": "string",
            "description": "The name of the token."
        },
        "description": {
            "type": "string",
            "description": "A description of the token."
        },
        "image": {
            "type": "string",
            "format": "uri",
            "description": "A URI pointing to an image representing the token."
        }
    },
    "required": ["name", "description", "image"]
}

Rationale

The MEP721 standard is designed to provide a common set of functions and events for managing non-fungible tokens. It includes interfaces for basic token ownership, transfer, and approval, as well as metadata retrieval. The inclusion of the MEP-721 receiver interface allows for secure and reliable handling of token transfers to smart contracts.

Backwards Compatibility

The MEP721 standard is backward compatible with the ERC-721 standard. Existing ERC-721 contracts and tokens can be easily adapted to be MEP721 compliant by implementing the required functions and events.

References