Skip to content

Instantly share code, notes, and snippets.

@Chmarusso
Created June 19, 2022 12:43
Show Gist options
  • Save Chmarusso/1238d60200be64caca965b9e31245101 to your computer and use it in GitHub Desktop.
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.
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);
}
}
@0xlazytron
Copy link

@iamrakki can you explain more please??

@iamrakki
Copy link

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