Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
1ebeef7f
Unverified
Commit
1ebeef7f
authored
Apr 10, 2019
by
Nicolás Venturo
Committed by
GitHub
Apr 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary SLOAD. (#1715)
parent
b353f7e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
5 deletions
+3
-5
Roles.sol
contracts/access/Roles.sol
+0
-2
Roles.test.js
test/access/Roles.test.js
+3
-3
No files found.
contracts/access/Roles.sol
View file @
1ebeef7f
...
@@ -13,7 +13,6 @@ library Roles {
...
@@ -13,7 +13,6 @@ library Roles {
* @dev Give an account access to this role.
* @dev Give an account access to this role.
*/
*/
function add(Role storage role, address account) internal {
function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
require(!has(role, account));
role.bearer[account] = true;
role.bearer[account] = true;
...
@@ -23,7 +22,6 @@ library Roles {
...
@@ -23,7 +22,6 @@ library Roles {
* @dev Remove an account's access to this role.
* @dev Remove an account's access to this role.
*/
*/
function remove(Role storage role, address account) internal {
function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
require(has(role, account));
role.bearer[account] = false;
role.bearer[account] = false;
...
...
test/access/Roles.test.js
View file @
1ebeef7f
...
@@ -8,7 +8,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
...
@@ -8,7 +8,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
this
.
roles
=
await
RolesMock
.
new
();
this
.
roles
=
await
RolesMock
.
new
();
});
});
it
(
'reverts when querying roles for the
null
account'
,
async
function
()
{
it
(
'reverts when querying roles for the
zero
account'
,
async
function
()
{
await
shouldFail
.
reverting
(
this
.
roles
.
has
(
ZERO_ADDRESS
));
await
shouldFail
.
reverting
(
this
.
roles
.
has
(
ZERO_ADDRESS
));
});
});
...
@@ -31,7 +31,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
...
@@ -31,7 +31,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
await
shouldFail
.
reverting
(
this
.
roles
.
add
(
authorized
));
await
shouldFail
.
reverting
(
this
.
roles
.
add
(
authorized
));
});
});
it
(
'reverts when adding roles to the
null
account'
,
async
function
()
{
it
(
'reverts when adding roles to the
zero
account'
,
async
function
()
{
await
shouldFail
.
reverting
(
this
.
roles
.
add
(
ZERO_ADDRESS
));
await
shouldFail
.
reverting
(
this
.
roles
.
add
(
ZERO_ADDRESS
));
});
});
});
});
...
@@ -54,7 +54,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
...
@@ -54,7 +54,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
await
shouldFail
.
reverting
(
this
.
roles
.
remove
(
anyone
));
await
shouldFail
.
reverting
(
this
.
roles
.
remove
(
anyone
));
});
});
it
(
'reverts when removing roles from the
null
account'
,
async
function
()
{
it
(
'reverts when removing roles from the
zero
account'
,
async
function
()
{
await
shouldFail
.
reverting
(
this
.
roles
.
remove
(
ZERO_ADDRESS
));
await
shouldFail
.
reverting
(
this
.
roles
.
remove
(
ZERO_ADDRESS
));
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment