How to set % royalty for transfering ERC721 NFTs

Very interested to do this, its hard to find good resources.
Any help would be much appreciated

Hi minty,
do you want to set royalties on contract level? If yes, then you can check out this standard, https://eips.ethereum.org/EIPS/eip-2981, which is also supported by some marketplaces such as LooksRare

The key is to provide a function royaltyInfo that returns a calculated royalty amount.

If you meant, that you want to charge royalties everytime the NFT is transferred, then you would need to change the standard ERC721 transfer function to be payable (you would be creating a sort of trading sub-contract) and then you would split the payment between the seller and the royalty recipient…

Hope this helps!

2 Likes