---
eip: 7837
label: ERC-7837
title: Diffusive Tokens
status: Final
type: Standards Track
category: ERC
created: 2024-12-07
official: https://eips.ethereum.org/EIPS/eip-7837
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7837.md
canonical: https://eips.huatuo.xyz/ja/eip-7837/
lang: ja
tldr: transfer が送信者のトークンを移す代わりに、受信者に新しいトークンをミントする代替可能トークン。トークンごとの ETH 手数料が発行者に支払われ、供給上限はオーナーが設定する。
tags: [token, fungible, minting, erc-20, fees]
---

# ERC-7837: Diffusive Tokens

> A fungible token that mints new tokens on transfer, charges a per-token native fee, and enforces a capped supply.

**TL;DR:** transfer が送信者のトークンを移す代わりに、受信者に新しいトークンをミントする代替可能トークン。トークンごとの ETH 手数料が発行者に支払われ、供給上限はオーナーが設定する。

## 何を解決するのか

[ERC-20](/eip-20/) トークンでは、総供給量は転送によって再分配されます。A が B に 10 トークン送ると、A の残高は 10 減ります。ERC-7837 は、**Diffusive Tokens（DIFF）** という別の経済モデルを記述します。発行者が、トークンをあらかじめミントして回すのではなく、需要に応じて広がるようにしたい場合を想定しています。

仕様の例は、製造業者が物理的な製品のロットに対してトークンを発行するケースです。各トークンは後でバーンして、製品 1 つと引き換えられます。保有者は、他の人に新しいトークンをミントすることでトークンを「引き継ぎ」、そのたびに発行者へ手数料を支払い、最大供給量に達するまで続きます。

## 仕組み

- **transfer がミントする。** `transfer(to, amount)` は送信者の残高を減らしません。`to` に `amount` の新しいトークンをミントし、`totalSupply` を増やします。
- **ネイティブ通貨の手数料。** 送信者は `msg.value` でチェーンのネイティブ通貨を `transferFee * amount` だけ支払う必要があり、そうでなければ呼び出しは revert します。手数料はコントラクトに蓄積されます。
- **供給上限。** `totalSupply` が `maxSupply` を超えることになる転送は revert します。
- **バーン。** 保有者は `burn(amount)` で自分の残高と総供給量を減らせます。たとえば裏付けとなる商品との引き換えに使います。
- **オーナーの権限。** オーナーは `setTransferFee`、`setMaxSupply`（現在の供給量を下回る値は不可）、`withdrawFees(recipient)` を実行できます。
- **任意の承認。** 互換性のために `approve`/`transferFrom` が用意されています。`transferFrom` は allowance を消費しますが、`from` の残高は減らさずに `to` へミントします。

イベント: `Transfer`、`Burn`、`FeeUpdated`、`MaxSupplyUpdated`。

`transfer` と `transferFrom` は `payable` で、動作も異なるため、DIFF が ERC-20 と互換なのはインターフェースのレベルだけで、動作は互換ではありません。

## サンプルコード

仕様のリファレンス実装から要点をまとめたコアロジック:

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

contract DiffusiveToken {
    uint256 public totalSupply;
    uint256 public maxSupply;
    uint256 public transferFee;          // wei per token
    address public owner;
    mapping(address => uint256) public balanceOf;

    event Transfer(address indexed from, address indexed to, uint256 amount);
    event Burn(address indexed burner, uint256 amount);

    constructor(uint256 _maxSupply, uint256 _fee) {
        maxSupply = _maxSupply;
        transferFee = _fee;
        owner = msg.sender;
    }

    function transfer(address to, uint256 amount) external payable returns (bool) {
        require(to != address(0) && amount > 0, "bad args");
        require(msg.value >= transferFee * amount, "insufficient fee");
        require(totalSupply + amount <= maxSupply, "cap");
        balanceOf[to] += amount;          // sender keeps their balance
        totalSupply += amount;
        emit Transfer(msg.sender, to, amount);
        return true;
    }

    function burn(uint256 amount) external {
        balanceOf[msg.sender] -= amount;  // reverts on underflow
        totalSupply -= amount;
        emit Burn(msg.sender, amount);
    }

    function withdrawFees(address payable to) external {
        require(msg.sender == owner, "owner");
        (bool ok, ) = to.call{value: address(this).balance}("");
        require(ok, "withdraw failed");
    }
}
```

## 知っておくべきこと

- ステータスは **Final** です。
- 自分の残高に関係なく、誰でも `transfer` を呼べます。仕様に書かれているとおり、他の人にミントするためにトークンを保有している必要はなく、制限は手数料と上限だけです。
- DEX、レンディングプロトコル、ウォレットは、ERC-20 の転送が供給量を保存することを前提としています。DIFF トークンをこれらと統合すると、価格、会計、残高が誤る可能性があり、`payable` な転送は、value を送らない呼び出し側では失敗します。
- オーナーは手数料をいつでも変更でき、上限も引き上げられます。これは保有者にとって重大な信頼の前提です。
- 仕様のリファレンスコントラクトは、そのままコピーするとバグがあります（たとえば、宣言されていない `balances` と `allowances` マッピングを読み取っています）。どの実装を使う場合も、レビューとテストを行ってください。


---

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