access.adoc 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884
  1. :github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
  2. :AccessControl: pass:normal[xref:access.adoc#AccessControl[`AccessControl`]]
  3. :Ownable: pass:normal[xref:access.adoc#Ownable[`Ownable`]]
  4. :xref-Ownable-onlyOwner--: xref:access.adoc#Ownable-onlyOwner--
  5. :xref-Ownable-constructor--: xref:access.adoc#Ownable-constructor--
  6. :xref-Ownable-owner--: xref:access.adoc#Ownable-owner--
  7. :xref-Ownable-_checkOwner--: xref:access.adoc#Ownable-_checkOwner--
  8. :xref-Ownable-renounceOwnership--: xref:access.adoc#Ownable-renounceOwnership--
  9. :xref-Ownable-transferOwnership-address-: xref:access.adoc#Ownable-transferOwnership-address-
  10. :xref-Ownable-_transferOwnership-address-: xref:access.adoc#Ownable-_transferOwnership-address-
  11. :xref-Ownable-OwnershipTransferred-address-address-: xref:access.adoc#Ownable-OwnershipTransferred-address-address-
  12. :xref-IAccessControl-hasRole-bytes32-address-: xref:access.adoc#IAccessControl-hasRole-bytes32-address-
  13. :xref-IAccessControl-getRoleAdmin-bytes32-: xref:access.adoc#IAccessControl-getRoleAdmin-bytes32-
  14. :xref-IAccessControl-grantRole-bytes32-address-: xref:access.adoc#IAccessControl-grantRole-bytes32-address-
  15. :xref-IAccessControl-revokeRole-bytes32-address-: xref:access.adoc#IAccessControl-revokeRole-bytes32-address-
  16. :xref-IAccessControl-renounceRole-bytes32-address-: xref:access.adoc#IAccessControl-renounceRole-bytes32-address-
  17. :xref-IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-: xref:access.adoc#IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-
  18. :xref-IAccessControl-RoleGranted-bytes32-address-address-: xref:access.adoc#IAccessControl-RoleGranted-bytes32-address-address-
  19. :xref-IAccessControl-RoleRevoked-bytes32-address-address-: xref:access.adoc#IAccessControl-RoleRevoked-bytes32-address-address-
  20. :AccessControl-_setRoleAdmin: pass:normal[xref:access.adoc#AccessControl-_setRoleAdmin-bytes32-bytes32-[`AccessControl._setRoleAdmin`]]
  21. :AccessControl-_setupRole: pass:normal[xref:access.adoc#AccessControl-_setupRole-bytes32-address-[`AccessControl._setupRole`]]
  22. :AccessControlEnumerable: pass:normal[xref:access.adoc#AccessControlEnumerable[`AccessControlEnumerable`]]
  23. :xref-AccessControl-onlyRole-bytes32-: xref:access.adoc#AccessControl-onlyRole-bytes32-
  24. :xref-AccessControl-supportsInterface-bytes4-: xref:access.adoc#AccessControl-supportsInterface-bytes4-
  25. :xref-AccessControl-hasRole-bytes32-address-: xref:access.adoc#AccessControl-hasRole-bytes32-address-
  26. :xref-AccessControl-_checkRole-bytes32-: xref:access.adoc#AccessControl-_checkRole-bytes32-
  27. :xref-AccessControl-_checkRole-bytes32-address-: xref:access.adoc#AccessControl-_checkRole-bytes32-address-
  28. :xref-AccessControl-getRoleAdmin-bytes32-: xref:access.adoc#AccessControl-getRoleAdmin-bytes32-
  29. :xref-AccessControl-grantRole-bytes32-address-: xref:access.adoc#AccessControl-grantRole-bytes32-address-
  30. :xref-AccessControl-revokeRole-bytes32-address-: xref:access.adoc#AccessControl-revokeRole-bytes32-address-
  31. :xref-AccessControl-renounceRole-bytes32-address-: xref:access.adoc#AccessControl-renounceRole-bytes32-address-
  32. :xref-AccessControl-_setupRole-bytes32-address-: xref:access.adoc#AccessControl-_setupRole-bytes32-address-
  33. :xref-AccessControl-_setRoleAdmin-bytes32-bytes32-: xref:access.adoc#AccessControl-_setRoleAdmin-bytes32-bytes32-
  34. :xref-AccessControl-_grantRole-bytes32-address-: xref:access.adoc#AccessControl-_grantRole-bytes32-address-
  35. :xref-AccessControl-_revokeRole-bytes32-address-: xref:access.adoc#AccessControl-_revokeRole-bytes32-address-
  36. :xref-IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-: xref:access.adoc#IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-
  37. :xref-IAccessControl-RoleGranted-bytes32-address-address-: xref:access.adoc#IAccessControl-RoleGranted-bytes32-address-address-
  38. :xref-IAccessControl-RoleRevoked-bytes32-address-address-: xref:access.adoc#IAccessControl-RoleRevoked-bytes32-address-address-
  39. :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
  40. :AccessControl: pass:normal[xref:access.adoc#AccessControl[`AccessControl`]]
  41. :AccessControl: pass:normal[xref:access.adoc#AccessControl[`AccessControl`]]
  42. :xref-AccessControlCrossChain-_checkRole-bytes32-: xref:access.adoc#AccessControlCrossChain-_checkRole-bytes32-
  43. :xref-AccessControlCrossChain-_crossChainRoleAlias-bytes32-: xref:access.adoc#AccessControlCrossChain-_crossChainRoleAlias-bytes32-
  44. :xref-CrossChainEnabled-_isCrossChain--: xref:crosschain.adoc#CrossChainEnabled-_isCrossChain--
  45. :xref-CrossChainEnabled-_crossChainSender--: xref:crosschain.adoc#CrossChainEnabled-_crossChainSender--
  46. :xref-AccessControl-supportsInterface-bytes4-: xref:access.adoc#AccessControl-supportsInterface-bytes4-
  47. :xref-AccessControl-hasRole-bytes32-address-: xref:access.adoc#AccessControl-hasRole-bytes32-address-
  48. :xref-AccessControl-_checkRole-bytes32-address-: xref:access.adoc#AccessControl-_checkRole-bytes32-address-
  49. :xref-AccessControl-getRoleAdmin-bytes32-: xref:access.adoc#AccessControl-getRoleAdmin-bytes32-
  50. :xref-AccessControl-grantRole-bytes32-address-: xref:access.adoc#AccessControl-grantRole-bytes32-address-
  51. :xref-AccessControl-revokeRole-bytes32-address-: xref:access.adoc#AccessControl-revokeRole-bytes32-address-
  52. :xref-AccessControl-renounceRole-bytes32-address-: xref:access.adoc#AccessControl-renounceRole-bytes32-address-
  53. :xref-AccessControl-_setupRole-bytes32-address-: xref:access.adoc#AccessControl-_setupRole-bytes32-address-
  54. :xref-AccessControl-_setRoleAdmin-bytes32-bytes32-: xref:access.adoc#AccessControl-_setRoleAdmin-bytes32-bytes32-
  55. :xref-AccessControl-_grantRole-bytes32-address-: xref:access.adoc#AccessControl-_grantRole-bytes32-address-
  56. :xref-AccessControl-_revokeRole-bytes32-address-: xref:access.adoc#AccessControl-_revokeRole-bytes32-address-
  57. :xref-IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-: xref:access.adoc#IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-
  58. :xref-IAccessControl-RoleGranted-bytes32-address-address-: xref:access.adoc#IAccessControl-RoleGranted-bytes32-address-address-
  59. :xref-IAccessControl-RoleRevoked-bytes32-address-address-: xref:access.adoc#IAccessControl-RoleRevoked-bytes32-address-address-
  60. :AccessControl-_checkRole: pass:normal[xref:access.adoc#AccessControl-_checkRole-bytes32-address-[`AccessControl._checkRole`]]
  61. :xref-IAccessControlEnumerable-getRoleMember-bytes32-uint256-: xref:access.adoc#IAccessControlEnumerable-getRoleMember-bytes32-uint256-
  62. :xref-IAccessControlEnumerable-getRoleMemberCount-bytes32-: xref:access.adoc#IAccessControlEnumerable-getRoleMemberCount-bytes32-
  63. :xref-IAccessControl-hasRole-bytes32-address-: xref:access.adoc#IAccessControl-hasRole-bytes32-address-
  64. :xref-IAccessControl-getRoleAdmin-bytes32-: xref:access.adoc#IAccessControl-getRoleAdmin-bytes32-
  65. :xref-IAccessControl-grantRole-bytes32-address-: xref:access.adoc#IAccessControl-grantRole-bytes32-address-
  66. :xref-IAccessControl-revokeRole-bytes32-address-: xref:access.adoc#IAccessControl-revokeRole-bytes32-address-
  67. :xref-IAccessControl-renounceRole-bytes32-address-: xref:access.adoc#IAccessControl-renounceRole-bytes32-address-
  68. :xref-IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-: xref:access.adoc#IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-
  69. :xref-IAccessControl-RoleGranted-bytes32-address-address-: xref:access.adoc#IAccessControl-RoleGranted-bytes32-address-address-
  70. :xref-IAccessControl-RoleRevoked-bytes32-address-address-: xref:access.adoc#IAccessControl-RoleRevoked-bytes32-address-address-
  71. :AccessControl: pass:normal[xref:access.adoc#AccessControl[`AccessControl`]]
  72. :xref-AccessControlEnumerable-supportsInterface-bytes4-: xref:access.adoc#AccessControlEnumerable-supportsInterface-bytes4-
  73. :xref-AccessControlEnumerable-getRoleMember-bytes32-uint256-: xref:access.adoc#AccessControlEnumerable-getRoleMember-bytes32-uint256-
  74. :xref-AccessControlEnumerable-getRoleMemberCount-bytes32-: xref:access.adoc#AccessControlEnumerable-getRoleMemberCount-bytes32-
  75. :xref-AccessControlEnumerable-_grantRole-bytes32-address-: xref:access.adoc#AccessControlEnumerable-_grantRole-bytes32-address-
  76. :xref-AccessControlEnumerable-_revokeRole-bytes32-address-: xref:access.adoc#AccessControlEnumerable-_revokeRole-bytes32-address-
  77. :xref-AccessControl-hasRole-bytes32-address-: xref:access.adoc#AccessControl-hasRole-bytes32-address-
  78. :xref-AccessControl-_checkRole-bytes32-: xref:access.adoc#AccessControl-_checkRole-bytes32-
  79. :xref-AccessControl-_checkRole-bytes32-address-: xref:access.adoc#AccessControl-_checkRole-bytes32-address-
  80. :xref-AccessControl-getRoleAdmin-bytes32-: xref:access.adoc#AccessControl-getRoleAdmin-bytes32-
  81. :xref-AccessControl-grantRole-bytes32-address-: xref:access.adoc#AccessControl-grantRole-bytes32-address-
  82. :xref-AccessControl-revokeRole-bytes32-address-: xref:access.adoc#AccessControl-revokeRole-bytes32-address-
  83. :xref-AccessControl-renounceRole-bytes32-address-: xref:access.adoc#AccessControl-renounceRole-bytes32-address-
  84. :xref-AccessControl-_setupRole-bytes32-address-: xref:access.adoc#AccessControl-_setupRole-bytes32-address-
  85. :xref-AccessControl-_setRoleAdmin-bytes32-bytes32-: xref:access.adoc#AccessControl-_setRoleAdmin-bytes32-bytes32-
  86. :xref-IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-: xref:access.adoc#IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-
  87. :xref-IAccessControl-RoleGranted-bytes32-address-address-: xref:access.adoc#IAccessControl-RoleGranted-bytes32-address-address-
  88. :xref-IAccessControl-RoleRevoked-bytes32-address-address-: xref:access.adoc#IAccessControl-RoleRevoked-bytes32-address-address-
  89. :IERC165-supportsInterface: pass:normal[xref:utils.adoc#IERC165-supportsInterface-bytes4-[`IERC165.supportsInterface`]]
  90. = Access Control
  91. [.readme-notice]
  92. NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/access
  93. This directory provides ways to restrict who can access the functions of a contract or when they can do it.
  94. - {AccessControl} provides a general role based access control mechanism. Multiple hierarchical roles can be created and assigned each to multiple accounts.
  95. - {Ownable} is a simpler mechanism with a single owner "role" that can be assigned to a single account. This simpler mechanism can be useful for quick tests but projects with production concerns are likely to outgrow it.
  96. == Authorization
  97. :_owner: pass:normal[xref:#Ownable-_owner-address[`++_owner++`]]
  98. :OwnershipTransferred: pass:normal[xref:#Ownable-OwnershipTransferred-address-address-[`++OwnershipTransferred++`]]
  99. :constructor: pass:normal[xref:#Ownable-constructor--[`++constructor++`]]
  100. :onlyOwner: pass:normal[xref:#Ownable-onlyOwner--[`++onlyOwner++`]]
  101. :owner: pass:normal[xref:#Ownable-owner--[`++owner++`]]
  102. :_checkOwner: pass:normal[xref:#Ownable-_checkOwner--[`++_checkOwner++`]]
  103. :renounceOwnership: pass:normal[xref:#Ownable-renounceOwnership--[`++renounceOwnership++`]]
  104. :transferOwnership: pass:normal[xref:#Ownable-transferOwnership-address-[`++transferOwnership++`]]
  105. :_transferOwnership: pass:normal[xref:#Ownable-_transferOwnership-address-[`++_transferOwnership++`]]
  106. [.contract]
  107. [[Ownable]]
  108. === `++Ownable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/access/Ownable.sol[{github-icon},role=heading-link]
  109. [.hljs-theme-light.nopadding]
  110. ```solidity
  111. import "@openzeppelin/contracts/access/Ownable.sol";
  112. ```
  113. Contract module which provides a basic access control mechanism, where
  114. there is an account (an owner) that can be granted exclusive access to
  115. specific functions.
  116. By default, the owner account will be the one that deploys the contract. This
  117. can later be changed with {transferOwnership}.
  118. This module is used through inheritance. It will make available the modifier
  119. `onlyOwner`, which can be applied to your functions to restrict their use to
  120. the owner.
  121. [.contract-index]
  122. .Modifiers
  123. --
  124. * {xref-Ownable-onlyOwner--}[`++onlyOwner()++`]
  125. --
  126. [.contract-index]
  127. .Functions
  128. --
  129. * {xref-Ownable-constructor--}[`++constructor()++`]
  130. * {xref-Ownable-owner--}[`++owner()++`]
  131. * {xref-Ownable-_checkOwner--}[`++_checkOwner()++`]
  132. * {xref-Ownable-renounceOwnership--}[`++renounceOwnership()++`]
  133. * {xref-Ownable-transferOwnership-address-}[`++transferOwnership(newOwner)++`]
  134. * {xref-Ownable-_transferOwnership-address-}[`++_transferOwnership(newOwner)++`]
  135. --
  136. [.contract-index]
  137. .Events
  138. --
  139. * {xref-Ownable-OwnershipTransferred-address-address-}[`++OwnershipTransferred(previousOwner, newOwner)++`]
  140. --
  141. [.contract-item]
  142. [[Ownable-onlyOwner--]]
  143. ==== `[.contract-item-name]#++onlyOwner++#++()++` [.item-kind]#modifier#
  144. Throws if called by any account other than the owner.
  145. [.contract-item]
  146. [[Ownable-constructor--]]
  147. ==== `[.contract-item-name]#++constructor++#++()++` [.item-kind]#internal#
  148. Initializes the contract setting the deployer as the initial owner.
  149. [.contract-item]
  150. [[Ownable-owner--]]
  151. ==== `[.contract-item-name]#++owner++#++() → address++` [.item-kind]#public#
  152. Returns the address of the current owner.
  153. [.contract-item]
  154. [[Ownable-_checkOwner--]]
  155. ==== `[.contract-item-name]#++_checkOwner++#++()++` [.item-kind]#internal#
  156. Throws if the sender is not the owner.
  157. [.contract-item]
  158. [[Ownable-renounceOwnership--]]
  159. ==== `[.contract-item-name]#++renounceOwnership++#++()++` [.item-kind]#public#
  160. Leaves the contract without owner. It will not be possible to call
  161. `onlyOwner` functions anymore. Can only be called by the current owner.
  162. NOTE: Renouncing ownership will leave the contract without an owner,
  163. thereby removing any functionality that is only available to the owner.
  164. [.contract-item]
  165. [[Ownable-transferOwnership-address-]]
  166. ==== `[.contract-item-name]#++transferOwnership++#++(address newOwner)++` [.item-kind]#public#
  167. Transfers ownership of the contract to a new account (`newOwner`).
  168. Can only be called by the current owner.
  169. [.contract-item]
  170. [[Ownable-_transferOwnership-address-]]
  171. ==== `[.contract-item-name]#++_transferOwnership++#++(address newOwner)++` [.item-kind]#internal#
  172. Transfers ownership of the contract to a new account (`newOwner`).
  173. Internal function without access restriction.
  174. [.contract-item]
  175. [[Ownable-OwnershipTransferred-address-address-]]
  176. ==== `[.contract-item-name]#++OwnershipTransferred++#++(address previousOwner, address newOwner)++` [.item-kind]#event#
  177. :RoleAdminChanged: pass:normal[xref:#IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-[`++RoleAdminChanged++`]]
  178. :RoleGranted: pass:normal[xref:#IAccessControl-RoleGranted-bytes32-address-address-[`++RoleGranted++`]]
  179. :RoleRevoked: pass:normal[xref:#IAccessControl-RoleRevoked-bytes32-address-address-[`++RoleRevoked++`]]
  180. :hasRole: pass:normal[xref:#IAccessControl-hasRole-bytes32-address-[`++hasRole++`]]
  181. :getRoleAdmin: pass:normal[xref:#IAccessControl-getRoleAdmin-bytes32-[`++getRoleAdmin++`]]
  182. :grantRole: pass:normal[xref:#IAccessControl-grantRole-bytes32-address-[`++grantRole++`]]
  183. :revokeRole: pass:normal[xref:#IAccessControl-revokeRole-bytes32-address-[`++revokeRole++`]]
  184. :renounceRole: pass:normal[xref:#IAccessControl-renounceRole-bytes32-address-[`++renounceRole++`]]
  185. [.contract]
  186. [[IAccessControl]]
  187. === `++IAccessControl++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/access/IAccessControl.sol[{github-icon},role=heading-link]
  188. [.hljs-theme-light.nopadding]
  189. ```solidity
  190. import "@openzeppelin/contracts/access/IAccessControl.sol";
  191. ```
  192. External interface of AccessControl declared to support ERC165 detection.
  193. [.contract-index]
  194. .Functions
  195. --
  196. * {xref-IAccessControl-hasRole-bytes32-address-}[`++hasRole(role, account)++`]
  197. * {xref-IAccessControl-getRoleAdmin-bytes32-}[`++getRoleAdmin(role)++`]
  198. * {xref-IAccessControl-grantRole-bytes32-address-}[`++grantRole(role, account)++`]
  199. * {xref-IAccessControl-revokeRole-bytes32-address-}[`++revokeRole(role, account)++`]
  200. * {xref-IAccessControl-renounceRole-bytes32-address-}[`++renounceRole(role, account)++`]
  201. --
  202. [.contract-index]
  203. .Events
  204. --
  205. * {xref-IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-}[`++RoleAdminChanged(role, previousAdminRole, newAdminRole)++`]
  206. * {xref-IAccessControl-RoleGranted-bytes32-address-address-}[`++RoleGranted(role, account, sender)++`]
  207. * {xref-IAccessControl-RoleRevoked-bytes32-address-address-}[`++RoleRevoked(role, account, sender)++`]
  208. --
  209. [.contract-item]
  210. [[IAccessControl-hasRole-bytes32-address-]]
  211. ==== `[.contract-item-name]#++hasRole++#++(bytes32 role, address account) → bool++` [.item-kind]#external#
  212. Returns `true` if `account` has been granted `role`.
  213. [.contract-item]
  214. [[IAccessControl-getRoleAdmin-bytes32-]]
  215. ==== `[.contract-item-name]#++getRoleAdmin++#++(bytes32 role) → bytes32++` [.item-kind]#external#
  216. Returns the admin role that controls `role`. See {grantRole} and
  217. {revokeRole}.
  218. To change a role's admin, use {AccessControl-_setRoleAdmin}.
  219. [.contract-item]
  220. [[IAccessControl-grantRole-bytes32-address-]]
  221. ==== `[.contract-item-name]#++grantRole++#++(bytes32 role, address account)++` [.item-kind]#external#
  222. Grants `role` to `account`.
  223. If `account` had not been already granted `role`, emits a {RoleGranted}
  224. event.
  225. Requirements:
  226. - the caller must have ``role``'s admin role.
  227. [.contract-item]
  228. [[IAccessControl-revokeRole-bytes32-address-]]
  229. ==== `[.contract-item-name]#++revokeRole++#++(bytes32 role, address account)++` [.item-kind]#external#
  230. Revokes `role` from `account`.
  231. If `account` had been granted `role`, emits a {RoleRevoked} event.
  232. Requirements:
  233. - the caller must have ``role``'s admin role.
  234. [.contract-item]
  235. [[IAccessControl-renounceRole-bytes32-address-]]
  236. ==== `[.contract-item-name]#++renounceRole++#++(bytes32 role, address account)++` [.item-kind]#external#
  237. Revokes `role` from the calling account.
  238. Roles are often managed via {grantRole} and {revokeRole}: this function's
  239. purpose is to provide a mechanism for accounts to lose their privileges
  240. if they are compromised (such as when a trusted device is misplaced).
  241. If the calling account had been granted `role`, emits a {RoleRevoked}
  242. event.
  243. Requirements:
  244. - the caller must be `account`.
  245. [.contract-item]
  246. [[IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-]]
  247. ==== `[.contract-item-name]#++RoleAdminChanged++#++(bytes32 role, bytes32 previousAdminRole, bytes32 newAdminRole)++` [.item-kind]#event#
  248. Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
  249. `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
  250. {RoleAdminChanged} not being emitted signaling this.
  251. _Available since v3.1._
  252. [.contract-item]
  253. [[IAccessControl-RoleGranted-bytes32-address-address-]]
  254. ==== `[.contract-item-name]#++RoleGranted++#++(bytes32 role, address account, address sender)++` [.item-kind]#event#
  255. Emitted when `account` is granted `role`.
  256. `sender` is the account that originated the contract call, an admin role
  257. bearer except when using {AccessControl-_setupRole}.
  258. [.contract-item]
  259. [[IAccessControl-RoleRevoked-bytes32-address-address-]]
  260. ==== `[.contract-item-name]#++RoleRevoked++#++(bytes32 role, address account, address sender)++` [.item-kind]#event#
  261. Emitted when `account` is revoked `role`.
  262. `sender` is the account that originated the contract call:
  263. - if using `revokeRole`, it is the admin role bearer
  264. - if using `renounceRole`, it is the role bearer (i.e. `account`)
  265. :RoleData: pass:normal[xref:#AccessControl-RoleData[`++RoleData++`]]
  266. :_roles: pass:normal[xref:#AccessControl-_roles-mapping-bytes32----struct-AccessControl-RoleData-[`++_roles++`]]
  267. :DEFAULT_ADMIN_ROLE: pass:normal[xref:#AccessControl-DEFAULT_ADMIN_ROLE-bytes32[`++DEFAULT_ADMIN_ROLE++`]]
  268. :onlyRole: pass:normal[xref:#AccessControl-onlyRole-bytes32-[`++onlyRole++`]]
  269. :supportsInterface: pass:normal[xref:#AccessControl-supportsInterface-bytes4-[`++supportsInterface++`]]
  270. :hasRole: pass:normal[xref:#AccessControl-hasRole-bytes32-address-[`++hasRole++`]]
  271. :_checkRole: pass:normal[xref:#AccessControl-_checkRole-bytes32-[`++_checkRole++`]]
  272. :_checkRole: pass:normal[xref:#AccessControl-_checkRole-bytes32-address-[`++_checkRole++`]]
  273. :getRoleAdmin: pass:normal[xref:#AccessControl-getRoleAdmin-bytes32-[`++getRoleAdmin++`]]
  274. :grantRole: pass:normal[xref:#AccessControl-grantRole-bytes32-address-[`++grantRole++`]]
  275. :revokeRole: pass:normal[xref:#AccessControl-revokeRole-bytes32-address-[`++revokeRole++`]]
  276. :renounceRole: pass:normal[xref:#AccessControl-renounceRole-bytes32-address-[`++renounceRole++`]]
  277. :_setupRole: pass:normal[xref:#AccessControl-_setupRole-bytes32-address-[`++_setupRole++`]]
  278. :_setRoleAdmin: pass:normal[xref:#AccessControl-_setRoleAdmin-bytes32-bytes32-[`++_setRoleAdmin++`]]
  279. :_grantRole: pass:normal[xref:#AccessControl-_grantRole-bytes32-address-[`++_grantRole++`]]
  280. :_revokeRole: pass:normal[xref:#AccessControl-_revokeRole-bytes32-address-[`++_revokeRole++`]]
  281. [.contract]
  282. [[AccessControl]]
  283. === `++AccessControl++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/access/AccessControl.sol[{github-icon},role=heading-link]
  284. [.hljs-theme-light.nopadding]
  285. ```solidity
  286. import "@openzeppelin/contracts/access/AccessControl.sol";
  287. ```
  288. Contract module that allows children to implement role-based access
  289. control mechanisms. This is a lightweight version that doesn't allow enumerating role
  290. members except through off-chain means by accessing the contract event logs. Some
  291. applications may benefit from on-chain enumerability, for those cases see
  292. {AccessControlEnumerable}.
  293. Roles are referred to by their `bytes32` identifier. These should be exposed
  294. in the external API and be unique. The best way to achieve this is by
  295. using `public constant` hash digests:
  296. ```
  297. bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
  298. ```
  299. Roles can be used to represent a set of permissions. To restrict access to a
  300. function call, use {hasRole}:
  301. ```
  302. function foo() public {
  303. require(hasRole(MY_ROLE, msg.sender));
  304. ...
  305. }
  306. ```
  307. Roles can be granted and revoked dynamically via the {grantRole} and
  308. {revokeRole} functions. Each role has an associated admin role, and only
  309. accounts that have a role's admin role can call {grantRole} and {revokeRole}.
  310. By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
  311. that only accounts with this role will be able to grant or revoke other
  312. roles. More complex role relationships can be created by using
  313. {_setRoleAdmin}.
  314. WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
  315. grant and revoke this role. Extra precautions should be taken to secure
  316. accounts that have been granted it.
  317. [.contract-index]
  318. .Modifiers
  319. --
  320. * {xref-AccessControl-onlyRole-bytes32-}[`++onlyRole(role)++`]
  321. --
  322. [.contract-index]
  323. .Functions
  324. --
  325. * {xref-AccessControl-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
  326. * {xref-AccessControl-hasRole-bytes32-address-}[`++hasRole(role, account)++`]
  327. * {xref-AccessControl-_checkRole-bytes32-}[`++_checkRole(role)++`]
  328. * {xref-AccessControl-_checkRole-bytes32-address-}[`++_checkRole(role, account)++`]
  329. * {xref-AccessControl-getRoleAdmin-bytes32-}[`++getRoleAdmin(role)++`]
  330. * {xref-AccessControl-grantRole-bytes32-address-}[`++grantRole(role, account)++`]
  331. * {xref-AccessControl-revokeRole-bytes32-address-}[`++revokeRole(role, account)++`]
  332. * {xref-AccessControl-renounceRole-bytes32-address-}[`++renounceRole(role, account)++`]
  333. * {xref-AccessControl-_setupRole-bytes32-address-}[`++_setupRole(role, account)++`]
  334. * {xref-AccessControl-_setRoleAdmin-bytes32-bytes32-}[`++_setRoleAdmin(role, adminRole)++`]
  335. * {xref-AccessControl-_grantRole-bytes32-address-}[`++_grantRole(role, account)++`]
  336. * {xref-AccessControl-_revokeRole-bytes32-address-}[`++_revokeRole(role, account)++`]
  337. [.contract-subindex-inherited]
  338. .ERC165
  339. [.contract-subindex-inherited]
  340. .IERC165
  341. [.contract-subindex-inherited]
  342. .IAccessControl
  343. --
  344. [.contract-index]
  345. .Events
  346. --
  347. [.contract-subindex-inherited]
  348. .ERC165
  349. [.contract-subindex-inherited]
  350. .IERC165
  351. [.contract-subindex-inherited]
  352. .IAccessControl
  353. * {xref-IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-}[`++RoleAdminChanged(role, previousAdminRole, newAdminRole)++`]
  354. * {xref-IAccessControl-RoleGranted-bytes32-address-address-}[`++RoleGranted(role, account, sender)++`]
  355. * {xref-IAccessControl-RoleRevoked-bytes32-address-address-}[`++RoleRevoked(role, account, sender)++`]
  356. --
  357. [.contract-item]
  358. [[AccessControl-onlyRole-bytes32-]]
  359. ==== `[.contract-item-name]#++onlyRole++#++(bytes32 role)++` [.item-kind]#modifier#
  360. Modifier that checks that an account has a specific role. Reverts
  361. with a standardized message including the required role.
  362. The format of the revert reason is given by the following regular expression:
  363. /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
  364. _Available since v4.1._
  365. [.contract-item]
  366. [[AccessControl-supportsInterface-bytes4-]]
  367. ==== `[.contract-item-name]#++supportsInterface++#++(bytes4 interfaceId) → bool++` [.item-kind]#public#
  368. See {IERC165-supportsInterface}.
  369. [.contract-item]
  370. [[AccessControl-hasRole-bytes32-address-]]
  371. ==== `[.contract-item-name]#++hasRole++#++(bytes32 role, address account) → bool++` [.item-kind]#public#
  372. Returns `true` if `account` has been granted `role`.
  373. [.contract-item]
  374. [[AccessControl-_checkRole-bytes32-]]
  375. ==== `[.contract-item-name]#++_checkRole++#++(bytes32 role)++` [.item-kind]#internal#
  376. Revert with a standard message if `_msgSender()` is missing `role`.
  377. Overriding this function changes the behavior of the {onlyRole} modifier.
  378. Format of the revert message is described in {_checkRole}.
  379. _Available since v4.6._
  380. [.contract-item]
  381. [[AccessControl-_checkRole-bytes32-address-]]
  382. ==== `[.contract-item-name]#++_checkRole++#++(bytes32 role, address account)++` [.item-kind]#internal#
  383. Revert with a standard message if `account` is missing `role`.
  384. The format of the revert reason is given by the following regular expression:
  385. /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
  386. [.contract-item]
  387. [[AccessControl-getRoleAdmin-bytes32-]]
  388. ==== `[.contract-item-name]#++getRoleAdmin++#++(bytes32 role) → bytes32++` [.item-kind]#public#
  389. Returns the admin role that controls `role`. See {grantRole} and
  390. {revokeRole}.
  391. To change a role's admin, use {_setRoleAdmin}.
  392. [.contract-item]
  393. [[AccessControl-grantRole-bytes32-address-]]
  394. ==== `[.contract-item-name]#++grantRole++#++(bytes32 role, address account)++` [.item-kind]#public#
  395. Grants `role` to `account`.
  396. If `account` had not been already granted `role`, emits a {RoleGranted}
  397. event.
  398. Requirements:
  399. - the caller must have ``role``'s admin role.
  400. May emit a {RoleGranted} event.
  401. [.contract-item]
  402. [[AccessControl-revokeRole-bytes32-address-]]
  403. ==== `[.contract-item-name]#++revokeRole++#++(bytes32 role, address account)++` [.item-kind]#public#
  404. Revokes `role` from `account`.
  405. If `account` had been granted `role`, emits a {RoleRevoked} event.
  406. Requirements:
  407. - the caller must have ``role``'s admin role.
  408. May emit a {RoleRevoked} event.
  409. [.contract-item]
  410. [[AccessControl-renounceRole-bytes32-address-]]
  411. ==== `[.contract-item-name]#++renounceRole++#++(bytes32 role, address account)++` [.item-kind]#public#
  412. Revokes `role` from the calling account.
  413. Roles are often managed via {grantRole} and {revokeRole}: this function's
  414. purpose is to provide a mechanism for accounts to lose their privileges
  415. if they are compromised (such as when a trusted device is misplaced).
  416. If the calling account had been revoked `role`, emits a {RoleRevoked}
  417. event.
  418. Requirements:
  419. - the caller must be `account`.
  420. May emit a {RoleRevoked} event.
  421. [.contract-item]
  422. [[AccessControl-_setupRole-bytes32-address-]]
  423. ==== `[.contract-item-name]#++_setupRole++#++(bytes32 role, address account)++` [.item-kind]#internal#
  424. Grants `role` to `account`.
  425. If `account` had not been already granted `role`, emits a {RoleGranted}
  426. event. Note that unlike {grantRole}, this function doesn't perform any
  427. checks on the calling account.
  428. May emit a {RoleGranted} event.
  429. [WARNING]
  430. ====
  431. This function should only be called from the constructor when setting
  432. up the initial roles for the system.
  433. Using this function in any other way is effectively circumventing the admin
  434. system imposed by {AccessControl}.
  435. ====
  436. NOTE: This function is deprecated in favor of {_grantRole}.
  437. [.contract-item]
  438. [[AccessControl-_setRoleAdmin-bytes32-bytes32-]]
  439. ==== `[.contract-item-name]#++_setRoleAdmin++#++(bytes32 role, bytes32 adminRole)++` [.item-kind]#internal#
  440. Sets `adminRole` as ``role``'s admin role.
  441. Emits a {RoleAdminChanged} event.
  442. [.contract-item]
  443. [[AccessControl-_grantRole-bytes32-address-]]
  444. ==== `[.contract-item-name]#++_grantRole++#++(bytes32 role, address account)++` [.item-kind]#internal#
  445. Grants `role` to `account`.
  446. Internal function without access restriction.
  447. May emit a {RoleGranted} event.
  448. [.contract-item]
  449. [[AccessControl-_revokeRole-bytes32-address-]]
  450. ==== `[.contract-item-name]#++_revokeRole++#++(bytes32 role, address account)++` [.item-kind]#internal#
  451. Revokes `role` from `account`.
  452. Internal function without access restriction.
  453. May emit a {RoleRevoked} event.
  454. :CROSSCHAIN_ALIAS: pass:normal[xref:#AccessControlCrossChain-CROSSCHAIN_ALIAS-bytes32[`++CROSSCHAIN_ALIAS++`]]
  455. :_checkRole: pass:normal[xref:#AccessControlCrossChain-_checkRole-bytes32-[`++_checkRole++`]]
  456. :_crossChainRoleAlias: pass:normal[xref:#AccessControlCrossChain-_crossChainRoleAlias-bytes32-[`++_crossChainRoleAlias++`]]
  457. [.contract]
  458. [[AccessControlCrossChain]]
  459. === `++AccessControlCrossChain++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/access/AccessControlCrossChain.sol[{github-icon},role=heading-link]
  460. [.hljs-theme-light.nopadding]
  461. ```solidity
  462. import "@openzeppelin/contracts/access/AccessControlCrossChain.sol";
  463. ```
  464. An extension to {AccessControl} with support for cross-chain access management.
  465. For each role, is extension implements an equivalent "aliased" role that is used for
  466. restricting calls originating from other chains.
  467. For example, if a function `myFunction` is protected by `onlyRole(SOME_ROLE)`, and
  468. if an address `x` has role `SOME_ROLE`, it would be able to call `myFunction` directly.
  469. A wallet or contract at the same address on another chain would however not be able
  470. to call this function. In order to do so, it would require to have the role
  471. `_crossChainRoleAlias(SOME_ROLE)`.
  472. This aliasing is required to protect against multiple contracts living at the same
  473. address on different chains but controlled by conflicting entities.
  474. _Available since v4.6._
  475. [.contract-index]
  476. .Functions
  477. --
  478. * {xref-AccessControlCrossChain-_checkRole-bytes32-}[`++_checkRole(role)++`]
  479. * {xref-AccessControlCrossChain-_crossChainRoleAlias-bytes32-}[`++_crossChainRoleAlias(role)++`]
  480. [.contract-subindex-inherited]
  481. .CrossChainEnabled
  482. * {xref-CrossChainEnabled-_isCrossChain--}[`++_isCrossChain()++`]
  483. * {xref-CrossChainEnabled-_crossChainSender--}[`++_crossChainSender()++`]
  484. [.contract-subindex-inherited]
  485. .AccessControl
  486. * {xref-AccessControl-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
  487. * {xref-AccessControl-hasRole-bytes32-address-}[`++hasRole(role, account)++`]
  488. * {xref-AccessControl-_checkRole-bytes32-address-}[`++_checkRole(role, account)++`]
  489. * {xref-AccessControl-getRoleAdmin-bytes32-}[`++getRoleAdmin(role)++`]
  490. * {xref-AccessControl-grantRole-bytes32-address-}[`++grantRole(role, account)++`]
  491. * {xref-AccessControl-revokeRole-bytes32-address-}[`++revokeRole(role, account)++`]
  492. * {xref-AccessControl-renounceRole-bytes32-address-}[`++renounceRole(role, account)++`]
  493. * {xref-AccessControl-_setupRole-bytes32-address-}[`++_setupRole(role, account)++`]
  494. * {xref-AccessControl-_setRoleAdmin-bytes32-bytes32-}[`++_setRoleAdmin(role, adminRole)++`]
  495. * {xref-AccessControl-_grantRole-bytes32-address-}[`++_grantRole(role, account)++`]
  496. * {xref-AccessControl-_revokeRole-bytes32-address-}[`++_revokeRole(role, account)++`]
  497. [.contract-subindex-inherited]
  498. .ERC165
  499. [.contract-subindex-inherited]
  500. .IERC165
  501. [.contract-subindex-inherited]
  502. .IAccessControl
  503. --
  504. [.contract-index]
  505. .Events
  506. --
  507. [.contract-subindex-inherited]
  508. .CrossChainEnabled
  509. [.contract-subindex-inherited]
  510. .AccessControl
  511. [.contract-subindex-inherited]
  512. .ERC165
  513. [.contract-subindex-inherited]
  514. .IERC165
  515. [.contract-subindex-inherited]
  516. .IAccessControl
  517. * {xref-IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-}[`++RoleAdminChanged(role, previousAdminRole, newAdminRole)++`]
  518. * {xref-IAccessControl-RoleGranted-bytes32-address-address-}[`++RoleGranted(role, account, sender)++`]
  519. * {xref-IAccessControl-RoleRevoked-bytes32-address-address-}[`++RoleRevoked(role, account, sender)++`]
  520. --
  521. [.contract-item]
  522. [[AccessControlCrossChain-_checkRole-bytes32-]]
  523. ==== `[.contract-item-name]#++_checkRole++#++(bytes32 role)++` [.item-kind]#internal#
  524. See {AccessControl-_checkRole}.
  525. [.contract-item]
  526. [[AccessControlCrossChain-_crossChainRoleAlias-bytes32-]]
  527. ==== `[.contract-item-name]#++_crossChainRoleAlias++#++(bytes32 role) → bytes32++` [.item-kind]#internal#
  528. Returns the aliased role corresponding to `role`.
  529. :getRoleMember: pass:normal[xref:#IAccessControlEnumerable-getRoleMember-bytes32-uint256-[`++getRoleMember++`]]
  530. :getRoleMemberCount: pass:normal[xref:#IAccessControlEnumerable-getRoleMemberCount-bytes32-[`++getRoleMemberCount++`]]
  531. [.contract]
  532. [[IAccessControlEnumerable]]
  533. === `++IAccessControlEnumerable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/access/IAccessControlEnumerable.sol[{github-icon},role=heading-link]
  534. [.hljs-theme-light.nopadding]
  535. ```solidity
  536. import "@openzeppelin/contracts/access/IAccessControlEnumerable.sol";
  537. ```
  538. External interface of AccessControlEnumerable declared to support ERC165 detection.
  539. [.contract-index]
  540. .Functions
  541. --
  542. * {xref-IAccessControlEnumerable-getRoleMember-bytes32-uint256-}[`++getRoleMember(role, index)++`]
  543. * {xref-IAccessControlEnumerable-getRoleMemberCount-bytes32-}[`++getRoleMemberCount(role)++`]
  544. [.contract-subindex-inherited]
  545. .IAccessControl
  546. * {xref-IAccessControl-hasRole-bytes32-address-}[`++hasRole(role, account)++`]
  547. * {xref-IAccessControl-getRoleAdmin-bytes32-}[`++getRoleAdmin(role)++`]
  548. * {xref-IAccessControl-grantRole-bytes32-address-}[`++grantRole(role, account)++`]
  549. * {xref-IAccessControl-revokeRole-bytes32-address-}[`++revokeRole(role, account)++`]
  550. * {xref-IAccessControl-renounceRole-bytes32-address-}[`++renounceRole(role, account)++`]
  551. --
  552. [.contract-index]
  553. .Events
  554. --
  555. [.contract-subindex-inherited]
  556. .IAccessControl
  557. * {xref-IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-}[`++RoleAdminChanged(role, previousAdminRole, newAdminRole)++`]
  558. * {xref-IAccessControl-RoleGranted-bytes32-address-address-}[`++RoleGranted(role, account, sender)++`]
  559. * {xref-IAccessControl-RoleRevoked-bytes32-address-address-}[`++RoleRevoked(role, account, sender)++`]
  560. --
  561. [.contract-item]
  562. [[IAccessControlEnumerable-getRoleMember-bytes32-uint256-]]
  563. ==== `[.contract-item-name]#++getRoleMember++#++(bytes32 role, uint256 index) → address++` [.item-kind]#external#
  564. Returns one of the accounts that have `role`. `index` must be a
  565. value between 0 and {getRoleMemberCount}, non-inclusive.
  566. Role bearers are not sorted in any particular way, and their ordering may
  567. change at any point.
  568. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
  569. you perform all queries on the same block. See the following
  570. https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
  571. for more information.
  572. [.contract-item]
  573. [[IAccessControlEnumerable-getRoleMemberCount-bytes32-]]
  574. ==== `[.contract-item-name]#++getRoleMemberCount++#++(bytes32 role) → uint256++` [.item-kind]#external#
  575. Returns the number of accounts that have `role`. Can be used
  576. together with {getRoleMember} to enumerate all bearers of a role.
  577. :_roleMembers: pass:normal[xref:#AccessControlEnumerable-_roleMembers-mapping-bytes32----struct-EnumerableSet-AddressSet-[`++_roleMembers++`]]
  578. :supportsInterface: pass:normal[xref:#AccessControlEnumerable-supportsInterface-bytes4-[`++supportsInterface++`]]
  579. :getRoleMember: pass:normal[xref:#AccessControlEnumerable-getRoleMember-bytes32-uint256-[`++getRoleMember++`]]
  580. :getRoleMemberCount: pass:normal[xref:#AccessControlEnumerable-getRoleMemberCount-bytes32-[`++getRoleMemberCount++`]]
  581. :_grantRole: pass:normal[xref:#AccessControlEnumerable-_grantRole-bytes32-address-[`++_grantRole++`]]
  582. :_revokeRole: pass:normal[xref:#AccessControlEnumerable-_revokeRole-bytes32-address-[`++_revokeRole++`]]
  583. [.contract]
  584. [[AccessControlEnumerable]]
  585. === `++AccessControlEnumerable++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/access/AccessControlEnumerable.sol[{github-icon},role=heading-link]
  586. [.hljs-theme-light.nopadding]
  587. ```solidity
  588. import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
  589. ```
  590. Extension of {AccessControl} that allows enumerating the members of each role.
  591. [.contract-index]
  592. .Functions
  593. --
  594. * {xref-AccessControlEnumerable-supportsInterface-bytes4-}[`++supportsInterface(interfaceId)++`]
  595. * {xref-AccessControlEnumerable-getRoleMember-bytes32-uint256-}[`++getRoleMember(role, index)++`]
  596. * {xref-AccessControlEnumerable-getRoleMemberCount-bytes32-}[`++getRoleMemberCount(role)++`]
  597. * {xref-AccessControlEnumerable-_grantRole-bytes32-address-}[`++_grantRole(role, account)++`]
  598. * {xref-AccessControlEnumerable-_revokeRole-bytes32-address-}[`++_revokeRole(role, account)++`]
  599. [.contract-subindex-inherited]
  600. .AccessControl
  601. * {xref-AccessControl-hasRole-bytes32-address-}[`++hasRole(role, account)++`]
  602. * {xref-AccessControl-_checkRole-bytes32-}[`++_checkRole(role)++`]
  603. * {xref-AccessControl-_checkRole-bytes32-address-}[`++_checkRole(role, account)++`]
  604. * {xref-AccessControl-getRoleAdmin-bytes32-}[`++getRoleAdmin(role)++`]
  605. * {xref-AccessControl-grantRole-bytes32-address-}[`++grantRole(role, account)++`]
  606. * {xref-AccessControl-revokeRole-bytes32-address-}[`++revokeRole(role, account)++`]
  607. * {xref-AccessControl-renounceRole-bytes32-address-}[`++renounceRole(role, account)++`]
  608. * {xref-AccessControl-_setupRole-bytes32-address-}[`++_setupRole(role, account)++`]
  609. * {xref-AccessControl-_setRoleAdmin-bytes32-bytes32-}[`++_setRoleAdmin(role, adminRole)++`]
  610. [.contract-subindex-inherited]
  611. .ERC165
  612. [.contract-subindex-inherited]
  613. .IERC165
  614. [.contract-subindex-inherited]
  615. .IAccessControlEnumerable
  616. [.contract-subindex-inherited]
  617. .IAccessControl
  618. --
  619. [.contract-index]
  620. .Events
  621. --
  622. [.contract-subindex-inherited]
  623. .AccessControl
  624. [.contract-subindex-inherited]
  625. .ERC165
  626. [.contract-subindex-inherited]
  627. .IERC165
  628. [.contract-subindex-inherited]
  629. .IAccessControlEnumerable
  630. [.contract-subindex-inherited]
  631. .IAccessControl
  632. * {xref-IAccessControl-RoleAdminChanged-bytes32-bytes32-bytes32-}[`++RoleAdminChanged(role, previousAdminRole, newAdminRole)++`]
  633. * {xref-IAccessControl-RoleGranted-bytes32-address-address-}[`++RoleGranted(role, account, sender)++`]
  634. * {xref-IAccessControl-RoleRevoked-bytes32-address-address-}[`++RoleRevoked(role, account, sender)++`]
  635. --
  636. [.contract-item]
  637. [[AccessControlEnumerable-supportsInterface-bytes4-]]
  638. ==== `[.contract-item-name]#++supportsInterface++#++(bytes4 interfaceId) → bool++` [.item-kind]#public#
  639. See {IERC165-supportsInterface}.
  640. [.contract-item]
  641. [[AccessControlEnumerable-getRoleMember-bytes32-uint256-]]
  642. ==== `[.contract-item-name]#++getRoleMember++#++(bytes32 role, uint256 index) → address++` [.item-kind]#public#
  643. Returns one of the accounts that have `role`. `index` must be a
  644. value between 0 and {getRoleMemberCount}, non-inclusive.
  645. Role bearers are not sorted in any particular way, and their ordering may
  646. change at any point.
  647. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
  648. you perform all queries on the same block. See the following
  649. https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
  650. for more information.
  651. [.contract-item]
  652. [[AccessControlEnumerable-getRoleMemberCount-bytes32-]]
  653. ==== `[.contract-item-name]#++getRoleMemberCount++#++(bytes32 role) → uint256++` [.item-kind]#public#
  654. Returns the number of accounts that have `role`. Can be used
  655. together with {getRoleMember} to enumerate all bearers of a role.
  656. [.contract-item]
  657. [[AccessControlEnumerable-_grantRole-bytes32-address-]]
  658. ==== `[.contract-item-name]#++_grantRole++#++(bytes32 role, address account)++` [.item-kind]#internal#
  659. Overload {_grantRole} to track enumerable memberships
  660. [.contract-item]
  661. [[AccessControlEnumerable-_revokeRole-bytes32-address-]]
  662. ==== `[.contract-item-name]#++_revokeRole++#++(bytes32 role, address account)++` [.item-kind]#internal#
  663. Overload {_revokeRole} to track enumerable memberships