Created
April 27, 2018 20:04
-
-
Save michielmulders/cd756096a1aa046d546ae639d4be5c04 to your computer and use it in GitHub Desktop.
BatchOverflow Bug ERC20 - Not using SafeMath Lib
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