EIPs Explained

ERC-7832 · Review · ERC · 2024-12-04

ERC-7832: Sustainable collaborative NFT collections

An ERC-721 extension for collaborative NFT collections with paid creator roles, mint fees that fall as a creator mints more within a cycle, donations to creators, and admin terms that can only change at fixed intervals.

What problem does it solve?

Some NFT collections are built by many creators rather than one artist. Running them raises recurring issues: who may mint, how to price minting so a few accounts do not flood the supply, how supporters can fund creators directly, and how to stop an admin from changing fees whenever they like.

ERC-7832 bundles answers to these into one interface on top of ERC-721.

How it works

Roles. Three role identifiers: ADMIN_ROLE, CREATOR_ROLE and CONTRIBUTOR_ROLE. The deployer gets admin and creator in the constructor.

  • Anyone can become a creator by calling getCreatorSignature() and paying creatorSignatureFee.
  • Anyone (other than the creator) can donate(creator) ETH to a creator; the donor receives CONTRIBUTOR_ROLE and a DonationReceived event is emitted.

Minting. Only creators call safeMint(uri), paying mintFee():

  • Admins mint for free.
  • Otherwise the fee is mintBaseFee divided by a logarithm of how many times the caller has minted in the current cycle (log2 in the reference implementation), so repeat minting gets gradually cheaper.
  • When a creator exceeds maxMintsPerUserInCycle, their counter resets and the discount starts over.

Stable terms. The admin sets mintBaseFee, creatorSignatureFee and maxMintsPerUserInCycle through updateTerms, first in the constructor and then at most once per UPDATE_INTERVAL. The spec recommends at least 720 hours (30 days). Each change emits CreatorTermsUpdated.

Admin controls. pause/unpause, and withdraw(amount) for funds held by the contract. Token owners can burn their own tokens.

Sample code

Core of the interface (abridged from the spec):

// 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;
}

Fee calculation from the reference implementation (OpenZeppelin Math.log2):

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;
}

Things to know

  • Status is Review, so details may still change.
  • Integer log2 rounds down: with 2 or 3 prior mints the divisor is 1, so the first real discount appears at 4 mints (half price).
  • The "creator signature" is a paid role grant, not a cryptographic signature.
  • Mint and creator fees are paid to the contract, and the admin can withdraw ETH from it, so the admin is a trusted party. The spec does not detail how donated ETH reaches the creator; check the implementation.
  • The spec recommends reentrancy protection on safeMint, withdraw and donate.

#nft #erc-721 #creators #fees #governance

Details

Authors
Gustavo Lobo (@gflobo)
Status
Review
Type
Standards Track / ERC
Created
2024-12-04
Requires

Machine-readable: Markdown · JSON