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
e9cf6dfb
Commit
e9cf6dfb
authored
Jul 22, 2017
by
Francisco Giordano
Committed by
GitHub
Jul 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #323 from pooleja/fix/ownable_error
Fix/ownable error - Silent transferOwnership Failure
parents
4d91118d
64787b1a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
Ownable.sol
contracts/ownership/Ownable.sol
+1
-2
Ownable.js
test/Ownable.js
+6
-3
No files found.
contracts/ownership/Ownable.sol
View file @
e9cf6dfb
...
@@ -33,9 +33,8 @@ contract Ownable {
...
@@ -33,9 +33,8 @@ contract Ownable {
* @param newOwner The address to transfer ownership to.
* @param newOwner The address to transfer ownership to.
*/
*/
function transferOwnership(address newOwner) onlyOwner {
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
require(newOwner != address(0));
owner = newOwner;
owner = newOwner;
}
}
}
}
}
test/Ownable.js
View file @
e9cf6dfb
...
@@ -36,10 +36,12 @@ contract('Ownable', function(accounts) {
...
@@ -36,10 +36,12 @@ contract('Ownable', function(accounts) {
it
(
'should guard ownership against stuck state'
,
async
function
()
{
it
(
'should guard ownership against stuck state'
,
async
function
()
{
let
originalOwner
=
await
ownable
.
owner
();
let
originalOwner
=
await
ownable
.
owner
();
try
{
await
ownable
.
transferOwnership
(
null
,
{
from
:
originalOwner
});
await
ownable
.
transferOwnership
(
null
,
{
from
:
originalOwner
});
let
newOwner
=
await
ownable
.
owner
();
assert
.
fail
();
}
catch
(
error
)
{
assert
.
equal
(
originalOwner
,
newOwner
);
assertJump
(
error
);
}
});
});
});
});
\ No newline at end of file
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