diff --git a/contracts/Claimable.sol b/contracts/Claimable.sol index 40e38d49c..d51d34f01 100644 --- a/contracts/Claimable.sol +++ b/contracts/Claimable.sol @@ -1,11 +1,15 @@ pragma solidity ^0.4.0; + + + import './Ownable.sol'; + /* * 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. This allows the new owner to accept the transfer. */ - contract Claimable is Ownable { address public pendingOwner; diff --git a/contracts/Killable.sol b/contracts/Killable.sol index 0b6aff066..e327b8e41 100644 --- a/contracts/Killable.sol +++ b/contracts/Killable.sol @@ -3,7 +3,7 @@ import "./Ownable.sol"; /* * Killable - * Base contract that can be killed by owner + * Base contract that can be killed by owner. All funds in contract will be sent to the owner. */ contract Killable is Ownable { function kill() onlyOwner { diff --git a/contracts/Ownable.sol b/contracts/Ownable.sol index 2998fa403..40fc08146 100644 --- a/contracts/Ownable.sol +++ b/contracts/Ownable.sol @@ -1,8 +1,11 @@ pragma solidity ^0.4.4; + /* * Ownable - * Base contract with an owner + * + * Base contract with an owner. + * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. */ contract Ownable { address public owner; diff --git a/contracts/PullPayment.sol b/contracts/PullPayment.sol index c05f99caf..9bee81e09 100644 --- a/contracts/PullPayment.sol +++ b/contracts/PullPayment.sol @@ -1,4 +1,6 @@ pragma solidity ^0.4.4; + + /* * PullPayment * Base contract supporting async send for pull payments. diff --git a/contracts/SafeMath.sol b/contracts/SafeMath.sol index 16e8dae76..8568ddd91 100644 --- a/contracts/SafeMath.sol +++ b/contracts/SafeMath.sol @@ -1,5 +1,6 @@ pragma solidity ^0.4.4; + /** * Math operations with safety checks */ diff --git a/contracts/Stoppable.sol b/contracts/Stoppable.sol index ad48f6bc5..5c018844a 100644 --- a/contracts/Stoppable.sol +++ b/contracts/Stoppable.sol @@ -1,6 +1,9 @@ pragma solidity ^0.4.4; + import "./Ownable.sol"; + + /* * Stoppable * Abstract contract that allows children to implement an @@ -12,10 +15,12 @@ contract Stoppable is Ownable { modifier stopInEmergency { if (!stopped) _; } modifier onlyInEmergency { if (stopped) _; } + // called by the owner on emergency, triggers stopped state function emergencyStop() external onlyOwner { stopped = true; } + // called by the owner on end of emergency, returns to normal state function release() external onlyOwner onlyInEmergency { stopped = false; } diff --git a/test/TestOwnable.sol b/test/TestOwnable.sol deleted file mode 100644 index cb3cbcf21..000000000 --- a/test/TestOwnable.sol +++ /dev/null @@ -1,25 +0,0 @@ -pragma solidity ^0.4.4; -import "truffle/Assert.sol"; -import "truffle/DeployedAddresses.sol"; -import "../contracts/Ownable.sol"; - -contract TestOwnable { - Ownable ownable = new Ownable(); - - function testHasOwner() { - Assert.isNotZero(ownable.owner(), "Ownable should have an owner upon creation."); - } - - function testChangesOwner() { - address originalOwner = ownable.owner(); - ownable.transfer(0x0); - Assert.notEqual(originalOwner, ownable.owner(), "Ownable should change owners after transfer."); - } - - function testOnlyOwnerCanChangeOwner() { - Ownable deployedOwnable = Ownable(DeployedAddresses.Ownable()); - address originalOwner = deployedOwnable.owner(); - deployedOwnable.transfer(0x0); - Assert.equal(originalOwner, deployedOwnable.owner(), "Ownable should prevent non-owners from transfering"); - } -}