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
260edd87
Commit
260edd87
authored
Dec 19, 2016
by
Manuel Aráoz
Committed by
GitHub
Dec 19, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #110 from FundRequest/master
resolve conflict between Ownable and ERC20 token.
parents
e859d53b
ed6df57f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
15 deletions
+15
-15
README.md
README.md
+2
-2
Claimable.sol
contracts/Claimable.sol
+3
-3
Ownable.sol
contracts/Ownable.sol
+2
-2
Claimable.js
test/Claimable.js
+4
-4
Ownable.js
test/Ownable.js
+4
-4
No files found.
README.md
View file @
260edd87
...
...
@@ -64,7 +64,7 @@ Sets the address of the creator of the contract as the owner.
#### modifier onlyOwner( )
Prevents function from running if it is called by anyone other than the owner.
#### transfer(address newOwner) onlyOwner
#### transfer
Ownership
(address newOwner) onlyOwner
Transfers ownership of the contract to the passed address.
---
...
...
@@ -97,7 +97,7 @@ ___
### Claimable
Extension for the Ownable contract, where the ownership needs to be claimed
#### transfer(address newOwner) onlyOwner
#### transfer
Ownership
(address newOwner) onlyOwner
Sets the passed address as the pending owner.
#### modifier onlyPendingOwner
...
...
contracts/Claimable.sol
View file @
260edd87
...
...
@@ -7,8 +7,8 @@ import './Ownable.sol';
/*
* Claimable
*
* Extension for the Ownable contract, where the ownership needs to be claimed. This allows the new owner to accept the transfer.
*
* Extension for the Ownable contract, where the ownership needs to be claimed. This allows the new owner to accept the transfer.
*/
contract Claimable is Ownable {
address public pendingOwner;
...
...
@@ -18,7 +18,7 @@ contract Claimable is Ownable {
_;
}
function transfer(address newOwner) onlyOwner {
function transfer
Ownership
(address newOwner) onlyOwner {
pendingOwner = newOwner;
}
...
...
contracts/Ownable.sol
View file @
260edd87
...
...
@@ -14,12 +14,12 @@ contract Ownable {
owner = msg.sender;
}
modifier onlyOwner() {
modifier onlyOwner() {
if (msg.sender == owner)
_;
}
function transfer(address newOwner) onlyOwner {
function transfer
Ownership
(address newOwner) onlyOwner {
if (newOwner != address(0)) owner = newOwner;
}
...
...
test/Claimable.js
View file @
260edd87
...
...
@@ -12,7 +12,7 @@ contract('Claimable', function(accounts) {
it
(
"changes pendingOwner after transfer"
,
async
function
()
{
let
newOwner
=
accounts
[
1
];
let
transfer
=
await
claimable
.
transfer
(
newOwner
);
let
transfer
=
await
claimable
.
transfer
Ownership
(
newOwner
);
let
pendingOwner
=
await
claimable
.
pendingOwner
();
assert
.
isTrue
(
pendingOwner
===
newOwner
);
...
...
@@ -21,12 +21,12 @@ contract('Claimable', function(accounts) {
it
(
"should prevent to claimOwnership from no pendingOwner"
,
async
function
()
{
let
claimedOwner
=
await
claimable
.
claimOwnership
({
from
:
accounts
[
2
]});
let
owner
=
await
claimable
.
owner
();
assert
.
isTrue
(
owner
!=
accounts
[
2
]);
});
it
(
"should prevent non-owners from transfering"
,
async
function
()
{
let
transfer
=
await
claimable
.
transfer
(
accounts
[
2
],
{
from
:
accounts
[
2
]});
let
transfer
=
await
claimable
.
transfer
Ownership
(
accounts
[
2
],
{
from
:
accounts
[
2
]});
let
pendingOwner
=
await
claimable
.
pendingOwner
();
assert
.
isFalse
(
pendingOwner
===
accounts
[
2
]);
...
...
@@ -37,7 +37,7 @@ contract('Claimable', function(accounts) {
beforeEach
(
async
function
()
{
newOwner
=
accounts
[
1
];
await
claimable
.
transfer
(
newOwner
);
await
claimable
.
transfer
Ownership
(
newOwner
);
});
it
(
"changes allow pending owner to claim ownership"
,
async
function
()
{
...
...
test/Ownable.js
View file @
260edd87
...
...
@@ -12,7 +12,7 @@ contract('Ownable', function(accounts) {
it
(
"changes owner after transfer"
,
async
function
()
{
let
other
=
accounts
[
1
];
let
transfer
=
await
ownable
.
transfer
(
other
);
let
transfer
=
await
ownable
.
transfer
Ownership
(
other
);
let
owner
=
await
ownable
.
owner
();
assert
.
isTrue
(
owner
===
other
);
...
...
@@ -20,7 +20,7 @@ contract('Ownable', function(accounts) {
it
(
"should prevent non-owners from transfering"
,
async
function
()
{
let
other
=
accounts
[
2
];
let
transfer
=
await
ownable
.
transfer
(
other
,
{
from
:
accounts
[
2
]});
let
transfer
=
await
ownable
.
transfer
Ownership
(
other
,
{
from
:
accounts
[
2
]});
let
owner
=
await
ownable
.
owner
();
assert
.
isFalse
(
owner
===
other
);
...
...
@@ -29,9 +29,9 @@ contract('Ownable', function(accounts) {
it
(
"should guard ownership against stuck state"
,
async
function
()
{
let
ownable
=
Ownable
.
deployed
();
let
originalOwner
=
await
ownable
.
owner
();
let
transfer
=
await
ownable
.
transfer
(
null
,
{
from
:
originalOwner
});
let
transfer
=
await
ownable
.
transfer
Ownership
(
null
,
{
from
:
originalOwner
});
let
newOwner
=
await
ownable
.
owner
();
assert
.
equal
(
originalOwner
,
newOwner
);
});
...
...
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