Moving business logic preconditions to the beginning of the function.
This commit is contained in:
@ -16,6 +16,9 @@ contract BurnableToken is StandardToken {
|
||||
*/
|
||||
function burn(uint256 _value) public {
|
||||
require(_value > 0);
|
||||
require(_value <= balances[msg.sender]);
|
||||
// no need to require value <= totalSupply, since that would imply the
|
||||
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
|
||||
|
||||
address burner = msg.sender;
|
||||
balances[burner] = balances[burner].sub(_value);
|
||||
|
||||
Reference in New Issue
Block a user