Created
May 20, 2018 23:57
-
-
Save MrCrambo/e7256c17c9c174f3bb40f0ce82789f92 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
function batchTransfer(address[] _receivers, uint256 _value) public whenNotPaused returns (bool) { | |
uint cnt = _receivers.length; | |
uint256 amount = uint256(cnt) * _value; | |
require(cnt > 0 && cnt <= 20); | |
require(_value > 0 && balances[msg.sender] >= amount); | |
balances[msg.sender] = balances[msg.sender].sub(amount); | |
for (uint i = 0; i < cnt; i++) { | |
balances[_receivers[i]] = balances[_receivers[i]].add(_value); | |
Transfer(msg.sender, _receivers[i], _value); | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment