Skip to content

Latest commit

 

History

History
314 lines (269 loc) · 9.34 KB

IAccessControl.md

File metadata and controls

314 lines (269 loc) · 9.34 KB

IAccessControl.sol

View Source: openzeppelin-solidity/contracts/access/IAccessControl.sol

↘ Derived Contracts: AccessControl, IProtocol

IAccessControl

External interface of AccessControl declared to support ERC165 detection.

Events

event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

Functions

hasRole

Returns true if account has been granted role.

function hasRole(bytes32 role, address account) external view
returns(bool)

Arguments

Name Type Description
role bytes32
account address
Source Code
function hasRole(bytes32 role, address account) external view returns (bool);

getRoleAdmin

Returns the admin role that controls role. See {grantRole} and {revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}.

function getRoleAdmin(bytes32 role) external view
returns(bytes32)

Arguments

Name Type Description
role bytes32
Source Code
function getRoleAdmin(bytes32 role) external view returns (bytes32);

grantRole

Grants role to account. If account had not been already granted role, emits a {RoleGranted} event. Requirements:

  • the caller must have role's admin role.
function grantRole(bytes32 role, address account) external nonpayable

Arguments

Name Type Description
role bytes32
account address
Source Code
function grantRole(bytes32 role, address account) external;

revokeRole

Revokes role from account. If account had been granted role, emits a {RoleRevoked} event. Requirements:

  • the caller must have role's admin role.
function revokeRole(bytes32 role, address account) external nonpayable

Arguments

Name Type Description
role bytes32
account address
Source Code
function revokeRole(bytes32 role, address account) external;

renounceRole

Revokes role from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted role, emits a {RoleRevoked} event. Requirements:

  • the caller must be account.
function renounceRole(bytes32 role, address account) external nonpayable

Arguments

Name Type Description
role bytes32
account address
Source Code
function renounceRole(bytes32 role, address account) external;

Contracts