EIPs Explained

ERC-7538 · Draft · ERC · 2023-10-18

ERC-7538: Multiplicative Tokens

Replaces the decimals field with a base-10 string multiplier in ERC-1046 token metadata, so wallets can display fractional, non-power-of-ten or rebasing-style balances without changing the on-chain integer.

What problem does it solve?

On-chain token balances are integers. ERC-20 uses decimals to tell wallets where to put the decimal point, which only supports scaling by powers of ten. ERC-1155 tokens have no standard way to show fractional amounts at all.

Some projects want more flexible display: units that move in steps of 0.5, a scale factor that changes over time to model inflation or deflation, or fractional versions of multi-token assets. ERC-7538 gives them a single, general knob: a multiplier.

How it works

The proposal builds on ERC-1046, which lets ERC-20 and ERC-1155 tokens point to an off-chain JSON metadata document via tokenURI.

  • The resolved metadata may include a multiplier field, a string holding an exact base-10 positive number (for example "0.5" or "0.000001").
  • If multiplier is absent, it defaults to 1.
  • Wallets derive the user-facing amount from the raw integer balance using the multiplier, instead of using decimals.
  • Tokens that use a multiplier must not expose a decimals method, and the metadata must not contain decimals.

Because the value lives in metadata rather than contract storage, the issuer can change the displayed scale (for instance to reflect inflation) by updating the document, with no on-chain transaction for holders.

Strings are used instead of numbers so that very small or very large values keep full precision.

Sample code

ERC-1046 metadata for a token whose smallest unit should display as half a token:

{
  "interop": { "erc1046": true },
  "name": "Half Token",
  "symbol": "HALF",
  "multiplier": "0.5"
}

Wallet-side formatting without floating point (TypeScript):

// Exact decimal multiply: raw (bigint) × multiplier (decimal string)
function formatWithMultiplier(raw: bigint, multiplier = "1"): string {
  const [int, frac = ""] = multiplier.split(".");
  const scaled = raw * BigInt(int + frac);        // shift multiplier to an integer
  const s = scaled.toString().padStart(frac.length + 1, "0");
  if (frac.length === 0) return s;
  const head = s.slice(0, -frac.length);
  const tail = s.slice(-frac.length).replace(/0+$/, "");
  return tail ? `${head}.${tail}` : head;
}

formatWithMultiplier(3n, "0.5"); // "1.5"

Things to know

  • Status is Draft.
  • It is deliberately incompatible with decimals. Wallets and protocols that only understand ERC-20 decimals will show raw integers for these tokens.
  • The multiplier must be strictly positive; 0 is not allowed.
  • Do the maths with exact decimal or big-integer arithmetic. Floating-point rounding errors in display or conversion code can be exploited.
  • Very large or very small multipliers can be hard to display; wallets should still try to show the full number.

#token #metadata #display #fungible

Details

Authors
Gavin John (@Pandapip1)
Status
Draft
Type
Standards Track / ERC
Created
2023-10-18
Requires

Machine-readable: Markdown · JSON