1234567891011121314151617181920212223242526272829303132 |
- pragma solidity ^0.4.24;
- import "./BasicToken.sol";
- /**
- * @title Burnable Token
- * @dev Token that can be irreversibly burned (destroyed).
- */
- contract BurnableToken is BasicToken {
- event Burn(address indexed burner, uint256 value);
- /**
- * @dev Burns a specific amount of tokens.
- * @param _value The amount of token to be burned.
- */
- function burn(uint256 _value) public {
- _burn(msg.sender, _value);
- }
- function _burn(address _who, uint256 _value) internal {
- require(_value <= balances[_who]);
- // 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
- balances[_who] = balances[_who].sub(_value);
- totalSupply_ = totalSupply_.sub(_value);
- emit Burn(_who, _value);
- emit Transfer(_who, address(0), _value);
- }
- }
|