Browse Source

improve docs of base contracts

Manuel Araoz 9 years ago
parent
commit
35363c01b1

+ 6 - 2
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;
 

+ 1 - 1
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 {

+ 4 - 1
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;

+ 2 - 0
contracts/PullPayment.sol

@@ -1,4 +1,6 @@
 pragma solidity ^0.4.4;
+
+
 /*
  * PullPayment
  * Base contract supporting async send for pull payments.

+ 1 - 0
contracts/SafeMath.sol

@@ -1,5 +1,6 @@
 pragma solidity ^0.4.4;
 
+
 /**
  * Math operations with safety checks
  */

+ 5 - 0
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;
   }

+ 0 - 25
test/TestOwnable.sol

@@ -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");
-  }
-}