Merge pull request #110 from FundRequest/master

resolve conflict between Ownable and ERC20 token.
This commit is contained in:
Manuel Aráoz
2016-12-19 13:56:52 -03:00
committed by GitHub
5 changed files with 15 additions and 15 deletions

View File

@ -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
#### transferOwnership(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
#### transferOwnership(address newOwner) onlyOwner
Sets the passed address as the pending owner.
#### modifier onlyPendingOwner

View File

@ -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 transferOwnership(address newOwner) onlyOwner {
pendingOwner = newOwner;
}

View File

@ -14,12 +14,12 @@ contract Ownable {
owner = msg.sender;
}
modifier onlyOwner() {
modifier onlyOwner() {
if (msg.sender == owner)
_;
}
function transfer(address newOwner) onlyOwner {
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) owner = newOwner;
}

View File

@ -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.transferOwnership(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.transferOwnership(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.transferOwnership(newOwner);
});
it("changes allow pending owner to claim ownership", async function() {

View File

@ -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.transferOwnership(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.transferOwnership(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.transferOwnership(null, {from: originalOwner});
let newOwner = await ownable.owner();
assert.equal(originalOwner, newOwner);
});