Created
June 19, 2022 12:43
-
-
Save Chmarusso/1238d60200be64caca965b9e31245101 to your computer and use it in GitHub Desktop.
This smart contract will automatically divide the payment amount and push it to specified recipients.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.15; | |
// SPDX-License-Identifier: MIT | |
contract PaymentSplitter { | |
address payable [] public recipients; | |
event TransferReceived(address _from, uint _amount); | |
constructor(address payable [] memory _addrs) { | |
for(uint i=0; i<_addrs.length; i++){ | |
recipients.push(_addrs[i]); | |
} | |
} | |
receive() payable external { | |
uint256 share = msg.value / recipients.length; | |
for(uint i=0; i < recipients.length; i++){ | |
recipients[i].transfer(share); | |
} | |
emit TransferReceived(msg.sender, msg.value); | |
} | |
} |
Great code! thanks for the contribution, ill try it
ipfsHash transfers the multiple account . is that possible to work this method.
@iamrakki can you explain more please??
One ipfsHash share the multiple account addresses
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi, you can split the earnings / eth by below method as well
`// SPDX-License-Identifier: MIT
// Author BABAR R.
pragma solidity >=0.8.9 <0.9.0;
import 'erc721a/contracts/ERC721A.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
contract SendOnMint is ERC721A, Ownable, ReentrancyGuard {
}`
This is my approach