-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ERC: Sustainable NFT Collections #752
Open
gfLobo
wants to merge
23
commits into
ethereum:master
Choose a base branch
from
gfLobo:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abcoathup
reviewed
Dec 5, 2024
abcoathup
reviewed
Dec 5, 2024
abcoathup
reviewed
Dec 5, 2024
abcoathup
reviewed
Dec 5, 2024
abcoathup
reviewed
Dec 5, 2024
Co-authored-by: Andrew B Coathup <[email protected]>
eip-review-bot
changed the title
Add ERC: Sustainable Collections
Add ERC: Sustainable NFT Collections
Dec 5, 2024
gfLobo
changed the title
Add ERC: Sustainable NFT Collections
Add ERC-7832: Sustainable NFT Collections
Dec 13, 2024
eip-review-bot
changed the title
Add ERC-7832: Sustainable NFT Collections
Add ERC: Sustainable NFT Collections
Dec 13, 2024
The commit 6d818df (as a parent of e158795) contains errors. |
RainbowScientist5
approved these changes
Dec 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
eip: 7832
title: Sustainable NFT Collections
description: Economically sustainable NFTs with dynamic fees and donation-based engagement.
author: Gustavo Lobo (@gfLobo)
discussions-to: https://ethereum-magicians.org/t/erc-7832-sustainable-nft-collections/22201
status: Draft
type: Standards Track
category: ERC
created: 2024-12-04
requires: 721
Abstract
This EIP proposes a standard for creating economically sustainable NFT collections based on 721. It introduces dynamic minting fees, role-based access control, and a donation-based engagement model to enhance creator-community interactions. These mechanisms aim to balance scarcity, incentivize meaningful participation, and ensure sustainable growth for both creators and contributors.
Motivation
NFT systems often face issues like inflationary supply and lack of mechanisms to incentivize meaningful engagement between creators and contributors. This EIP addresses these gaps by introducing:
Specification
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
Variables and Constants
mintBaseFee
Type:
uint256
Description:
The base fee for minting a token, paid by the user to create a new token.
creatorSignatureFee
Type:
uint256
Description:
The fee required for a user to acquire a creator's signature, allowing them to become a creator in the system.
maxMintsPerUserInCycle
Type:
uint256
Description:
The maximum number of mints a user can perform in a cycle. Once the limit is exceeded, the user's minting count is reset.
lastUpdateTimestamp
Type:
uint256
Description:
Timestamp of the last time the contract terms were updated (e.g., minting fees and creator signature fees). It is used to determine when the contract's terms can be updated again.
UPDATE_INTERVAL
Type:
uint256
(constant)Description:
The time interval between contract terms updates. MUST be fixed to 30 days.
CREATOR_ROLE
Type:
bytes32
(constant)Description:
The role identifier for creators in the system.
CONTRIBUTOR_ROLE
Type:
bytes32
(constant)Description:
The role identifier for contributors in the system.
mintsPerUserInCycle
Type:
mapping(address => uint256)
Description:
A mapping that tracks the number of mints a user has performed in the current cycle. It is used to enforce the maximum minting limit per user.
Events
CreatorTermsUpdated(uint256 mintBaseFee, uint256 creatorSignatureFee, uint256 maxMintsPerUserInCycle)
Description:
Emitted when the contract terms related to minting are updated by the
DEFAULT_ADMIN_ROLE
.DonationReceived(address from, address to, uint256 amount)
Description:
Emitted when a user donates ETH to a creator. This event tracks the details of the donation, including the donor's address, the recipient's address, and the donation amount.
Parameters:
from
: The address of the user making the donation.to
: The address of the creator receiving the donation.amount
: The amount of ETH donated.Modifiers
onlyIfNotPaused
Description:
Ensures that the contract MUST NOT be paused when executing a function.
onlyTokenOwner(uint256 tokenId)
Description:
Ensures that the caller is the owner of the specified token. This is checked by comparing the caller's address with the owner of the token identified by
tokenId
.updateCooldown
Description:
Ensures that the function can only be executed after the update interval has passed since the last contract term update.
Functions
function safeMint(string memory uri)
Type: Public and
payable
functionDescription:
Allows the caller to mint a new token to their address with a provided URI.
Requirements:
nonReentrant
is REQUIRED to prevent reentrancy attacks.onlyIfNotPaused
is RECOMMENDED.mintFee
Type: Public view function
Description:
Calculates and returns the current minting fee that the caller MUST pay, based on the number of mints performed during his current cycle. Is RECOMMENDED that the fee use a logarithmic reduction to adjust the fee smoothly.
Requirements:
donate(address creator)
Type: Public and
payable
functionDescription:
Allows users to donate ETH to a creator, helping fund their activities. After making a donation, the donor SHALL receive the CONTRIBUTOR_ROLE.
Requirements:
msg.caller
MUST NOT be the same as thecreator
.Events:
DonationReceived
event after the donation is processed.getCreatorSignature
Type: Public and
payable
functionDescription:
Allows a user to acquire a creator's signature by paying the required fee.
Requirements:
onlyIfNotPaused
to pause during emergencies.onlyIfNotPaused
is RECOMMENDED.updateTerms(uint256 mintBaseFee, uint256 creatorSignatureFee, uint256 maxMintsPerUserInCycle)
Type: Public function
Description:
Allows the admin to update the minting fee, creator signature fee, and the maximum mints per user in a cycle. The update MUST only be executed after the
updateCooldown
period has passed.Requirements:
DEFAULT_ADMIN_ROLE
MUST call this function.updateCooldown
period SHALL be respected before another update can occur.Events:
CreatorTermsUpdated
event after the contract terms are updated.withdraw(uint256 amount)
Type: Public function
Description:
Allows the
DEFAULT_ADMIN_ROLE
to withdraw ETH from the contract.Requirements:
DEFAULT_ADMIN_ROLE
MUST call this function.nonReentrant
modifier is REQUIRED.burn(uint256 tokenId)
Type: Public function
Description:
Allows the owner of a token to burn (destroy) the token specified by
tokenId
.Requirements:
onlyTokenOwner(tokenId)
modifier.pause
Type: Public function
Description:
Allows the
DEFAULT_ADMIN_ROLE
to pause the contract, disabling certain functions.Requirements:
DEFAULT_ADMIN_ROLE
SHOULD call this function to pause the contract.unpause
Type: Public function
Description:
Allows the
DEFAULT_ADMIN_ROLE
to unpause the contract, re-enabling functionality.Requirements:
DEFAULT_ADMIN_ROLE
SHOULD call this function to unpause the contract.Rationale
Below are the key considerations and justifications for the design choices:
Dynamic Minting Fees
Donation-Based Engagement
Backwards Compatibility
This EIP is fully compatible with 721. Extensions like dynamic minting fees, donation systems are modular and do not impact existing NFT token functionalities.
Test Cases
Reference Implementation
The following interface and constructor MUST be implemented.
Security Considerations
OpenZeppelin contracts such as
ReentrancyGuard
,Burnable
,AccessControl
,Pausable
are RECOMMENDED for implementations.The OpenZeppelin's ReentrancyGuard would offer protection against reentrancy attacks.
The OpenZeppelin's AccessControl would help with the roles.
The OpenZeppelin's Pausable would help Administrators to pause the contract during emergencies to prevent unwanted operations and mitigate risks during uncertain times.
The OpenZeppelin's Burnable would ensure that only the owner of a token can burn it, reducing the risk of malicious contracts or unauthorized users destroying tokens belonging to others. The burn behavior is restricted to the ownership function, enhancing security by preventing accidental or abusive token destruction.
Copyright
Copyright and related rights waived via CC0.