---
eip: 7196
label: ERC-7196
title: Simple token, Simplified ERC-20
status: Draft
type: Standards Track
category: ERC
created: 2023-06-21
requires: 20
official: https://eips.ethereum.org/EIPS/eip-7196
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7196.md
canonical: https://eips.huatuo.xyz/zh/eip-7196/
lang: zh
tldr: 一种精简的同质化代币接口，只保留 totalSupply、balanceOf 和 transfer，把授权和代理支出交给智能合约钱包处理。
tags: [token, fungible, account-abstraction, wallet]
---

# ERC-7196: Simple token, Simplified ERC-20

> Designed for smart contract wallets, this removes the transferFrom, approve, and allowance functions from ERC-20 tokens.

**TL;DR:** 一种精简的同质化代币接口，只保留 totalSupply、balanceOf 和 transfer，把授权和代理支出交给智能合约钱包处理。

## 它解决什么问题？

[ERC-20](/eip-20/) 是在外部拥有账户（EOA）的时代设计的，EOA 没有代码也没有存储。由于 EOA 无法自行执行规则，ERC-20 把权限逻辑放进了代币内部：`approve`、`allowance` 和 `transferFrom` 让第三方可以花费你的代币。这种模式是无限授权和 allowance 竞态条件等常见问题的根源。

智能合约钱包（包括 [ERC-4337](/eip-4337/) 账户这类账户抽象钱包）可以拥有自己的状态和逻辑。ERC-7196 的作者认为，一旦钱包可编程，代币就完全不需要再管理权限了。代币只做一件事，即转移余额，而由钱包来决定谁可以触发一笔支付。

## 它如何运作

符合规范的代币只实现：

| 成员 | 用途 |
| --- | --- |
| `totalSupply()` | 代币总量 |
| `balanceOf(owner)` | 某个地址的余额 |
| `transfer(to, value)` | 从调用者向 `to` 转移代币，返回 `bool` |
| `event Transfer` | 与 ERC-20 事件签名相同 |

`approve`、`allowance`、`transferFrom` 和 `Approval` 事件被移除。如果 dapp 想从用户那里划转资金，则应调用用户的钱包合约，由它检查自己的规则，然后对代币调用 `transfer`。

由于这三个函数和事件是 ERC-20 的严格子集，每个 ERC-20 代币都已经满足这个接口。反过来则不成立：只实现 ERC-7196 的代币无法与依赖 `approve` + `transferFrom` 的协议配合使用。

## 示例代码

一个最小的 ERC-7196 代币（仅作演示，没有铸造控制）：

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

interface IERC7196 {
    event Transfer(address indexed from, address indexed to, uint256 value);
    function totalSupply() external view returns (uint256);
    function balanceOf(address owner) external view returns (uint256);
    function transfer(address to, uint256 value) external returns (bool);
}

contract SimpleToken is IERC7196 {
    uint256 public totalSupply;
    mapping(address => uint256) public balanceOf;

    constructor(uint256 supply) {
        totalSupply = supply;
        balanceOf[msg.sender] = supply;
        emit Transfer(address(0), msg.sender, supply);
    }

    function transfer(address to, uint256 value) external returns (bool) {
        require(to != address(0), "zero address");
        require(balanceOf[msg.sender] >= value, "balance");
        balanceOf[msg.sender] -= value;
        balanceOf[to] += value;
        emit Transfer(msg.sender, to, value);
        return true;
    }
}
```

想让商家向其收款的钱包，会公开自己的函数（可按自己的选择设置支出限额），并以 `token.transfer(merchant, amount)` 结尾。

## 需要注意

- 状态为 **Draft**；接口仍可能改变。
- 该模型只有在付款方是智能合约钱包时才可行。普通 EOA 没有地方存放"谁可以花我的代币"，因此只能主动推送付款。
- 现有的 DEX、借贷市场和许多其他协议都依赖 `transferFrom`。正如规范自身所指出的，只实现 ERC-7196 的代币与它们不兼容。
- [ERC-2612](/eip-2612/) 的 `permit` 等无 gas 授权方案解决了类似的用户体验问题，但仍停留在 ERC-20 的 allowance 模型之内。


---

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