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
32079967
Commit
32079967
authored
Nov 14, 2016
by
Manuel Aráoz
Committed by
GitHub
Nov 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #65 from se3000/ownable_guard
add check prevening ownables from getting stuck
parents
eed0ba95
5f6b7f93
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
+17
-1
Ownable.sol
contracts/Ownable.sol
+1
-1
Ownable.js
test/Ownable.js
+16
-0
No files found.
contracts/Ownable.sol
View file @
32079967
...
@@ -17,7 +17,7 @@ contract Ownable {
...
@@ -17,7 +17,7 @@ contract Ownable {
}
}
function transfer(address newOwner) onlyOwner {
function transfer(address newOwner) onlyOwner {
owner = newOwner;
if (newOwner != address(0))
owner = newOwner;
}
}
}
}
test/Ownable.js
View file @
32079967
...
@@ -39,4 +39,20 @@ contract('Ownable', function(accounts) {
...
@@ -39,4 +39,20 @@ contract('Ownable', function(accounts) {
.
then
(
done
)
.
then
(
done
)
});
});
it
(
"should guard ownership against stuck state"
,
function
(
done
)
{
var
ownable
=
Ownable
.
deployed
();
return
ownable
.
owner
()
.
then
(
function
(
originalOwner
)
{
return
ownable
.
transfer
(
null
,
{
from
:
originalOwner
})
.
then
(
function
()
{
return
ownable
.
owner
();
})
.
then
(
function
(
newOwner
)
{
assert
.
equal
(
originalOwner
,
newOwner
);
})
.
then
(
done
);
});
});
});
});
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