Files
openzeppelin-contracts/contracts/token/ERC20/ERC20Capped.sol
Santiago Palladino 7ac0502c50 Rename to @openzeppelin/contracts-ethereum-package (#54)
* Change import path from zos-lib to upgrades in all contracts

* Update readme with new naming

* Update package and deps names

* Change path to initializable in AST of networks.jsons

* Migrate manifest version

* Use new oz file locations

* Rename in ERC20Migrator comments

* Update SDK install instructions in README

* Update gitignore to use new session file name

* trigger CI

* Fixes to readme and package version

* Use 2.5.0 release of OpenZeppelin SDK
2019-07-20 13:37:41 -03:00

34 lines
776 B
Solidity

pragma solidity ^0.5.2;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "./ERC20Mintable.sol";
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract ERC20Capped is Initializable, ERC20Mintable {
uint256 private _cap;
function initialize(uint256 cap, address sender) public initializer {
ERC20Mintable.initialize(sender);
require(cap > 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);
super._mint(account, value);
}
uint256[50] private ______gap;
}