-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ERC: Multiplicative Tokens #50
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4f8cb6d
Add EIP: Multiplicative Tokens
Pandapip1 fecdb9a
Merge branch 'master' into Pandapip1-eip-multiplicative-tokens
Pandapip1 fdb3468
Merge branch 'master' into Pandapip1-eip-multiplicative-tokens
SamWilsn 284d081
Merge branch 'master' into Pandapip1-eip-multiplicative-tokens
Pandapip1 0acee28
Merge branch 'master' into Pandapip1-eip-multiplicative-tokens
Pandapip1 1e663dc
Merge branch 'master' into Pandapip1-eip-multiplicative-tokens
Pandapip1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,60 @@ | ||||||
--- | ||||||
eip: 7538 | ||||||
title: Multiplicative Tokens | ||||||
description: Incorporates a multiplier field to ERC-20 and ERC-1155 for fractional token values | ||||||
author: Gavin John (@Pandapip1) | ||||||
discussions-to: https://ethereum-magicians.org/t/multiplicative-tokens/16149 | ||||||
status: Draft | ||||||
type: Standards Track | ||||||
category: ERC | ||||||
created: 2023-10-18 | ||||||
requires: 20, 1046, 1155 | ||||||
--- | ||||||
|
||||||
## Abstract | ||||||
|
||||||
This EIP extends [ERC-1046](./eip-1046.md)-compatible token types (notably, [ERC-20](./eip-20.md) and [ERC-1155](./eip-1155.md) 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`: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
```typescript | ||||||
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 | ||||||
|
||||||
Copyright and related rights waived via [CC0](../LICENSE.md). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.