Skip to content

Instantly share code, notes, and snippets.

@nachinius
Created February 1, 2019 16:07
Show Gist options
  • Save nachinius/9f8fc1ff10b26d2e1120a1f98a0f56d1 to your computer and use it in GitHub Desktop.
Save nachinius/9f8fc1ff10b26d2e1120a1f98a0f56d1 to your computer and use it in GitHub Desktop.
pragma solidity 0.5.2;
contract Contract_C {
address payable [5] public target = [address(0), address(0),address(0),address(0),address(0)];
uint8 public max = 5;
uint public amountToPaid = 1;
event Sent(address destination, uint amount);
// constructor () internal {
// }
function setTarget(uint8 i, address payable newTarget) public {
if(i < 5) {
target[i] = newTarget;
}
}
function () payable external {
amountToPaid++;
for(uint8 i; i < max; i++) {
if(target[i] != address(0)) {
target[i].call.value(amountToPaid).gas(gasleft())("internal call value");
emit Sent(target[i], amountToPaid);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment