Solidity NFT collection with variable royalty rates

My colleague and I are trying to figure out a way to create a Solidity contract which:

  • Represents a collection of NFTs, that have meta data, can be bought / sold (on OpenSea, etc.)
  • Each NFT can have it’s own royalty rate (separate from each other, but still in the same collection)
  • The royalties should be enforced when the NFTs are bought / sold (on OpenSea, etc.)

Is this possible? Where would you start?

From what I’ve researched this is currently not possible. You simply cannot enforce other marketplaces to honour your royalty structure, since the buy/sell transactions are done by the 3rd party market contract and not the token contract.
The ‘best’ option for us is supporting this
There’s a full explanation and an interesting discussions around it on the github link

If you want to have a standardized ERC721 contract, you are at the mercy of other other market places to support this EIP. There are some marketplaces already doing so and hopefully Opensea will follow.

The main issue is that anyone can always ‘freely’ transfer an NFT, without paying royalties. Royalties are only paid in a buy/sell value transfer, which is done by a market contract. If you want to be sure to always get royalties, you could make a custom token and market contract in one, but it won’t adhere to standards and it wont be supported by other marketplaces.

The EIP supports only 1 royalty receiver. If you wan to split royalties across wallets automatically, you can consider using a ‘splitter contract’ which receives the royalty value and automatically divides it to other wallets:

Here’s a good example of the EIP implementation (mentioned on the github), supporting a royalty percentage per NFT as you describe:

1 Like

Awesome thanks @matiyin, I’m looking into these resources now.

I see now that Open Zeppelin has made an extension ERC721Royalty supporting ERC2981 NFT Royalty Standard:

1 Like