* 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
50 lines
1.1 KiB
Solidity
50 lines
1.1 KiB
Solidity
pragma solidity ^0.5.2;
|
|
|
|
import "@openzeppelin/upgrades/contracts/Initializable.sol";
|
|
import "../Roles.sol";
|
|
|
|
|
|
contract MinterRole is Initializable {
|
|
using Roles for Roles.Role;
|
|
|
|
event MinterAdded(address indexed account);
|
|
event MinterRemoved(address indexed account);
|
|
|
|
Roles.Role private _minters;
|
|
|
|
function initialize(address sender) public initializer {
|
|
if (!isMinter(sender)) {
|
|
_addMinter(sender);
|
|
}
|
|
}
|
|
|
|
modifier onlyMinter() {
|
|
require(isMinter(msg.sender));
|
|
_;
|
|
}
|
|
|
|
function isMinter(address account) public view returns (bool) {
|
|
return _minters.has(account);
|
|
}
|
|
|
|
function addMinter(address account) public onlyMinter {
|
|
_addMinter(account);
|
|
}
|
|
|
|
function renounceMinter() public {
|
|
_removeMinter(msg.sender);
|
|
}
|
|
|
|
function _addMinter(address account) internal {
|
|
_minters.add(account);
|
|
emit MinterAdded(account);
|
|
}
|
|
|
|
function _removeMinter(address account) internal {
|
|
_minters.remove(account);
|
|
emit MinterRemoved(account);
|
|
}
|
|
|
|
uint256[50] private ______gap;
|
|
}
|