mirror of
https://github.com/fluencelabs/smartcontracts
synced 2025-04-24 18:52:19 +00:00
56 lines
1.5 KiB
Solidity
56 lines
1.5 KiB
Solidity
pragma solidity ^0.4.18;
|
|
|
|
import 'zeppelin-solidity/contracts/token/StandardToken.sol';
|
|
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
|
|
|
|
contract Mintable is StandardToken, Ownable {
|
|
|
|
event Mint(address indexed to, uint256 amount);
|
|
event MintFinished();
|
|
|
|
bool public mintingFinished = false;
|
|
mapping (address => bool) private minters;
|
|
|
|
modifier canMint() {
|
|
require(!mintingFinished);
|
|
_;
|
|
}
|
|
|
|
modifier onlyMinter() {
|
|
require(minters[msg.sender]);
|
|
_;
|
|
}
|
|
|
|
function allowMinting(address _to) onlyOwner canMint public {
|
|
minters[_to] = true;
|
|
}
|
|
|
|
function denyMinting(address _to) onlyOwner public {
|
|
delete minters[_to];
|
|
}
|
|
|
|
/**
|
|
* @dev Function to mint tokens
|
|
* @param _to The address that will receive the minted tokens.
|
|
* @param _amount The amount of tokens to mint.
|
|
* @return A boolean that indicates if the operation was successful.
|
|
*/
|
|
function mint(address _to, uint256 _amount) onlyMinter canMint public returns (bool) {
|
|
totalSupply = totalSupply.add(_amount);
|
|
balances[_to] = balances[_to].add(_amount);
|
|
Mint(_to, _amount);
|
|
Transfer(0x0, _to, _amount);
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @dev Function to stop minting new tokens.
|
|
* @return True if the operation was successful.
|
|
*/
|
|
function finishMinting() onlyOwner canMint public returns (bool) {
|
|
mintingFinished = true;
|
|
MintFinished();
|
|
return true;
|
|
}
|
|
}
|