EIP-DRAFT: Diamond-Enhanced NFT Marketplace with Fee Distribution

Simple Summary

A standardized interface for NFT marketplaces built on the Diamond Standard (EIP-2535) that supports configurable fee distribution, multiple payment methods, and identity-based access control.

Abstract

This EIP proposes a standard interface for NFT marketplaces that leverages the Diamond Standard's modularity while providing advanced features including: - Configurable fee distribution to multiple receivers - Support for both ETH and ERC20 token payments - Identity-based buyer verification - Price protection mechanisms - Reentrancy protection for all payment operations

Motivation

Current NFT marketplace implementations often lack standardization and advanced features like flexible fee distribution and identity verification. This standard addresses these limitations by providing a comprehensive marketplace interface that can be implemented as a Diamond facet, enabling upgradeable and modular marketplace functionality.

Specification

Core Interface

interface IEnhancedMarketplace {
    struct FeeReceiver {
        address receiver;
        uint256 sharePerMillion; // Parts per million (e.g., 10,000 = 1%)
    }

    struct MarketItem {
        address nftContract;
        uint256 tokenId;
        address seller;
        address owner;
        uint256 price;
        bool sold;
        address receiver;
        address paymentToken;
    }

    // Events
    event MarketplaceInitialized(FeeReceiver[] feeReceivers);
    event PaymentDistributed(address token, address receiver, uint256 amount);
    event Listings(address indexed nftContract, uint256 indexed tokenId, address indexed seller, address receiver, address buyer, uint256 price, bool sold, address paymentToken);
    event Sales(address indexed nftContract, uint256 indexed tokenId, address indexed buyer);
    event Delisted(uint256 indexed tokenId);

    // Core Functions
    function initializeMarketplace(FeeReceiver[] memory _feeReceivers) external;
    function listItem(address nftContract, address payable receiver, uint256 tokenId, uint256 price, bool transferNFT, address paymentToken) external payable;
    function purchaseItem(address nftContract, uint256 tokenId, uint256 maxPrice) external payable;
    function delistItem(address nftContract, uint256 tokenId) external;
    function fetchItem(address nftContract, uint256 tokenId) external view returns (MarketItem memory);
    function fetchItems() external view returns (MarketItem[] memory);
    function getMarketplaceFeeReceivers() external view returns (FeeReceiver[] memory);
}

Key Features

1. Fee Distribution System

  • Configurable fee receivers with parts-per-million precision
  • Automatic distribution during purchases
  • Support for both ETH and ERC20 payments
  • Transparent fee tracking via events

2. Payment Methods

  • Native ETH payments
  • ERC20 token payments
  • Price protection with maximum acceptable price
  • Automatic refund of excess ETH

3. Identity Integration

  • Buyer verification through identity registry
  • Claim-based access control
  • Trusted issuer validation

4. Security Features

  • Reentrancy protection on all payment functions
  • Checks-effects-interactions pattern
  • Ownership verification before listing

Rationale

Diamond Standard Integration

Using the Diamond Standard allows marketplaces to be upgradeable and modular, enabling new features to be added without disrupting existing functionality.

Fee Distribution Precision

The parts-per-million system provides sufficient precision for fee calculations while remaining gas-efficient.

Identity-Based Access Control

Integration with ERC734/ERC735 identity standards enables sophisticated access control and compliance features.

Backwards Compatibility

This standard is designed to be compatible with existing ERC721 and ERC20 tokens. The Diamond Standard ensures that existing marketplace functionality can be preserved while adding new features.

Implementation

Reference Implementation

The reference implementation includes: - Marketplace Facet - Core marketplace functionality - IMarketplace Interface - Interface definition - Identity Registry Facet - Identity integration

Gas Considerations

  • Fee distribution adds minimal gas overhead
  • Identity verification adds verification costs
  • Diamond proxy adds small delegatecall overhead

Security Considerations

  1. Reentrancy Protection: All payment functions use the nonReentrant modifier
  2. Integer Overflow: Uses SafeMath or Solidity 0.8+ overflow protection
  3. Access Control: Proper ownership verification before operations
  4. Payment Validation: Validates payment amounts and methods
  5. Identity Verification: Ensures buyers are registered in identity system

Test Cases

Test cases should cover: - Fee distribution accuracy - Payment method handling - Identity verification - Reentrancy attack prevention - Edge cases for price protection

Copyright and related rights waived via CC0.