* Error handling in ERC20 and ERC721 * Added message string for require. * Fixed solhint errors. * Updated PR as per issue #1709 * changes as per #1709 and openzeppelin forum. * Changes in require statement * Changes in require statement * build pipeline fix * Changes as per @nventuro's comment. * Update revert reason strings. * Fianal update of revert reason strings. * WIP: Updating reason strings in test cases * WIP: Added changes to ERC20 and ERC721 * Fixes linting errors in *.tes.js files * Achieved 100% code coverage * Updated the test cases with shouldFail.reverting.withMessage() * Fix package-lock. * address review comments * fix linter issues * fix remaining revert reasons
44 lines
992 B
Solidity
44 lines
992 B
Solidity
pragma solidity ^0.5.7;
|
|
|
|
import "../Roles.sol";
|
|
|
|
contract PauserRole {
|
|
using Roles for Roles.Role;
|
|
|
|
event PauserAdded(address indexed account);
|
|
event PauserRemoved(address indexed account);
|
|
|
|
Roles.Role private _pausers;
|
|
|
|
constructor () internal {
|
|
_addPauser(msg.sender);
|
|
}
|
|
|
|
modifier onlyPauser() {
|
|
require(isPauser(msg.sender), "PauserRole: caller does not have the Pauser role");
|
|
_;
|
|
}
|
|
|
|
function isPauser(address account) public view returns (bool) {
|
|
return _pausers.has(account);
|
|
}
|
|
|
|
function addPauser(address account) public onlyPauser {
|
|
_addPauser(account);
|
|
}
|
|
|
|
function renouncePauser() public {
|
|
_removePauser(msg.sender);
|
|
}
|
|
|
|
function _addPauser(address account) internal {
|
|
_pausers.add(account);
|
|
emit PauserAdded(account);
|
|
}
|
|
|
|
function _removePauser(address account) internal {
|
|
_pausers.remove(account);
|
|
emit PauserRemoved(account);
|
|
}
|
|
}
|