2017-07-05 10:28:15 +00:00
|
|
|
pragma solidity ^0.4.11;
|
|
|
|
|
|
|
|
|
|
|
|
import './StandardToken.sol';
|
|
|
|
import '../ownership/Ownable.sol';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @title 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, uint256 amount);
|
|
|
|
event MintFinished();
|
|
|
|
|
|
|
|
bool public mintingFinished = false;
|
|
|
|
|
|
|
|
|
|
|
|
modifier canMint() {
|
2018-07-11 23:49:00 +00:00
|
|
|
if(mintingFinished) revert();
|
2017-07-05 10:28:15 +00:00
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Function to mint tokens
|
2018-07-10 07:18:19 +00:00
|
|
|
* @param _to The address that will receive the minted tokens.
|
2017-07-05 10:28:15 +00:00
|
|
|
* @param _amount The amount of tokens to mint.
|
|
|
|
* @return A boolean that indicates if the operation was successful.
|
|
|
|
*/
|
2018-07-04 17:20:51 +00:00
|
|
|
function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) {
|
2017-07-05 10:28:15 +00:00
|
|
|
totalSupply = totalSupply.add(_amount);
|
|
|
|
balances[_to] = balances[_to].add(_amount);
|
2018-06-27 08:35:38 +00:00
|
|
|
emit Mint(_to, _amount);
|
2017-07-05 10:28:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Function to stop minting new tokens.
|
|
|
|
* @return True if the operation was successful.
|
|
|
|
*/
|
2018-07-04 17:20:51 +00:00
|
|
|
function finishMinting() public onlyOwner returns (bool) {
|
2017-07-05 10:28:15 +00:00
|
|
|
mintingFinished = true;
|
2018-06-27 08:35:38 +00:00
|
|
|
emit MintFinished();
|
2017-07-05 10:28:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|