Skip to content
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

Extend PaymentSplitter to support ERC20 tokens #2858

Merged
merged 15 commits into from
Oct 7, 2021

Conversation

Amxx
Copy link
Collaborator

@Amxx Amxx commented Sep 14, 2021

This PR extends the existing PaymentSplitter to add support for ERC20 tokens.

New functions and events include:

Ether ERC20
function totalReleased() public view returns (uint256) function totalReleased(IERC20 asset) public view returns (uint256)
function released(address account) public view returns (uint256) function released(IERC20 asset, address account) public view returns (uint256)
function release(address payable account) public function release(IERC20 asset, address payable account) public
event PaymentReceived(address from, uint256 amount) event ERC20PaymentReleased(IERC20 indexed asset, address to, uint256 amount)

Fixes #2701, #2762, #2853

  • Note: storage layout is maintained, upgradeable instances of PaymentSplitter can safely be updated to use this new feature

PR Checklist

  • Tests
  • Changelog entry

with ERC20 support on top of the existing PaymentSplitter
@Amxx Amxx requested a review from frangio September 14, 2021 09:11
@Amxx Amxx changed the title Add MultiPaymentSplitter, an ERC20 compatible payment splitter Extend PaymentSplitter to supoort ERC20 tokens Sep 15, 2021
@frangio frangio changed the title Extend PaymentSplitter to supoort ERC20 tokens Extend PaymentSplitter to support ERC20 tokens Sep 15, 2021
contracts/finance/PaymentSplitter.sol Outdated Show resolved Hide resolved
contracts/finance/PaymentSplitter.sol Outdated Show resolved Hide resolved
contracts/finance/PaymentSplitter.sol Outdated Show resolved Hide resolved
contracts/finance/PaymentSplitter.sol Outdated Show resolved Hide resolved
@frangio
Copy link
Contributor

frangio commented Sep 15, 2021

The @dev documentation at the contract level needs to be updated. Please include a mention that rebasing tokens may not be distributed equally. And I'm wondering if fee on transfer tokens would even work, if they don't we should document that as well.

frangio
frangio previously approved these changes Sep 15, 2021
@AboldUSER
Copy link

Glad you all are updating this to paymentsplitter for ERC20s. I did this for AirSwap last month, and released a tutorial (with its own github repo) for others to create their own tokenpaymentsplitter contracts.
https://medium.com/coinmonks/create-an-erc20-token-payment-splitting-smart-contract-c79436470ccc

Will be great when you integrate the ERC20 functionality into the main repo.

@Amxx Amxx mentioned this pull request Oct 6, 2021
1 task
@Amxx Amxx enabled auto-merge (squash) October 7, 2021 14:04
@Amxx Amxx disabled auto-merge October 7, 2021 14:17
@Amxx Amxx merged commit efb5b0a into OpenZeppelin:master Oct 7, 2021
@Amxx Amxx deleted the feature/erc20splitter branch October 7, 2021 14:17
@sabotagebeats
Copy link

great to have this included in the main repo!

@frangio frangio mentioned this pull request Dec 14, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PaymentSplitter + ERC20
4 participants