---
eip: 6864
label: ERC-6864
title: Upgradable Fungible Token
status: Draft
type: Standards Track
category: ERC
created: 2023-04-05
requires: 20
official: https://eips.ethereum.org/EIPS/eip-6864
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6864.md
canonical: https://eips.huatuo.xyz/eip-6864/
lang: en
tldr: Draft ERC-20 extension that lets holders opt in to move balances from an existing token to a new upgraded token contract, and back, without proxies.
tags: [token, erc20, upgrade, migration, fungible]
---

# ERC-6864: Upgradable Fungible Token

> Upgradable fungible token, a simple extension to ERC-20

**TL;DR:** Draft ERC-20 extension that lets holders opt in to move balances from an existing token to a new upgraded token contract, and back, without proxies.

## What problem does it solve?

Token contracts are immutable. If an [ERC-20](/eip-20/) has a bug, lacks a feature or must meet new rules, the usual fix is a proxy, but that only works if the token was deployed behind a proxy from day one. Proxy upgrades are also silent and one-way: holders can't refuse them.

ERC-6864 defines a simple upgrade path that works for **any** existing ERC-20. A new contract (the "ERC-6864 token") wraps a *base* ERC-20. Holders choose to upgrade by depositing base tokens, and can downgrade again later. Because the new contract is itself an ERC-20, integrators only need to change the address.

## How it works

The interface extends `IERC20` with:

- **`baseToken()`**: address of the original ERC-20.
- **`upgrade(to, amount)`**: takes `amount` base tokens from the caller (who must have approved the new contract) and credits `to` with upgraded tokens. Emits `Upgrade`.
- **`downgrade(from, to, amount)`**: burns upgraded tokens from `from` (caller must be `from` or approved) and releases base tokens to `to`. Emits `Downgrade`.

The optional **see-through extension** adds `combinedTotalSupply`, `combinedBalanceOf` and `combinedAllowance`, which add up the base and upgraded amounts.

Notable design choices:

- **Reversible and nestable.** Downgrading lets users exit a buggy version or switch between several ERC-6864 contracts built on the same base, and an upgraded token can itself be a base.
- **Upgrade-while-transfer.** The reference implementation's `transfer` automatically upgrades any shortfall from the sender's base balance, and its `balanceOf` reports the combined balance.
- The conversion rate is up to the implementation (1:1, linear or non-linear).

Compared with [ERC-4931](/eip-4931/), which uses a separate bridge contract with pre-minted tokens, ERC-6864 mints just in time inside the token itself.

## Sample code

A 1:1 implementation built on OpenZeppelin (simplified from the reference, without auto-upgrade):

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

import {IERC20, ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract UpgradedToken is ERC20 {
    event Upgrade(address indexed from, address indexed to, uint256 amount);
    event Downgrade(address indexed from, address indexed to, uint256 amount);

    IERC20 public immutable baseToken;

    constructor(address base) ERC20("Token v2", "TKN2") { baseToken = IERC20(base); }

    function upgrade(address to, uint256 amount) external {
        require(to != address(0), "zero to");
        require(baseToken.transferFrom(msg.sender, address(this), amount), "transfer failed");
        _mint(to, amount);
        emit Upgrade(msg.sender, to, amount);
    }

    function downgrade(address from, address to, uint256 amount) external {
        require(to != address(0), "zero to");
        if (from != msg.sender) _spendAllowance(from, msg.sender, amount);
        _burn(from, amount);
        require(baseToken.transfer(to, amount), "transfer failed");
        emit Downgrade(from, to, amount);
    }
}
```

## Things to know

- **Status: Draft.** Interfaces may change, and the reference code in the spec contains typos, so don't copy it verbatim.
- Upgrading requires `approve` on the base token. Check the new contract and approve only what you intend to convert, since unlimited approvals combined with auto-upgrade in `transfer` remove that confirmation step.
- If `balanceOf` / `totalSupply` return combined values, dashboards and indexers can double-count or disagree, especially with several or nested wrappers.
- Non-linear conversion rates expose upgrades and downgrades to front-running and sandwich attacks, as with any AMM curve.


---

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