Created
February 1, 2019 16:07
-
-
Save nachinius/9f8fc1ff10b26d2e1120a1f98a0f56d1 to your computer and use it in GitHub Desktop.
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.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