主页EIPs
EIPsERC-7538
ERC-7538

Multiplicative Tokens

Incorporates a multiplier field to ERC-20 and ERC-1155 for fractional token values
DraftStandards Track: ERC
创建时间: 2023-10-18
关联 EIP: EIP-20, EIP-1046, EIP-1155
Gavin John (@Pandapip1)
社区讨论原文链接编辑
1 分钟了解
欢迎补充好内容
去提交
相关视频
欢迎补充好内容
去提交
正文

Abstract

This EIP extends ERC-1046-compatible token types (notably, ERC-20 and ERC-1155 by introducing a multiplier field to the metadata schema, altering how user-facing balances are displayed.

Motivation

Many projects necessitate the creation of various types of tokens, both fungible and non-fungible. While certain standards are ideal for this purpose, they lack support for fractional tokens. Additionally, some tokens may require built-in inflation or deflation mechanisms, or may wish to allow transfers in unconventional increments, such as 0.5.

Specification

The key words "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.

The MultiplierMetadata interface MUST be implemented in the resolved ERC-1046 tokenURI of tokens that use a multiplier:

interface MultiplierMetadata { /** * The positive multiplier for generating user-facing representation. * Defaults to 1 if undefined. * This is an EXACT VALUE, base 10. Beware of floating-point error! **/ multiplier: string | undefined; /** * Decimals are no longer supported **/ decimals: never; }

Token contracts MUST NOT have a method named decimals if a multiplier is used.

Rationale

Employing strings for numerical representation offers enhanced precision when needed. The use of a multiplier instead of decimals facilitates increments other than powers of 10, and ensures seamless handling of inflation or deflation. Utilizing ERC-1046 promotes gas efficiency in the majority of cases.

Backwards Compatibility

This EIP is incompatible with any method named decimals in ERC-1046-compatible token standards or the ERC-1046 decimals field.

Security Considerations

Improper handling of the multiplier field may lead to rounding errors, potentially exploitable by malicious actors. Contracts MUST process multipliers accurately to avoid such issues. The multiplier MUST be positive (‘0’ is not positive) to avert display issues. Particularly large or small multipliers MAY pose display challenges, yet wallets SHOULD endeavor to display the full number without causing UI/UX or additional security issues.

Copyright and related rights waived via CC0.

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

不想错过最新的 EIP 动态?

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

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