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.
32 lines
696 B
32 lines
696 B
7 years ago
|
pragma solidity ^0.4.11;
|
||
|
|
||
7 years ago
|
import "./MintableToken.sol";
|
||
7 years ago
|
|
||
7 years ago
|
|
||
7 years ago
|
/**
|
||
|
* @title Capped token
|
||
|
* @dev Mintable token with a token cap.
|
||
|
*/
|
||
|
contract CappedToken is MintableToken {
|
||
|
|
||
|
uint256 public cap;
|
||
|
|
||
7 years ago
|
function CappedToken(uint256 _cap) public {
|
||
7 years ago
|
require(_cap > 0);
|
||
|
cap = _cap;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @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) onlyOwner canMint public returns (bool) {
|
||
7 years ago
|
require(totalSupply_.add(_amount) <= cap);
|
||
7 years ago
|
|
||
7 years ago
|
return super.mint(_to, _amount);
|
||
7 years ago
|
}
|
||
|
|
||
|
}
|