---
eip: 4931
label: ERC-4931
title: Generic Token Upgrade Standard
status: Stagnant
type: Standards Track
category: ERC
created: 2021-11-02
requires: 20
official: https://eips.ethereum.org/EIPS/eip-4931
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-4931.md
canonical: https://eips.huatuo.xyz/eip-4931/
lang: en
tldr: A standard interface for migrating holders from an old ERC-20 contract to a new one at a fixed ratio, so wallets and exchanges can run any token upgrade the same way.
tags: [erc-20, migration, upgrade, token, exchanges]
---

# ERC-4931: Generic Token Upgrade Standard

> Create a standard interface for upgrading ERC20 token contracts.

**TL;DR:** A standard interface for migrating holders from an old ERC-20 contract to a new one at a fixed ratio, so wallets and exchanges can run any token upgrade the same way.

## What problem does it solve?

When a project replaces its [ERC-20](/eip-20/) contract (a bug fix, a rebrand, a token split or merge), every holder has to swap old tokens for new ones. Each project builds its own migration contract and UI, so exchanges and custodians must review and script every migration from scratch, and users have to trust a bespoke interface.

ERC-4931 standardizes the migration contract itself. Once an exchange or wallet supports the interface, it can process any compliant token upgrade with the same code, and auditors know what behavior to expect.

## How it works

A separate *upgrade contract* sits between the **source** (old) token and the **destination** (new) token:

| Function | Purpose |
| --- | --- |
| `upgradeSource()` / `upgradeDestination()` | Addresses of the old and new tokens |
| `ratio()` | `(numerator, denominator)`: destination tokens per source token, e.g. `(3, 1)` |
| `isUpgradeActive()` | Whether upgrades are currently being served |
| `computeUpgrade(sourceAmount)` | Preview: destination amount and leftover source remainder |
| `upgrade(to, sourceAmount)` | Pull approved source tokens, send destination tokens to `to` |
| `totalUpgraded()` | Total source tokens upgraded so far |

Flow for a holder: `approve` the upgrade contract on the old token, then call `upgrade`. The source tokens are **burned or locked** in the upgrade contract. If the ratio would leave a fractional amount, only the whole convertible part is upgraded and the remainder is returned to the caller. With a `(3, 2)` ratio, `computeUpgrade(5)` returns `(6, 1)`.

An **optional downgrade extension** (`isDowngradeActive`, `computeDowngrade`, `downgrade`) lets holders convert back. If it is implemented, source tokens must be locked rather than burned so they can be released again, and `totalUpgraded` can then go down.

`Upgrade` and `Downgrade` events record each conversion.

## Sample code

Running an upgrade from a script (ethers v6):

```ts
import { Contract, Wallet, JsonRpcProvider } from "ethers";

const signer = new Wallet(process.env.PRIVATE_KEY!, new JsonRpcProvider(process.env.RPC_URL));
const upgrader = new Contract(UPGRADE_CONTRACT, [
  "function upgradeSource() view returns (address)",
  "function isUpgradeActive() view returns (bool)",
  "function computeUpgrade(uint256) view returns (uint256 destinationAmount, uint256 sourceRemainder)",
  "function upgrade(address to, uint256 sourceAmount)",
], signer);

const oldToken = new Contract(await upgrader.upgradeSource(), [
  "function balanceOf(address) view returns (uint256)",
  "function approve(address,uint256) returns (bool)",
], signer);

if (!(await upgrader.isUpgradeActive())) throw new Error("upgrade not active");

const amount: bigint = await oldToken.balanceOf(signer.address);
const [out, rest] = await upgrader.computeUpgrade(amount);
console.log(`will receive ${out}, ${rest} left over`);

await (await oldToken.approve(UPGRADE_CONTRACT, amount)).wait();
await (await upgrader.upgrade(signer.address, amount)).wait();
```

## Things to know

- Status: **Stagnant**. The interface is a reasonable template, but there is no ecosystem-wide expectation that migrations follow it.
- The upgrade contract must hold or be able to mint enough destination tokens; the spec does not cover how the new supply is provisioned.
- Burning versus locking is a real design choice: locking keeps the old supply recoverable (and enables downgrades), burning makes the migration one-way.
- Always preview with `computeUpgrade` so users see the remainder before rounding surprises them.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-4931
