forked from OpenZeppelin/openzeppelin-contracts
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request OpenZeppelin#341 from lsaether/master
Added contracts/token/BurnableToken.sol
- Loading branch information
Showing
4 changed files
with
3,304 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = msg.sender; | ||
balances[burner] = balances[burner].sub(_value); | ||
totalSupply = totalSupply.sub(_value); | ||
Burn(burner, _value); | ||
} | ||
|
||
event Burn(address indexed burner, uint indexed value); | ||
} |
Oops, something went wrong.