How to properly add royalties to ERC 721 OZ contracts

After reading this post and also wanting to do the same I am thinking of what would be a best way to add royalties function to ERC721 by OZ. What I am aiming is that they are always used and can never be skipped, which can occur now if you look at above example from link.

So I belive it should be added in safeTransferFrom method, but as we want to have royalties cut directly in ETH paid for transfer, we need it to be payable? maybe we can also add that it can take eth but it can take cut in tokens paid as sometimes platforms offer possibility to buy NFT with some token.

Open for ideas and discussions.

1 Like

Our ERC721 contract can't be made to have payable transferFrom. See https://github.com/OpenZeppelin/openzeppelin-contracts/issues/2610

There is an EIP about royalties gaining some traction. Not implemented by us yet but there is interest. See https://github.com/OpenZeppelin/openzeppelin-contracts/issues/2789

1 Like

Thanx on a suggestion, in a way ERC721 and NFTs vital part should be royalties and I would prefer to have it in contract and not solved by some 3rd party platform.

Someone suggested using ERC20 for payment would work as it doesn't require payable functions.

It could work but probably bad UX as it is exprcted that user has weth or we need to somehow transfer users eth to weth without him knowing it?

sri, 18. kol 2021. 21:42 Francisco Giordano via OpenZeppelin Community <zeppelin@discoursemail.com> je napisao: