I was thinking about a use case let's say that we have a deployed smart contract ERC721 with 100 NFTS all of them minted. and I want to send to these 100 addresses royalties?
How can approach that? should I use PaymentSplitter?
Can you share please any resources or an example of a smart contract that can do that?
Thank you
Best Answer
you can do it manually, by creating a batch transfer kind of function that looks like this:
function sendRoyalties(address[] calldata _nftHolders, uint amountToSend) external;
or you can create a Custom Method:
claimRoyalties()
It should check if the caller has an NFT, and under the hood:
mapping(uint => uint)
fortokenId => amountClaimed
Example: 100 ETH royalties100 / 100 = 1 ETH
UserA holder of TokenID "99" claims 1 ETH
mapping is equal to
(99 => 1 ETH);
after a while 100 more ETH are added to the smart contract
UserB holder of TokenID 11, can claim
(200 / 100) = 2 ETH
UserA holder of TokenID 99 can claim
(200 / 100) = 2 ETH - 1 ETH
(already claimed and visible on mapping)claimableRoyalties[99] == 1 ETH
, before the claimclaimableRoyalties[99] == 2 ETH
, after the claim