主页EIPs周刊
EIPsERC-7729
ERC-7729

Token with Metadata

An ERC-20 extension for tokens with metadata.
DraftStandards Track: ERC
创建时间: 2023-06-24
关联 EIP: EIP-20
msfew (@fewwwww)
社区讨论原文链接编辑
1 分钟了解
欢迎补充好内容
去提交
相关视频
欢迎补充好内容
去提交
正文

Abstract

This standard extends the ERC-20 standard to include a metadata function interface and a JSON schema for metadata.

Motivation

Memecoins have demonstrated the value of associating tokens with visual metadata. By standardizing a way to include metadata in ERC-20 tokens, developers can create more engaging and interactive tokens, fostering community engagement.

Specification

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.

Every compliant contract must implement the IERC7729, and ERC20 interfaces.

This standard includes the following interface:

pragma solidity ^0.8.0; interface IERC20Metadata is IERC20 { /// @dev Returns the metadata URI associated with the token. /// The URI may point to a JSON file that conforms to the "ERCX Metadata JSON Schema". function metadata() external view returns (string memory); }

This is the "ERC-7729 Metadata JSON Schema" referenced above.

{ "title": "Token Metadata", "type": "object", "properties": { "name": { "type": "string", "description": "Identifies the asset to which this token represents" }, "description": { "type": "string", "description": "Describes the asset to which this token represents" }, "image": { "type": "string", "description": "A URI pointing to a resource with mime type image/* representing the asset to which this token represents." } } }

Rationale

The metadata function was chosen based on existing implementations in standards and applications.

Backwards Compatibility

This standard is backward compatible with the ERC-20 as it extends the existing functionality with new interfaces.

Reference Implementation

pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; interface IERC7729 is IERC20 { function metadata() external view returns (string memory); } contract ERC7729 is ERC20, IERCX { string _metadata = "ipfs://QmakTsyRRmvihYwiAstYPYAeHBfaPYz3v9z2mkA1tYLA4w"; function metadata() external view returns (string memory) { return _metadata; } }

Security Considerations

The metadata URI could be manipulated to point to malicious content or phishing sites. Off-chain indexers should perform validation checks to ensure the security and integrity of the metadata URIs for users.

Copyright and related rights waived via CC0.

扩展阅读
欢迎补充好内容
去提交
相关项目
欢迎补充好内容
去提交

不想错过最新的 EIP 动态?

订阅 EIPs Fun 周刊以跟进相关更新,建⽴你与 EIP 之间的连接 ,更好地建设以太坊。

详情
支持以太坊贡献者,推动生态建设
资源
GitHub
支持社区