Commit 260edd87 by Manuel Aráoz Committed by GitHub

Merge pull request #110 from FundRequest/master

resolve conflict between Ownable and ERC20 token.
parents e859d53b ed6df57f
...@@ -64,7 +64,7 @@ Sets the address of the creator of the contract as the owner. ...@@ -64,7 +64,7 @@ Sets the address of the creator of the contract as the owner.
#### modifier onlyOwner( ) #### modifier onlyOwner( )
Prevents function from running if it is called by anyone other than the owner. Prevents function from running if it is called by anyone other than the owner.
#### transfer(address newOwner) onlyOwner #### transferOwnership(address newOwner) onlyOwner
Transfers ownership of the contract to the passed address. Transfers ownership of the contract to the passed address.
--- ---
...@@ -97,7 +97,7 @@ ___ ...@@ -97,7 +97,7 @@ ___
### Claimable ### Claimable
Extension for the Ownable contract, where the ownership needs to be claimed Extension for the Ownable contract, where the ownership needs to be claimed
#### transfer(address newOwner) onlyOwner #### transferOwnership(address newOwner) onlyOwner
Sets the passed address as the pending owner. Sets the passed address as the pending owner.
#### modifier onlyPendingOwner #### modifier onlyPendingOwner
......
...@@ -7,8 +7,8 @@ import './Ownable.sol'; ...@@ -7,8 +7,8 @@ import './Ownable.sol';
/* /*
* Claimable * 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 { contract Claimable is Ownable {
address public pendingOwner; address public pendingOwner;
...@@ -18,7 +18,7 @@ contract Claimable is Ownable { ...@@ -18,7 +18,7 @@ contract Claimable is Ownable {
_; _;
} }
function transfer(address newOwner) onlyOwner { function transferOwnership(address newOwner) onlyOwner {
pendingOwner = newOwner; pendingOwner = newOwner;
} }
......
...@@ -14,12 +14,12 @@ contract Ownable { ...@@ -14,12 +14,12 @@ contract Ownable {
owner = msg.sender; owner = msg.sender;
} }
modifier onlyOwner() { modifier onlyOwner() {
if (msg.sender == owner) if (msg.sender == owner)
_; _;
} }
function transfer(address newOwner) onlyOwner { function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) owner = newOwner; if (newOwner != address(0)) owner = newOwner;
} }
......
...@@ -12,7 +12,7 @@ contract('Claimable', function(accounts) { ...@@ -12,7 +12,7 @@ contract('Claimable', function(accounts) {
it("changes pendingOwner after transfer", async function() { it("changes pendingOwner after transfer", async function() {
let newOwner = accounts[1]; let newOwner = accounts[1];
let transfer = await claimable.transfer(newOwner); let transfer = await claimable.transferOwnership(newOwner);
let pendingOwner = await claimable.pendingOwner(); let pendingOwner = await claimable.pendingOwner();
assert.isTrue(pendingOwner === newOwner); assert.isTrue(pendingOwner === newOwner);
...@@ -21,12 +21,12 @@ contract('Claimable', function(accounts) { ...@@ -21,12 +21,12 @@ contract('Claimable', function(accounts) {
it("should prevent to claimOwnership from no pendingOwner", async function() { it("should prevent to claimOwnership from no pendingOwner", async function() {
let claimedOwner = await claimable.claimOwnership({from: accounts[2]}); let claimedOwner = await claimable.claimOwnership({from: accounts[2]});
let owner = await claimable.owner(); let owner = await claimable.owner();
assert.isTrue(owner != accounts[2]); assert.isTrue(owner != accounts[2]);
}); });
it("should prevent non-owners from transfering", async function() { it("should prevent non-owners from transfering", async function() {
let transfer = await claimable.transfer(accounts[2], {from: accounts[2]}); let transfer = await claimable.transferOwnership(accounts[2], {from: accounts[2]});
let pendingOwner = await claimable.pendingOwner(); let pendingOwner = await claimable.pendingOwner();
assert.isFalse(pendingOwner === accounts[2]); assert.isFalse(pendingOwner === accounts[2]);
...@@ -37,7 +37,7 @@ contract('Claimable', function(accounts) { ...@@ -37,7 +37,7 @@ contract('Claimable', function(accounts) {
beforeEach(async function () { beforeEach(async function () {
newOwner = accounts[1]; newOwner = accounts[1];
await claimable.transfer(newOwner); await claimable.transferOwnership(newOwner);
}); });
it("changes allow pending owner to claim ownership", async function() { it("changes allow pending owner to claim ownership", async function() {
......
...@@ -12,7 +12,7 @@ contract('Ownable', function(accounts) { ...@@ -12,7 +12,7 @@ contract('Ownable', function(accounts) {
it("changes owner after transfer", async function() { it("changes owner after transfer", async function() {
let other = accounts[1]; let other = accounts[1];
let transfer = await ownable.transfer(other); let transfer = await ownable.transferOwnership(other);
let owner = await ownable.owner(); let owner = await ownable.owner();
assert.isTrue(owner === other); assert.isTrue(owner === other);
...@@ -20,7 +20,7 @@ contract('Ownable', function(accounts) { ...@@ -20,7 +20,7 @@ contract('Ownable', function(accounts) {
it("should prevent non-owners from transfering", async function() { it("should prevent non-owners from transfering", async function() {
let other = accounts[2]; let other = accounts[2];
let transfer = await ownable.transfer(other, {from: accounts[2]}); let transfer = await ownable.transferOwnership(other, {from: accounts[2]});
let owner = await ownable.owner(); let owner = await ownable.owner();
assert.isFalse(owner === other); assert.isFalse(owner === other);
...@@ -29,9 +29,9 @@ contract('Ownable', function(accounts) { ...@@ -29,9 +29,9 @@ contract('Ownable', function(accounts) {
it("should guard ownership against stuck state", async function() { it("should guard ownership against stuck state", async function() {
let ownable = Ownable.deployed(); let ownable = Ownable.deployed();
let originalOwner = await ownable.owner(); let originalOwner = await ownable.owner();
let transfer = await ownable.transfer(null, {from: originalOwner}); let transfer = await ownable.transferOwnership(null, {from: originalOwner});
let newOwner = await ownable.owner(); let newOwner = await ownable.owner();
assert.equal(originalOwner, newOwner); assert.equal(originalOwner, newOwner);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment