Skip to main content

PolicyAdminOptimized

Git Source

Inherits: IPolicyAdmin, RolesConsumer

Title: PolicyAdminOptimized

A mix-in that gates functions by the admin, emergency, and manager roles, resolving role membership through the ROLES module.

A bytecode-optimized copy of PolicyAdmin with identical behaviour.

Functions​

onlyEmergencyOrAdminRole​

Reverts if the caller does not have the emergency or admin role.

modifier onlyEmergencyOrAdminRole();

onlyManagerOrAdminRole​

Reverts if the caller does not have the manager or admin role.

modifier onlyManagerOrAdminRole();

onlyAdminRole​

Reverts if the caller does not have the admin role.

modifier onlyAdminRole();

onlyEmergencyRole​

Reverts if the caller does not have the emergency role.

modifier onlyEmergencyRole();

onlyManagerRole​

Reverts if the caller does not have the manager role.

modifier onlyManagerRole();

_isAdmin​

Returns whether account_ holds the admin role.

function _isAdmin(address account_) internal view returns (bool);

Parameters

NameTypeDescription
account_addressThe account whose role membership is being checked.

Returns

NameTypeDescription
<none>boolbool True if account_ holds the admin role, false otherwise.

_isEmergency​

Returns whether account_ holds the emergency role.

function _isEmergency(address account_) internal view returns (bool);

Parameters

NameTypeDescription
account_addressThe account whose role membership is being checked.

Returns

NameTypeDescription
<none>boolbool True if account_ holds the emergency role, false otherwise.

_isManager​

Returns whether account_ holds the manager role.

function _isManager(address account_) internal view returns (bool);

Parameters

NameTypeDescription
account_addressThe account whose role membership is being checked.

Returns

NameTypeDescription
<none>boolbool True if account_ holds the manager role, false otherwise.

_hasRole​

Returns whether account_ holds role_ on the ROLES module.

function _hasRole(address account_, bytes32 role_) internal view returns (bool);

Parameters

NameTypeDescription
account_addressThe address whose role membership is being checked.
role_bytes32The role identifier to test.

Returns

NameTypeDescription
<none>boolbool True if account_ holds role_, false otherwise.

_requireRole​

Reverts if account_ does not hold role_ on the ROLES module.

Reverts with ROLESv1.ROLES_RequireRole if account_ does not hold role_.

function _requireRole(address account_, bytes32 role_) internal view;

Parameters

NameTypeDescription
account_addressThe address whose role membership is being checked.
role_bytes32The role identifier that account_ must hold.

_requireAuthorized​

Reverts when an authorization check has failed.

Reverts with NotAuthorised when unauthorized_ is true.

function _requireAuthorized(bool unauthorized_) internal pure;

Parameters

NameTypeDescription
unauthorized_boolTrue if the caller is not authorized, false otherwise.