Skip to content
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 6 commits into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions ERCS/erc-7538.md
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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
This EIP extends [ERC-1046](./erc-1046.md)-compatible token types (notably, [ERC-20](./erc-20.md) and [ERC-1155](./erc-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`:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `MultiplierMetadata` interface MUST be implemented in the resolved ERC-1046 `tokenURI` of tokens that use a `multiplier`:
The `MultiplierMetadata` interface MUST be implemented in the resolved [ERC-1046](./erc-1046.md) `tokenURI` of tokens that use a `multiplier`:


```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).
Loading