EIP-2981 introduces a “standardized way to obtain royalty payment information for non-fungible tokens (NFTs).” Marketplaces can obtain information about how much royalty to send to whom by calling the royaltyInfo() function of the NFT contract.
A simple ERC-721 token (Token.sol) that provides a fixed royalty percentage of 5% to be paid to a single recipient address for each sale of each NFT minted under the contract. (Note that the fixed percentage fee is not a requirement of EIP-2981, and more exotic schemes are possible.)
A marketplace (Marketplace.sol) that allows a user to post offers to buy NFTs generated by contracts. Token holders can accept the buy offer and sell their tokens at the offer price. Or, they can post their own sell offers at a desired price and wait for the user to buy. All transactions are conducted in ETH. Every time a sale occurs, the marketplace contract calls the token contract to receive the amount of royalties owed. This amount is then transferred to the royalty recipients address.
Royalty Payment Middleware Contract (RoyaltiesPayment.sol). EIP-2981 stipulates that royalty payments must be made to a single address. In the case of an NFT with multiple rights holders, this means that the marketplace payment must be further split either off-chain or through another contract. The contract in this repository allows for multiple rights holders. Every time a payment is made to the contract, the amount is split equally between all registered rights holders. They then have the option to withdraw all or part of their balance from the contract.
Reviews
There are no reviews yet.