Merge branch 'release-v2.0.0' of github.com:OpenZeppelin/openzeppelin-solidity into release-v2.0.0
This commit is contained in:
@ -10,26 +10,10 @@ import "../../access/roles/MinterRole.sol";
|
||||
* @dev ERC20 minting logic
|
||||
*/
|
||||
contract ERC20Mintable is Initializable, ERC20, MinterRole {
|
||||
event MintingFinished();
|
||||
|
||||
bool private _mintingFinished = false;
|
||||
|
||||
modifier onlyBeforeMintingFinished() {
|
||||
require(!_mintingFinished);
|
||||
_;
|
||||
}
|
||||
|
||||
function initialize() public initializer {
|
||||
MinterRole.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the minting is finished.
|
||||
*/
|
||||
function mintingFinished() public view returns(bool) {
|
||||
return _mintingFinished;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Function to mint tokens
|
||||
* @param to The address that will receive the minted tokens.
|
||||
@ -42,25 +26,9 @@ contract ERC20Mintable is Initializable, ERC20, MinterRole {
|
||||
)
|
||||
public
|
||||
onlyMinter
|
||||
onlyBeforeMintingFinished
|
||||
returns (bool)
|
||||
{
|
||||
_mint(to, amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Function to stop minting new tokens.
|
||||
* @return True if the operation was successful.
|
||||
*/
|
||||
function finishMinting()
|
||||
public
|
||||
onlyMinter
|
||||
onlyBeforeMintingFinished
|
||||
returns (bool)
|
||||
{
|
||||
_mintingFinished = true;
|
||||
emit MintingFinished();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user