---
eip: 8054
label: ERC-8054
title: Forkable ERC-20 Token
status: Draft
type: Standards Track
category: ERC
created: 2025-10-10
requires: 20
official: https://eips.ethereum.org/EIPS/eip-8054
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8054.md
canonical: https://eips.huatuo.xyz/zh/eip-8054/
lang: zh
tldr: 一种处于草案阶段的 ERC-20 扩展，对每次余额变动设置检查点，使新代币可以从任何过去的检查点分叉，让每位持有者立即获得继承的余额，无需空投转账，也无需 Merkle 领取。
tags: [token, erc-20, airdrop, checkpoints, migration]
---

# ERC-8054: Forkable ERC-20 Token

> Checkpoint-based ERC-20 tokens that can be efficiently forked to distribute new tokens to existing holders.

**TL;DR:** 一种处于草案阶段的 ERC-20 扩展，对每次余额变动设置检查点，使新代币可以从任何过去的检查点分叉，让每位持有者立即获得继承的余额，无需空投转账，也无需 Merkle 领取。

## 它解决什么问题？

如今，把新代币分发给现有 [ERC-20](/eip-20/) 的持有者相当麻烦：

- **通过转账空投**：部署者在链下做快照，并支付 gas 向每位持有者发送代币。
- **Merkle 领取**：对部署者来说更便宜，但每位持有者都必须找到证明并支付 gas 来领取，而且快照是在链下构建的，可能混入错误或被操纵。

ERC-8054 让代币在链上记录自己的历史，这样新代币只需从选定的时间点*继承*余额即可。用例包括空投、代币迁移、治理衍生品、奖励计划，以及把收益或风险从金库份额中拆分出来。

## 它如何运作

**可分叉（源）代币。** 带有元数据的 ERC-20，同时实现 `IERC20Checkpointed`：

- 每次状态变化（转账、铸造、销毁）都会为受影响的余额和总供应量新增一个检查点。
- 检查点由单调递增的 `uint48` **nonce** 标识，而不是区块号或时间戳。这样即使多笔交易落在同一个区块里，分叉点也不会含糊，避免了围绕基于区块的快照做重排序的把戏。
- `balanceOfAt(account, nonce)`、`totalSupplyAt(nonce)` 和 `checkpointNonce()` 用于读取历史；查询未来的 nonce 会以 `ERC20FutureCheckpoint` 回滚。

**分叉出的代币。** 使用 `name`、`symbol`、`checkpointedNonce` 和 `checkpointedToken` 创建的全新 ERC-20：

- `decimals` 必须与源代币相同。
- 初始 `totalSupply` 等于 `totalSupplyAt(nonce)`，每个账户的初始余额等于 `balanceOfAt(account, nonce)`。
- 余额是**惰性**加载的：在某个账户接触分叉代币之前，`balanceOf` 读取的是源代币在分叉 nonce 时的余额；该账户第一次发生状态变更之后，使用分叉自己的记录。
- 授权额度（allowance）和 permit nonce 不会被继承。分叉出的代币本身也可以设置检查点，从而实现分叉的分叉。

## 示例代码

展示惰性余额继承的简化分叉代币：

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

interface IERC20Checkpointed {
    function totalSupplyAt(uint48 checkpoint) external view returns (uint256);
    function balanceOfAt(address account, uint48 checkpoint) external view returns (uint256);
    function checkpointNonce() external view returns (uint48);
    function decimals() external view returns (uint8);
}

contract ForkedToken {
    event Transfer(address indexed from, address indexed to, uint256 value);

    IERC20Checkpointed public immutable source;
    uint48 public immutable forkNonce;
    string public name;
    string public symbol;
    uint8 public immutable decimals;
    uint256 public totalSupply;

    mapping(address => uint256) private _balance;
    mapping(address => bool) private _touched;

    constructor(string memory n, string memory s, uint48 nonce, IERC20Checkpointed src) {
        require(nonce <= src.checkpointNonce(), "future checkpoint");
        (name, symbol, forkNonce, source) = (n, s, nonce, src);
        decimals = src.decimals();
        totalSupply = src.totalSupplyAt(nonce);
    }

    function balanceOf(address a) public view returns (uint256) {
        return _touched[a] ? _balance[a] : source.balanceOfAt(a, forkNonce);
    }

    function _load(address a) internal {
        if (!_touched[a]) { _balance[a] = source.balanceOfAt(a, forkNonce); _touched[a] = true; }
    }

    function transfer(address to, uint256 v) external returns (bool) {
        _load(msg.sender); _load(to);
        require(_balance[msg.sender] >= v, "balance");
        _balance[msg.sender] -= v;
        _balance[to] += v;
        emit Transfer(msg.sender, to, v);
        return true;
    }
    // approve / transferFrom omitted for brevity
}
```

## 需要注意

- **状态：Draft。**
- 只有一开始就实现了检查点的代币才能按照此标准分叉；对普通 ERC-20 进行分叉不在范围之内。
- 对每次变更都设置检查点会让源代币上的转账成本更高。作者认为，当可分叉性有价值时，这是可以接受的。
- 重基（rebasing）代币和转账收费代币可能无法正确分叉；请先审查源代币的机制。
- 授权在分叉后会重置为零，并且只跟踪 `Transfer` 事件的钱包或索引器看不到继承的余额，除非实现另有额外处理；它们需要调用 `balanceOf`。
- 可与 [ERC-5805](/eip-5805/) 基于检查点的投票代币对比，后者按时钟而不是按每次变更的 nonce 记录历史投票权。


---

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