-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PaymentSplitter for ERC20 #2762
Comments
Hello @JimLynchCodes, and thank you for your suggestion. We already have a PaymentSplitter that supports Eth, so the first point is already here. We plan to extend it with the ability to add/modify payee after construction. Making and ERC20 version is easy if we don't include the extension discussed above. ERC721 are non fungible, so there is no way reasonable to do a payment splitter. Maybe ERC1155 would make sens however. |
Thanks @Amxx! Is there a branch with some code starting the ERC20 version of this file? How does the consumer tell it what token to use? In the constructor? When you say the extension, do you mean spring multiple tokens? It would be relatively easy to support a single ERC20 token? Possibly an app that wants to use multiple token should just create multiple paymentSplitters? I am not sure the ERC standard they are using, but the usecase for NFTs is for a decentraland wearables. If you are a creator of a shirt nft, for example, and mint 100 of that shirt, it would be nice to send them your contract and then allow each recipient to pull one... maybe something like that is outside the scope of what "PaymentSplitter" should do, but it seemed similar enough that I thought it might be able to fit in somehow... |
A prototype for ERC20 is available here: https://github.com/Amxx/openzeppelin-contracts/tree/feature/paymentsplitter/contracts/finance I emphasize on the "prototype" aspect. I hasn't been properly reviewed, and I would not recommend using it in production without proper review/audit. For the ERC721 part, I understand your idea, but I really think it is not safe, and also not generalizable. While you consider all the NFTs to be identical, they are not! Maybe the number 1 is worth more to some people (or the number 8 which implies luck in Chinese culture). In many cases all NFTs are not equal (like t-shirts with different drawings) and cannot be distributed like that. For such a usecase I think a multisig with "social" governance would be more fitting. |
Merging issues. Lets continue this discussion here: #2701 |
🧐 Motivation
Hi! I really like the "PaymentSplitter" contract in this repo, and the nice tests! 😉
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/finance/PaymentSplitter.sol
It's great for splitting ether!
I also noticed this in the finance folder, "we want to grow this directory so we welcome ideas".
I have some ideas for making this better, possibly splitting it into multiple files...
PaymentSplitterEth - Splits ether, the native EVM currency
PaymentSplitterERC20 - Splits any arbitrary ERC20 token(s). owner can specify one or more ERC20 tokens. Both tokens are split proportionately based on shares and the contract's balance for each token.
PaymentSplitterERC721 - Splits any arbitrary ERC721 token(s). owner can specify one or more ERC721 tokens. Both tokens are split proportionately based on shares and the contract's balance for each token (but fractional amounts are not allowed). If there are more shares than ERC721 tokens to distribute, recipients are randomly selected.
I'm curious what everyone thinks about these ideas.
Let me know of the nuances and tricky things I'm not considering here.
thanks! ❤️
The text was updated successfully, but these errors were encountered: