Created
December 20, 2018 22:23
-
-
Save nachinius/6665bc83e19cb320cfd23f354a426a6c to your computer and use it in GitHub Desktop.
This file contains hidden or 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.4.22 <0.6.0; | |
| contract Mortal { | |
| /* Define variable owner of the type address */ | |
| address owner; | |
| /* This constructor is executed at initialization and sets the owner of the contract */ | |
| constructor() public { owner = msg.sender; } | |
| /* Function to recover the funds on the contract */ | |
| function kill() public { if (msg.sender == owner) selfdestruct(msg.sender); } | |
| } | |
| contract CollectorAndDistributor3 is Mortal { | |
| uint value = 1; | |
| function setValue(uint _n) payable public { | |
| require(msg.sender == owner); | |
| value = _n; | |
| } | |
| function get () public view returns (uint){ | |
| return value; | |
| } | |
| address payable [] public receivers = [0xeA4265375306ef8CF59b1B2101107C4645d847CA]; | |
| function addReceiver(address payable to) public { | |
| require(msg.sender == owner); | |
| receivers.push(to); | |
| } | |
| function delReceiver(uint8 toDelete) public { | |
| require(msg.sender == owner); | |
| delete receivers[toDelete]; | |
| } | |
| function() payable external { | |
| for(uint8 x = 0; x < receivers.length; x++) { | |
| receivers[x].call.value(value).gas(50000)(""); | |
| } | |
| } | |
| function sendAround() external { | |
| for(uint8 x = 0; x < receivers.length; x++) { | |
| receivers[x].call.value(value).gas(50000)(""); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment