OpenZeppelin / OpenZeppelin/openzeppelin-contracts

ERC721PaymentSplitter Extension Contract Proposal

Open
#3,201 15 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Solidity
Stars
27.2k
Forks
12.4k
Avg merge
2d 19h
Merged PRs (30d)
33

Description

🧐 Motivation

We are trying to find an official way to discretely/transparently distribute rewards among token holders. I am certain we can accomplish this by combining the ERC721, ERC721Enumerable, PaymentSplitter contracts. This would allow creators to share ETH or ERC-20 tokens proportionally among holders.

📝 Details
I have extended ERC721Enumerable and used most of the functions of PaymentSplitter but removed payees[] and made _totalShares a function that returns the ERC721Enumerable's totalSupply (or override to maxSupply if we want to save shares for future token holders).

This allows me to add two public methods to the ERC721, release(tokenId) and release(account) to distribute payment using ownerOf(tokenId) and tokenOfOwnerByIndex(account) internally.

I also added _pendingPayment(account) and _pendingPayment(tokenId) and use it to check on before token transfer for release to owner (or leaving it for future claim by changing _releaseOnTranser to false which can be set in the constructor)

I am adding this to start the dialog while I work on cleaning my code and tests before submitting my PR. I have a working prototype of this concept here 0x68ddddc10323f8b8e3fe3514dcdb70381af12e85

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing ERC721Enumerable and PaymentSplitter contracts, then compare the proposed release and pending-payment behavior with the linked Rinkeby prototype. The work is done when the design is agreed, the code and tests are cleaned up, and a pull request is ready.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
blockchain, payments
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.