Disallow ERC20._transfer from the zero address. (#1752)
* Add requirement of non-zero from to ERC20 transfer. * Add test for transferFrom zero address to behavior. * Create ERC20.transfer behavior. * Add tests for _transfer. * Add changelog entry. * Fix linter error. * Delete repeated test. * Fix hardcoded error prefix. * Update CHANGELOG.md Co-Authored-By: Francisco Giordano <frangio.1@gmail.com> * Address review comments.
This commit is contained in:
@ -125,6 +125,7 @@ contract ERC20 is IERC20 {
|
||||
* @param value The amount to be transferred.
|
||||
*/
|
||||
function _transfer(address from, address to, uint256 value) internal {
|
||||
require(from != address(0), "ERC20: transfer from the zero address");
|
||||
require(to != address(0), "ERC20: transfer to the zero address");
|
||||
|
||||
_balances[from] = _balances[from].sub(value);
|
||||
|
||||
Reference in New Issue
Block a user