You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/zkEVM/architecture/high-level/smart-contracts/api/lib/PolygonAccessControlUpgradeable.md
+13-15Lines changed: 13 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
A contract that inherits `AccessControlUpgradeable` from Openzeppelin, but with the following modifications:
2
2
3
-
-Delete`ERC165Upgradeable` dependencies to save us the "gap" variables and let us have consistent storage.
4
-
-Add the legacy `Owner` variable, to be consistent with the previous.
5
-
-Add custom errors.
6
-
-Replace`_msgSender()` with `msg.sender`.
3
+
-Deleted`ERC165Upgradeable` dependencies to save us the "gap" variables and let us have consistent storage.
4
+
-Added the legacy `Owner` variable, to be consistent with the previous.
5
+
-Added custom errors.
6
+
-Replaced`_msgSender()` with `msg.sender`.
7
7
8
8
## Functions
9
9
@@ -59,27 +59,25 @@ To change a role's admin, use `_setRoleAdmin`.
59
59
60
60
### `grantRole`
61
61
62
-
Grants `role` to `account`. If `account` had not been already granted `role`, it emits a `RoleGranted` event.
62
+
Grants `role` to `account`. If `account` had not been granted `role`, it emits a `RoleGranted` event.
63
63
64
64
```solidity
65
65
function grantRole(
66
66
) public
67
67
```
68
68
69
-
- The caller must have `role`'s admin role.
69
+
- The caller must have the `role` as the admin role.
70
70
- May emit a `RoleGranted` event.
71
71
72
72
### `revokeRole`
73
73
74
-
Revokes `role` from `account`. If `account` had been granted `role`, emits a `RoleRevoked` event.
74
+
Revokes `role` from `account`. If `account` had been granted `role`, this function emits a `RoleRevoked` event.
75
75
76
76
```solidity
77
77
function revokeRole(
78
78
) public
79
79
```
80
80
81
-
82
-
83
81
### `renounceRole`
84
82
85
83
Revokes `role` from the calling account.
@@ -89,12 +87,12 @@ Revokes `role` from the calling account.
89
87
) public
90
88
```
91
89
92
-
- The caller must have `account`'s admin role.
90
+
- The caller must have the admin role`account`.
93
91
- May emit a `RoleRevoked` event.
94
92
95
93
Roles are often managed via `grantRole` and `revokeRole`. The purpose of this function is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced).
96
94
97
-
Emits a `RoleRevoked`event if the calling account had `role` revoked.
95
+
Emits a `RoleRevoked`event if the calling account had its `role` revoked.
98
96
99
97
### `_setupRole`
100
98
@@ -103,23 +101,23 @@ Emits a `RoleRevoked`event if the calling account had `role` revoked.
103
101
) internal
104
102
```
105
103
106
-
Grants `role` to `account`.
104
+
Grants `role` to an `account`.
107
105
108
-
Emits a `RoleGranted`event if `account` had not been already granted `role`.
106
+
Emits a `RoleGranted`event if `account` had not been granted `role` before.
109
107
Note that unlike `grantRole`, this function doesn't perform any checks on the calling account.
110
108
111
109
May emit a `RoleGranted` event.
112
110
113
111
!!! warn
114
-
- This function should only be called from the constructor when setting up the initial roles for the system.
112
+
- This function should only be called from the constructor, when setting up the initial roles for the system.
115
113
- Using this function in any other way is effectively circumventing the admin system imposed by `AccessControl`.
116
114
117
115
!!! note
118
116
- This function is deprecated in favor of `_grantRole`.
0 commit comments