DEV Community

Cover image for Payment Splitter Smart Contract Module in Bunzz
Bunzz
Bunzz

Posted on

Payment Splitter Smart Contract Module in Bunzz

We are excited to announce our new Payment Splitter Module available in Bunzz and created by Alex Wang.

This contract allows splitting Ether payments among a group of accounts. The sender does not need to be aware that the Ether will be split in this way, since it is handled transparently by the contract. The split can be in equal parts or in any other arbitrary proportion.

This Module connects with other contracts and is used for sharing accumulated tokens on the contract with shared accounts.

The number of shared accounts is limited up to 10 and can be used for sharing revenues with a limited number of accounts. (NFT Mint, Launch Token, etc)

You can access this Module and the code here.

How to use

  • Add a payee with a share point on the contract
  • Connect with other contracts which accumulate tokens (both ERC20 and native token) itself.
  • Release tokens to payees based on their shares.
  • Contract owner can update the shares of payees, and disable the payee to prevent further payments (Of course, they can enable the payee again if needed)

In most cases, the contract accumulates tokens itself and then releases them to payees. Example:

  • Token Launch contract is getting a fee from the transaction (sell, buy, transfer, etc)
  • DEFI contract is getting the fee from the user's deposit and stake.
  • NFT Mint contract has some minting price and the contract is getting tokens from the minting transaction.
  • NFT Marketplace contract is getting a fee from the trades (sell, buy, transfer, etc)

For the above cases, the contracts need to have functions to withdraw the accumulated tokens or release them to payees with shares.

By using the PaymentSplitter module, the above contracts don't need to have those functions, just connect them with the PaymentSplitter Module and add payees with shares and release it to the payees.

Functions

#WRITE

  • updatePayeeStatus
  • withdrawEth
  • withdrawERC20
  • updatePayeeShares
  • transferOwnership
  • removePayee
  • renounceOwnership
  • setMaxPayeeCounter
  • releaseEth
  • releaseERC20
  • addPayee

READ

  • totalShares
  • totalEthWithdrawn
  • totalERC20Withdrawn
  • totalEthReleased
  • shares
  • totalERC20Released
  • releasableERC20
  • payeeCount
  • releasableEth
  • listOfPayees
  • isPayee
  • isEnabled
  • ethReleased
  • owner
  • maxPayeeCounter
  • erc20Released

You can access this Module and the code here.

If you still haven’t signed up to Bunzz, what are you waiting for? Sign up here and get your smart contracts deployed in 5 minutes through our great GUI.

Top comments (0)