access.adoc 44 KB

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