|
@@ -58,11 +58,8 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
|
|
|
|
|
/**
|
|
|
* @dev Modifier that checks that an account has a specific role. Reverts
|
|
|
- * with a standardized message including the required role.
|
|
|
+ * with a custom error including the required role.
|
|
|
*
|
|
|
- * The format of the revert reason is given by the following regular expression:
|
|
|
- *
|
|
|
- * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
|
|
|
*/
|
|
|
modifier onlyRole(bytes32 role) {
|
|
|
_checkRole(role);
|
|
@@ -84,21 +81,15 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @dev Revert with a standard message if `_msgSender()` is missing `role`.
|
|
|
+ * @dev Revert with a custom error if `_msgSender()` is missing `role`.
|
|
|
* Overriding this function changes the behavior of the {onlyRole} modifier.
|
|
|
- *
|
|
|
- * Format of the revert message is described in {_checkRole}.
|
|
|
*/
|
|
|
function _checkRole(bytes32 role) internal view virtual {
|
|
|
_checkRole(role, _msgSender());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @dev Revert with a standard message if `account` is missing `role`.
|
|
|
- *
|
|
|
- * The format of the revert reason is given by the following regular expression:
|
|
|
- *
|
|
|
- * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
|
|
|
+ * @dev Revert with a custom error if `account` is missing `role`.
|
|
|
*/
|
|
|
function _checkRole(bytes32 role, address account) internal view virtual {
|
|
|
if (!hasRole(role, account)) {
|