---
eip: 7832
label: ERC-7832
title: Sustainable collaborative NFT collections
status: Review
type: Standards Track
category: ERC
created: 2024-12-04
requires: 721
official: https://eips.ethereum.org/EIPS/eip-7832
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7832.md
canonical: https://eips.huatuo.xyz/zh/eip-7832/
lang: zh
tldr: 面向协作式 NFT 系列的 ERC-721 扩展：付费的创作者角色、在一个周期内铸造越多则铸造费越低、向创作者捐赠，以及只能按固定间隔修改的管理员条款。
tags: [nft, erc-721, creators, fees, governance]
---

# ERC-7832: Sustainable collaborative NFT collections

> Economically sustainable collaborative NFT collections with dynamic fees and donation-based engagement.

**TL;DR:** 面向协作式 NFT 系列的 ERC-721 扩展：付费的创作者角色、在一个周期内铸造越多则铸造费越低、向创作者捐赠，以及只能按固定间隔修改的管理员条款。

## 它解决什么问题？

有些 NFT 系列是由许多创作者而不是一位艺术家共同打造的。运营这类系列会反复遇到一些问题：谁可以铸造，如何给铸造定价以免少数账户淹没供应，支持者如何直接资助创作者，以及如何防止管理员随时修改费用。

ERC-7832 在 [ERC-721](/eip-721/) 之上，把这些问题的答案打包进一个接口。

## 它如何运作

**角色。** 三个角色标识：`ADMIN_ROLE`、`CREATOR_ROLE` 和 `CONTRIBUTOR_ROLE`。部署者在构造函数中获得管理员和创作者角色。

- 任何人都可以通过调用 `getCreatorSignature()` 并支付 `creatorSignatureFee` 成为创作者。
- 任何人（创作者本人除外）都可以向某位创作者 `donate(creator)` ETH；捐赠者获得 `CONTRIBUTOR_ROLE`，并触发 `DonationReceived` 事件。

**铸造。** 只有创作者调用 `safeMint(uri)`，并支付 `mintFee()`：

- 管理员免费铸造。
- 否则，费用是 `mintBaseFee` 除以调用者在当前周期内已铸造次数的对数（参考实现中为 log2），因此重复铸造会逐渐变便宜。
- 当创作者超过 `maxMintsPerUserInCycle` 时，其计数器重置，折扣重新开始。

**稳定的条款。** 管理员通过 `updateTerms` 设置 `mintBaseFee`、`creatorSignatureFee` 和 `maxMintsPerUserInCycle`，先在构造函数中设置，之后每个 `UPDATE_INTERVAL` 最多一次。规范建议至少 720 小时（30 天）。每次修改都会触发 `CreatorTermsUpdated`。

**管理员控制。** `pause`/`unpause`，以及用于提取合约所持资金的 `withdraw(amount)`。代币所有者可以 `burn` 自己的代币。

## 示例代码

接口的核心部分（摘自规范）：

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

import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";

interface IERC7832 is IERC721 {
    event CreatorTermsUpdated(uint256 mintBaseFee, uint256 creatorSignatureFee, uint256 maxMintsPerUserInCycle);
    event DonationReceived(address from, address to, uint256 amount);

    function mintBaseFee() external view returns (uint256);
    function creatorSignatureFee() external view returns (uint256);
    function maxMintsPerUserInCycle() external view returns (uint256);
    function mintsPerUserInCycle(address user) external view returns (uint256);
    function mintFee() external view returns (uint256);
    function UPDATE_INTERVAL() external pure returns (uint256);

    function getCreatorSignature() external payable;
    function safeMint(string memory uri) external payable;
    function donate(address creator) external payable;
    function updateTerms(uint256 mintBaseFee, uint256 creatorSignatureFee, uint256 maxMintsPerUserInCycle) external;
    function withdraw(uint256 amount) external;
    function burn(uint256 tokenId) external;
    function pause() external;
    function unpause() external;
}
```

参考实现中的费用计算（OpenZeppelin `Math.log2`）：

```solidity
function mintFee() public view returns (uint256) {
    if (hasRole(ADMIN_ROLE, msg.sender)) return 0;
    uint256 userMints = mintsPerUserInCycle[msg.sender];
    uint256 divisor = userMints <= 1 ? 1 : Math.log2(userMints);
    return mintBaseFee / divisor;
}
```

## 需要注意

- 状态为 **Review**，因此细节仍可能改变。
- 整数 `log2` 向下取整：之前铸造 2 次或 3 次时除数为 1，所以第一次真正的折扣出现在第 4 次铸造（半价）。
- "创作者签名（creator signature）"是一种付费授予角色的方式，而不是密码学签名。
- 铸造费和创作者费都支付给合约，管理员可以从中 `withdraw` ETH，所以管理员是受信任的一方。规范没有详述捐赠的 ETH 如何到达创作者；请查看具体实现。
- 规范建议对 `safeMint`、`withdraw` 和 `donate` 做重入保护。


---

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