mirror of openzeppelin-contracts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openzeppelin-contracts/contracts/token/MintableToken.sol

52 lines
1.3 KiB

pragma solidity ^0.4.8;
import './StandardToken.sol';
import '../ownership/Ownable.sol';
/**
* @tit;e Mintable token
* @dev: Simple ERC20 Token example, with mintable token creation
@dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint value);
event MintFinished();
bool public mintingFinished = false;
uint public totalSupply = 0;
modifier canMint() {
if(mintingFinished) throw;
_;
}
/**
* @dev Function to mint tokens
* @param _to address The address that will recieve the minted tokens
* @param _amout uint The amount of tokens to mint
* @return A boolean that indicates if the operation was successful
*/
function mint(address _to, uint _amount) onlyOwner canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
return true;
}
/**
* @dev Function to spot minting new tokens
* @return True if the operation was successful
*/
function finishMinting() onlyOwner returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}