|
@@ -25,15 +25,12 @@ contract StandardToken is ERC20, BasicToken {
|
|
*/
|
|
*/
|
|
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
|
|
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
|
|
require(_to != address(0));
|
|
require(_to != address(0));
|
|
-
|
|
|
|
- uint256 _allowance = allowed[_from][msg.sender];
|
|
|
|
-
|
|
|
|
- // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
|
|
|
|
- // require (_value <= _allowance);
|
|
|
|
|
|
+ require(_value <= balances[_from]);
|
|
|
|
+ require(_value <= allowed[_from][msg.sender]);
|
|
|
|
|
|
balances[_from] = balances[_from].sub(_value);
|
|
balances[_from] = balances[_from].sub(_value);
|
|
balances[_to] = balances[_to].add(_value);
|
|
balances[_to] = balances[_to].add(_value);
|
|
- allowed[_from][msg.sender] = _allowance.sub(_value);
|
|
|
|
|
|
+ allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
|
|
Transfer(_from, _to, _value);
|
|
Transfer(_from, _to, _value);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|