/nft_royalties_market

Sample NFT & Marketplace contracts with EIP-2981 support

Primary LanguageSolidityMIT LicenseMIT

ERC-721 NFT Marketplace with royalties payment (EIP-2981)

Overview

EIP-2981 introduces a "standardized way to retrieve royalty payment information for non-fungible tokens (NFTs)". Marketplaces can retrieve information about how much royalties to send to whom by calling the NFT contract's royaltyInfo() function.

The contracts in this repository are a sample implementation of the EIP's recommendation. They include:

  • A simple ERC-721 token (Token.sol) which stipulates a fixed 5% royalty percentage to be paid to a single recipient's address for every sale of every NFT minted by the contract. (Note that the flat percentage fee is not a requirement of EIP-2981 and more exotic schemes are possible).
  • A marketplace (Marketplace.sol) which allows user to place buy offers on the NFT generated by the contracts. Token holders can choose to accept a buy offers and sell their tokens at the offer's price. Or they can place their own sell offers at the price they desire and wait for a user to purchase. All transactions are conducted in ETH. Every time a sale occurs, the marketplace contract calls the token contract to retrieve the amount of royalties due. That amount is then transferred to the royalties' recipients' address.
  • A royalties payment middleware contract (RoyaltiesPayment.sol). EIP-2981 stipulates that royalty payments must be made to a single address. In the case where an NFT has multiple rightholders, this means that the payment from the marketplace must be further split, either off-chain or through another contract. The contract in this repository allows for multiple rightholders. Every time a payment is made to the contract, the amount is split equally among all the registered rightsholders. They then have the possibility to withdraw all or part of their balance on the contract.

The token contract is based on OpenZeppelin's ERC-721 contracts.

Setup

Dependencies

Install the required python dependencies: pip install -r requirements.txt

Running the tests

brownie test

License

This project is licensed under the MIT license.