* 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 CapperRole {
|
|
using Roles for Roles.Role;
|
|
|
|
event CapperAdded(address indexed account);
|
|
event CapperRemoved(address indexed account);
|
|
|
|
Roles.Role private _cappers;
|
|
|
|
constructor () internal {
|
|
_addCapper(msg.sender);
|
|
}
|
|
|
|
modifier onlyCapper() {
|
|
require(isCapper(msg.sender), "CapperRole: caller does not have the Capper role");
|
|
_;
|
|
}
|
|
|
|
function isCapper(address account) public view returns (bool) {
|
|
return _cappers.has(account);
|
|
}
|
|
|
|
function addCapper(address account) public onlyCapper {
|
|
_addCapper(account);
|
|
}
|
|
|
|
function renounceCapper() public {
|
|
_removeCapper(msg.sender);
|
|
}
|
|
|
|
function _addCapper(address account) internal {
|
|
_cappers.add(account);
|
|
emit CapperAdded(account);
|
|
}
|
|
|
|
function _removeCapper(address account) internal {
|
|
_cappers.remove(account);
|
|
emit CapperRemoved(account);
|
|
}
|
|
}
|