ERC-7832 A sustainable collaborative NFT collection (Sustainable collaborative NFT collections)
Review · NFTs & multi-token · created 2024-12-04
A standard that adds dynamic minting fees, role-based permissions, and a donation participation model to an ERC-721-based collaborative NFT collection, so that creators and communities can operate it in an economically sustainable way.
Why it is needed
As the NFT market has grown, the same problems keep recurring: ever-increasing supply causes inflation, and there is no mechanism for meaningfully engaging the community. When minting fees are fixed, a small number of holders can hoard tokens, leading to concentrated ownership, and creators have no sustainable way to receive community support. Also, if administrators can change core terms such as fees at any time, market stability is undermined and participants lose trust. This standard aims to address these problems by introducing role-based access control, dynamic minting fees that vary with user activity, and a donation model for supporting creators directly, while only allowing changes to operating terms at fixed time intervals.
What to implement
event DonationReceived(address from, address to, uint256 amount);: An event that records the sender address, recipient address, and amount when a user donates ETH to a creator.function currentTokenId() external view returns (uint256);: Returns the current token ID. It can also be used to gauge the number of tokens minted so far.function mintBaseFee() external view returns (uint256);: Returns the base minting fee a user pays when creating a new token.function creatorSignatureFee() external view returns (uint256);: Returns the fee required to obtain the creator signature and become a creator.function maxMintsPerUserInCycle() external view returns (uint256);: Returns the maximum number of times a user can mint within a gradual-discount cycle. If the limit is exceeded, the count resets to 0.function lastUpdateTimestamp() external view returns (uint256);: Returns the time the contract terms were last updated. Used to determine when the next update is allowed.function UPDATE_INTERVAL() external pure returns (uint256);: Returns the time interval that must elapse before the contract terms can be changed again.function getCreatorSignature() external payable;: Pays the set fee to obtain the creator signature. After payment, the caller receives CREATOR_ROLE.function CONTRIBUTOR_ROLE() external pure returns (bytes32);: Returns the identifier for the contributor role.function CREATOR_ROLE() external pure returns (bytes32);: Returns the identifier for the creator role.function ADMIN_ROLE() external pure returns (bytes32);: Returns the identifier for the admin role.function mintsPerUserInCycle(address user) external view returns (uint256);: Returns the number of times the given user has minted in the current discount cycle. Used to enforce the per-user minting limit.function donate(address creator) external payable;: Donates ETH to a specific creator. After donating, the donor receives CONTRIBUTOR_ROLE.function mintFee() external view returns (uint256);: Calculates and returns the minting fee the caller must currently pay, based on the number of mints in the cycle.function burn(uint256 tokenId) external;: Lets a token owner burn their own token.function pause() external;: Lets an admin pause the contract, disabling certain functions.function unpause() external;: Lets an admin unpause the contract, re-enabling functions.function safeMint(string memory uri) external payable;: Lets a caller holding CREATOR_ROLE pay the fee and mint a new token to their own address with the specified URI.function updateTerms( uint256 mintBaseFee, uint256 creatorSignatureFee, uint256 maxMintsPerUserInCycle ) external;: Lets an admin update the base minting fee, the creator signature fee, and the maximum number of mints per cycle.function withdraw(uint256 amount) external;: Lets an admin withdraw the ETH accumulated in the contract.
In depth
Three roles and access control
The system defines three role identifiers (bytes32): ADMIN_ROLE, CREATOR_ROLE, and CONTRIBUTOR_ROLE. ADMIN_ROLE and CREATOR_ROLE must be granted to msg.sender in the constructor. The admin is responsible for updating terms (updateTerms), pausing and unpausing (pause, unpause), and withdrawing funds (withdraw), while the creator mints tokens via safeMint and receives donations. The contributor role is granted to users who donate via donate. Role-based access control ensures only trusted parties can execute sensitive functions, preventing arbitrary changes from undermining market stability and trust.
Dynamic minting fee formula
mintFee calculates the fee the caller must pay. If the caller has ADMIN_ROLE, the fee is 0; if the number of mints in the cycle (userMints) is 1 or less, the fee is mintBaseFee as is; if greater than 1, the fee is mintBaseFee divided by the logarithm of userMints. It is RECOMMENDED that the fee decrease gradually on a logarithmic basis, and since Solidity cannot handle decimals, the logarithm value is always rounded to an integer. The reference implementation uses Math.log2 as the divisor. The caller of safeMint must pay this fee.
Minting cycles and limit resets
mintsPerUserInCycle(address user) tracks the number of times a user has minted in the current gradual-discount cycle, and maxMintsPerUserInCycle sets the maximum number of mints per cycle. If the limit is exceeded in safeMint, that user's mint count SHALL reset to 0. Since the discount is structured around the number of mints, the reset serves as a mechanism to restart the discount cycle from the beginning. safeMint can only be called by CREATOR_ROLE, and it is recommended that it require the contract not be paused.
Term update restrictions and UPDATE_INTERVAL
updateTerms can only be called by the admin to update mintBaseFee, creatorSignatureFee, and maxMintsPerUserInCycle, and must emit a CreatorTermsUpdated event after updating. It must be called once as the first update in the contract constructor, and afterward UPDATE_INTERVAL must elapse, measured from lastUpdateTimestamp, before it can be called again. UPDATE_INTERVAL is recommended to be set in units of time, with a minimum of 720 hours (30 days). This restriction, which prevents excessive administrator intervention and protects price discovery and participant trust, is the core of 'economic sustainability'.
Creator signature and donation rules
getCreatorSignature is a function that SHALL grant the CREATOR_ROLE when the caller pays creatorSignatureFee, and it is recommended to require that the contract not be paused. donate can only donate to a valid address holding the CREATOR_ROLE, cannot donate to oneself, and the amount must be greater than 0. After processing, it must emit a DonationReceived event, and the donor receives the CONTRIBUTOR_ROLE. The original Rationale explains that this donation record can be used to grant benefits in later transactions.
Burning, pausing, withdrawal
burn(tokenId) can only be called by the owner of the token. pause and unpause SHOULD only be called by ADMIN_ROLE to block or re-enable contract functions in an emergency. withdraw(amount) can only be called by ADMIN_ROLE to withdraw ETH from the contract. This standard is fully compatible with ERC-721, and extensions like dynamic fees and donations are modular, so they do not affect existing NFT functionality.
Proposal status
This proposal is currently in Review status. Keep in mind that since it is still under review, the specification may change.
Things to watch out for
- Reentrancy Protection: The safeMint, withdraw, and donate functions are recommended to be protected against reentrancy attacks.
- Paused state: Administrators MUST be able to pause the contract in an emergency to block unwanted operations and reduce risk.
- Burn security: Allowing only the token owner to burn reduces the risk of malicious contracts or unauthorized users destroying someone else's token, and prevents token destruction from mistakes or abuse.