Added contracts/token/BurnableToken.sol
This commit is contained in:
27
contracts/token/BurnableToken.sol
Normal file
27
contracts/token/BurnableToken.sol
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
pragma solidity ^0.4.13;
|
||||||
|
|
||||||
|
import './StandardToken.sol';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title Burnable Token
|
||||||
|
* @dev Token that can be irreversibly burned (destroyed).
|
||||||
|
*/
|
||||||
|
contract BurnableToken is StandardToken{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Burns a specific amount of tokens.
|
||||||
|
* @param _value The amount of token to be burned.
|
||||||
|
*/
|
||||||
|
function burn(uint _value)
|
||||||
|
public
|
||||||
|
{
|
||||||
|
require(_value > 0);
|
||||||
|
|
||||||
|
address burner = masg.sender;
|
||||||
|
balances[burner] = balanced[burner].sub(_value);
|
||||||
|
totalSupply = totalSupply.sub(_value);
|
||||||
|
Burn(burner, _value);
|
||||||
|
}
|
||||||
|
|
||||||
|
event Burn(address indexed burner, uint indexed value);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user