---
eip: 8063
label: ERC-8063
title: Groups - Membership Tokens
status: Final
type: Standards Track
category: ERC
created: 2025-10-28
requires: 20, 165
official: https://eips.ethereum.org/EIPS/eip-8063
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8063.md
canonical: https://eips.huatuo.xyz/zh/eip-8063/
lang: zh
tldr: "将\"Group\"定义为一种普通的 ERC-20 代币，其余额代表成员等级，这样分级访问（会员、白银、黄金）可以配合任何现有钱包或浏览器使用，并可选用 isMember 辅助函数。"
tags: [token, membership, access-control, erc-20, dao]
---

# ERC-8063: Groups - Membership Tokens

> ERC-20 tokens representing group membership with threshold-based access control.

**TL;DR:** 将"Group"定义为一种普通的 ERC-20 代币，其余额代表成员等级，这样分级访问（会员、白银、黄金）可以配合任何现有钱包或浏览器使用，并可选用 isMember 辅助函数。

## 它解决什么问题？

DAO、忠诚度计划、受限功能和合作伙伴网络都需要同一样东西：一个可寻址的账户群组，通常还带有等级。每次都自己构建会员合约，意味着需要新的工具、新的钱包支持和新的索引器。

ERC-8063 观察到，[ERC-20](/eip-20/) 的余额本身就能表达这一点。零个代币表示不是成员，正余额表示是成员，更大的余额可以解锁更高的等级。通过把这种解读标准化，任何 ERC-20 代币都可以充当群组，并立即适用于钱包、浏览器和 DEX。

## 它如何运作

- 合规的 Group **必须**实现 ERC-20 和 [ERC-165](/eip-165/)。
- 成员语义：
  - `balanceOf(account) == 0` → 不是成员
  - `balanceOf(account) > 0` → 是成员
  - `balanceOf(account) >= threshold` → 达到该等级
- 阈值由使用该群组的应用定义，而不是由代币定义。
- 可选接口增加了 `isMember(account, threshold)`，它必须恰好返回 `balanceOf(account) >= threshold`（因此阈值为 0 时始终为 true）。
- 群组的身份就是其合约地址。铸造和销毁交由实现自行决定：固定供应、治理铸造、开放铸造，或 [ERC-5679](/eip-5679/) 风格的铸造函数都是允许的。
- 可选扩展：通过 [ERC-173](/eip-173/) 实现单一所有者控制，或将余额上限设为 1 以实现严格的二元成员制。

## 示例代码

可选接口，以及把余额映射到等级的使用方合约：

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

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

interface IERC8063 {
    function isMember(address account, uint256 threshold) external view returns (bool);
}

contract TierGate {
    IERC20 public immutable group;
    uint256 public constant SILVER = 500e18;
    uint256 public constant GOLD = 1000e18;

    constructor(IERC20 _group) { group = _group; }

    function tier(address user) external view returns (string memory) {
        uint256 bal = group.balanceOf(user);
        if (bal >= GOLD) return "gold";
        if (bal >= SILVER) return "silver";
        if (bal > 0) return "member";
        return "none";
    }
}
```

## 需要注意

- 状态为 **Final**。
- 由于成员资格就是余额，它是可转让、可交易的。如果这不是你想要的，请限制转账或把余额上限设为 1。
- 余额检查只发生在某一时刻。用户可以借入或购买代币通过门槛，然后再还回去；对于投票或高价值的访问权限，请使用快照或时间加权余额，而不是实时的 `balanceOf`。
- 阈值必须考虑 `decimals()`，标准的 ERC-20 授权风险同样适用：被授权的 spender 可以转走某人的成员资格。


---

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