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.
28 lines
640 B
28 lines
640 B
pragma solidity ^0.5.0;
|
|
|
|
import "./ERC20Mintable.sol";
|
|
|
|
/**
|
|
* @title Capped token
|
|
* @dev Mintable token with a token cap.
|
|
*/
|
|
contract ERC20Capped is ERC20Mintable {
|
|
uint256 private _cap;
|
|
|
|
constructor (uint256 cap) public {
|
|
require(cap > 0, "ERC20Capped: cap is 0");
|
|
_cap = cap;
|
|
}
|
|
|
|
/**
|
|
* @return the cap for the token minting.
|
|
*/
|
|
function cap() public view returns (uint256) {
|
|
return _cap;
|
|
}
|
|
|
|
function _mint(address account, uint256 value) internal {
|
|
require(totalSupply().add(value) <= _cap, "ERC20Capped: cap exceeded");
|
|
super._mint(account, value);
|
|
}
|
|
}
|
|
|