* switch to using Context internally
* add context import
* Add smoke test to make sure enabling GSN support works
* Update test/GSN/ERC721GSNRecipientMock.test.js
Co-Authored-By: Francisco Giordano <frangio.1@gmail.com>
* Upgrade truffle
* add missing awaits
* Revert "Upgrade truffle"
This reverts commit f9b0ba9019.
45 lines
1.0 KiB
Solidity
45 lines
1.0 KiB
Solidity
pragma solidity ^0.5.0;
|
|
|
|
import "../../GSN/Context.sol";
|
|
import "../Roles.sol";
|
|
|
|
contract MinterRole is Context {
|
|
using Roles for Roles.Role;
|
|
|
|
event MinterAdded(address indexed account);
|
|
event MinterRemoved(address indexed account);
|
|
|
|
Roles.Role private _minters;
|
|
|
|
constructor () internal {
|
|
_addMinter(_msgSender());
|
|
}
|
|
|
|
modifier onlyMinter() {
|
|
require(isMinter(_msgSender()), "MinterRole: caller does not have the Minter role");
|
|
_;
|
|
}
|
|
|
|
function isMinter(address account) public view returns (bool) {
|
|
return _minters.has(account);
|
|
}
|
|
|
|
function addMinter(address account) public onlyMinter {
|
|
_addMinter(account);
|
|
}
|
|
|
|
function renounceMinter() public {
|
|
_removeMinter(_msgSender());
|
|
}
|
|
|
|
function _addMinter(address account) internal {
|
|
_minters.add(account);
|
|
emit MinterAdded(account);
|
|
}
|
|
|
|
function _removeMinter(address account) internal {
|
|
_minters.remove(account);
|
|
emit MinterRemoved(account);
|
|
}
|
|
}
|