Merge tag 'v2.1.1' of github.com:OpenZeppelin/openzeppelin-solidity
v2.1.1
This commit is contained in:
@ -1,21 +1,16 @@
|
||||
pragma solidity ^0.4.24;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "zos-lib/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
|
||||
{
|
||||
function initialize(uint256 cap, address sender) public initializer {
|
||||
ERC20Mintable.initialize(sender);
|
||||
|
||||
require(cap > 0);
|
||||
@ -25,28 +20,14 @@ contract ERC20Capped is Initializable, ERC20Mintable {
|
||||
/**
|
||||
* @return the cap for the token minting.
|
||||
*/
|
||||
function cap() public view returns(uint256) {
|
||||
function cap() public view returns (uint256) {
|
||||
return _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
|
||||
)
|
||||
public
|
||||
returns (bool)
|
||||
{
|
||||
require(totalSupply().add(amount) <= _cap);
|
||||
|
||||
return super.mint(to, amount);
|
||||
function _mint(address account, uint256 value) internal {
|
||||
require(totalSupply().add(value) <= _cap);
|
||||
super._mint(account, value);
|
||||
}
|
||||
|
||||
|
||||
uint256[50] private ______gap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user