123456789101112131415161718192021222324252627 |
- pragma solidity ^0.4.18;
- 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 {
- 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);
- totalSupply = totalSupply.sub(_value);
- Burn(burner, _value);
- }
- }
|