IAccessControl.sol 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
  3. pragma solidity ^0.8.19;
  4. /**
  5. * @dev External interface of AccessControl declared to support ERC165 detection.
  6. */
  7. interface IAccessControl {
  8. /**
  9. * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
  10. *
  11. * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
  12. * {RoleAdminChanged} not being emitted signaling this.
  13. *
  14. * _Available since v3.1._
  15. */
  16. event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
  17. /**
  18. * @dev Emitted when `account` is granted `role`.
  19. *
  20. * `sender` is the account that originated the contract call, an admin role
  21. * bearer except when using {AccessControl-_setupRole}.
  22. */
  23. event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
  24. /**
  25. * @dev Emitted when `account` is revoked `role`.
  26. *
  27. * `sender` is the account that originated the contract call:
  28. * - if using `revokeRole`, it is the admin role bearer
  29. * - if using `renounceRole`, it is the role bearer (i.e. `account`)
  30. */
  31. event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
  32. /**
  33. * @dev Returns `true` if `account` has been granted `role`.
  34. */
  35. function hasRole(bytes32 role, address account) external view returns (bool);
  36. /**
  37. * @dev Returns the admin role that controls `role`. See {grantRole} and
  38. * {revokeRole}.
  39. *
  40. * To change a role's admin, use {AccessControl-_setRoleAdmin}.
  41. */
  42. function getRoleAdmin(bytes32 role) external view returns (bytes32);
  43. /**
  44. * @dev Grants `role` to `account`.
  45. *
  46. * If `account` had not been already granted `role`, emits a {RoleGranted}
  47. * event.
  48. *
  49. * Requirements:
  50. *
  51. * - the caller must have ``role``'s admin role.
  52. */
  53. function grantRole(bytes32 role, address account) external;
  54. /**
  55. * @dev Revokes `role` from `account`.
  56. *
  57. * If `account` had been granted `role`, emits a {RoleRevoked} event.
  58. *
  59. * Requirements:
  60. *
  61. * - the caller must have ``role``'s admin role.
  62. */
  63. function revokeRole(bytes32 role, address account) external;
  64. /**
  65. * @dev Revokes `role` from the calling account.
  66. *
  67. * Roles are often managed via {grantRole} and {revokeRole}: this function's
  68. * purpose is to provide a mechanism for accounts to lose their privileges
  69. * if they are compromised (such as when a trusted device is misplaced).
  70. *
  71. * If the calling account had been granted `role`, emits a {RoleRevoked}
  72. * event.
  73. *
  74. * Requirements:
  75. *
  76. * - the caller must be `account`.
  77. */
  78. function renounceRole(bytes32 role, address account) external;
  79. }