Skip to content

Instantly share code, notes, and snippets.

@tjade273
Created September 18, 2015 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjade273/6a669d60f8063abd8043 to your computer and use it in GitHub Desktop.
Save tjade273/6a669d60f8063abd8043 to your computer and use it in GitHub Desktop.
MultiSend.sol
contract MultiSend{
function multisend(address[] addrs, uint[] amounts) public {
uint sum;
for(uint i; i< amounts.length; i++){
sum++;
}
if(addrs.length != amounts.length || sum > msg.value){
addrs[addrs.length]; // Throw Exception
}
else{
for(uint j; i<addrs.length; i++){
addrs[j].send(amounts[j]);
}
}
}
function multisend(address[] addrs){ //Split evenly
for(uint i; i< addrs.length; i++){
addrs[i].send(msg.value/addrs.length);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment