Commit 83f28494 by maurelian

Minor edits to doc commenst in lifecycle, ownership, payment contracts.

parent d85be4a8
...@@ -11,7 +11,7 @@ import "../ownership/Ownable.sol"; ...@@ -11,7 +11,7 @@ import "../ownership/Ownable.sol";
contract Destructible is Ownable { contract Destructible is Ownable {
/** /**
*@dev The destroy function transfer the current balance to the owner and terminate de lifecycle * @dev Transfers the current balance to the owner and terminates the contract.
*/ */
function destroy() onlyOwner { function destroy() onlyOwner {
selfdestruct(owner); selfdestruct(owner);
......
...@@ -6,7 +6,7 @@ import "../ownership/Ownable.sol"; ...@@ -6,7 +6,7 @@ import "../ownership/Ownable.sol";
/** /**
* @title Pausable * @title Pausable
* @dev Abstract contract that allows children to implement an emergency stop mechanism. * @dev Base contract which allows children to implement an emergency stop mechanism.
*/ */
contract Pausable is Ownable { contract Pausable is Ownable {
event Pause(); event Pause();
......
...@@ -4,19 +4,21 @@ pragma solidity ^0.4.8; ...@@ -4,19 +4,21 @@ pragma solidity ^0.4.8;
import "../ownership/Ownable.sol"; import "../ownership/Ownable.sol";
import "../token/ERC20Basic.sol"; import "../token/ERC20Basic.sol";
/** @title TokenDestructible: /**
* @author Remco Bloemen <remco@2π.com> * @title TokenDestructible:
* @dev Base contract that can be destroyed by owner. All funds in contract including * @author Remco Bloemen <remco@2π.com>
* listed tokens will be sent to the owner * @dev Base contract that can be destroyed by owner. All funds in contract including
*/ * listed tokens will be sent to the owner.
*/
contract TokenDestructible is Ownable { contract TokenDestructible is Ownable {
/** @notice Terminate contract and refund to owner /**
* @param tokens List of addresses of ERC20 or ERC20Basic token contracts to * @notice Terminate contract and refund to owner
refund * @param tokens List of addresses of ERC20 or ERC20Basic token contracts to
* @notice The called token contracts could try to re-enter this contract.Only refund.
supply token contracts you * @notice The called token contracts could try to re-enter this contract. Only
*/ supply token contracts you trust.
*/
function destroy(address[] tokens) onlyOwner { function destroy(address[] tokens) onlyOwner {
// Transfer tokens to owner // Transfer tokens to owner
......
...@@ -13,8 +13,7 @@ contract Claimable is Ownable { ...@@ -13,8 +13,7 @@ contract Claimable is Ownable {
address public pendingOwner; address public pendingOwner;
/** /**
* @dev The onlyPendingOwner modifier throws if called by any account other than the * @dev Modifier throws if called by any account other than the pendingOwner.
* pendingOwner.
*/ */
modifier onlyPendingOwner() { modifier onlyPendingOwner() {
if (msg.sender != pendingOwner) { if (msg.sender != pendingOwner) {
...@@ -24,20 +23,18 @@ contract Claimable is Ownable { ...@@ -24,20 +23,18 @@ contract Claimable is Ownable {
} }
/** /**
* @dev The transferOwnership function allows the current owner to set the pendingOwner * @dev Allows the current owner to set the pendingOwner address.
* address. * @param newOwner The address to transfer ownership to.
* @param pendingOwner The address to transfer ownership to.
*/ */
function transferOwnership(address newOwner) onlyOwner { function transferOwnership(address newOwner) onlyOwner {
pendingOwner = newOwner; pendingOwner = newOwner;
} }
/** /**
* @dev The claimOwnership function allows the pendingOwner address to finalize the transfer. * @dev Allows the pendingOwner address to finalize the transfer.
*/ */
function claimOwnership() onlyPendingOwner { function claimOwnership() onlyPendingOwner {
owner = pendingOwner; owner = pendingOwner;
pendingOwner = 0x0; pendingOwner = 0x0;
} }
} }
...@@ -12,12 +12,10 @@ contract Contactable is Ownable{ ...@@ -12,12 +12,10 @@ contract Contactable is Ownable{
string public contactInformation; string public contactInformation;
/** /**
* @dev The setContactInformation() function allows the current owner to transfer control of the * @dev Allows the owner to set a string with their contact information.
* contract to a newOwner. * @param info The contact information to attach to the contract.
* @param newOwner The address to transfer ownership to.
*/ */
function setContactInformation(string info) onlyOwner{ function setContactInformation(string info) onlyOwner{
contactInformation = info; contactInformation = info;
} }
} }
...@@ -15,9 +15,9 @@ contract DelayedClaimable is Claimable { ...@@ -15,9 +15,9 @@ contract DelayedClaimable is Claimable {
uint public start; uint public start;
/** /**
* @dev the setLimits function can be used to specify the time period during which a pending * @dev Used to specify the time period during which a pending
* owner can claim ownership. * owner can claim ownership.
* @params _start The earliest time ownership can be claimed * @params _start The earliest time ownership can be claimed.
* @params _end The latest time ownership can be claimed. * @params _end The latest time ownership can be claimed.
*/ */
function setLimits(uint _start, uint _end) onlyOwner { function setLimits(uint _start, uint _end) onlyOwner {
...@@ -29,7 +29,8 @@ contract DelayedClaimable is Claimable { ...@@ -29,7 +29,8 @@ contract DelayedClaimable is Claimable {
/** /**
* @dev setLimit() modifier throws if called by any account other than the owner. * @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within
* the specified start and end time.
*/ */
function claimOwnership() onlyPendingOwner { function claimOwnership() onlyPendingOwner {
if ((block.number > end) || (block.number < start)) if ((block.number > end) || (block.number < start))
......
...@@ -2,17 +2,18 @@ pragma solidity ^0.4.8; ...@@ -2,17 +2,18 @@ pragma solidity ^0.4.8;
import "./Ownable.sol"; import "./Ownable.sol";
/** @title Contracts that should not own Contracts /**
* @author Remco Bloemen <remco@2π.com> * @title Contracts that should not own Contracts
* @dev Should contracts (anything Ownable) end up being owned by this contract, it allows the owner of this contract to reclaim ownership of the contracts. * @author Remco Bloemen <remco@2π.com>
*/ * @dev Should contracts (anything Ownable) end up being owned by this contract, it allows the owner
* of this contract to reclaim ownership of the contracts.
*/
contract HasNoContracts is Ownable { contract HasNoContracts is Ownable {
/** /**
* @dev Reclaim ownership of Ownable contracts * @dev Reclaim ownership of Ownable contracts
* @param contractAddr address The Ownable contract address wished to * @param contractAddr The address of the Ownable to be reclaimed.
be reclaimed */
*/
function reclaimContract(address contractAddr) external onlyOwner { function reclaimContract(address contractAddr) external onlyOwner {
Ownable contractInst = Ownable(contractAddr); Ownable contractInst = Ownable(contractAddr);
contractInst.transferOwnership(owner); contractInst.transferOwnership(owner);
......
...@@ -2,27 +2,24 @@ pragma solidity ^0.4.8; ...@@ -2,27 +2,24 @@ pragma solidity ^0.4.8;
import "./Ownable.sol"; import "./Ownable.sol";
/** @title Contracts that should not own Ether /**
* @author Remco Bloemen <remco@2π.com> * @title Contracts that should not own Ether
* @author Remco Bloemen <remco@2π.com>
* @dev This tries to block incoming ether to prevent accidental loss of Ether. * @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up
Should Ether end up in the contrat, it will allow the owner to reclaim * in the contract, it will allow the owner to reclaim this ether.
this ether. * @notice Ether can still be send to this contract by:
* @notice Ether can still be send to this contract by: * calling functions labeled `payable`
* calling functions labeled `payable` * `selfdestruct(contract_address)`
* `selfdestruct(contract_address)` * mining directly to the contract address
* mining directly to the contract address
*/ */
contract HasNoEther is Ownable { contract HasNoEther is Ownable {
/** /**
* @dev Constructor that rejects incoming Ether * @dev Constructor that rejects incoming Ether
* @dev The flag `payable` is added so we can access `msg.value` * @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we
without compiler warning. If we leave out payable, then * leave out payable, then Solidity will allow inheriting contracts to implement a payable
Solidity will allow inheriting contracts to implement a * constructor. By doing it this way we prevent a payable constructor from working. Alternatively
payable constructor. By doing it this way we prevent a * we could use assembly to access msg.value.
payable constructor from working. Alternatively we could
use assembly to access msg.value.
*/ */
function HasNoEther() payable { function HasNoEther() payable {
if(msg.value > 0) { if(msg.value > 0) {
...@@ -31,15 +28,14 @@ contract HasNoEther is Ownable { ...@@ -31,15 +28,14 @@ contract HasNoEther is Ownable {
} }
/** /**
* @dev Disallow direct send by settings a default function without `payable` * @dev Disallows direct send by settings a default function without the `payable` flag.
*/ */
function() external { function() external {
} }
/** /**
* @dev Transfer all Ether owned by the contract to the owner * @dev Transfer all Ether held by the contract to the owner.
* @dev What if owner is itself a contract marked HasNoEther? */
*/
function reclaimEther() external onlyOwner { function reclaimEther() external onlyOwner {
if(!owner.send(this.balance)) { if(!owner.send(this.balance)) {
throw; throw;
......
...@@ -3,27 +3,29 @@ pragma solidity ^0.4.8; ...@@ -3,27 +3,29 @@ pragma solidity ^0.4.8;
import "./Ownable.sol"; import "./Ownable.sol";
import "../token/ERC20Basic.sol"; import "../token/ERC20Basic.sol";
/** @title Contracts that should not own Tokens /**
* @author Remco Bloemen <remco@2π.com> * @title Contracts that should not own Tokens
* @dev This blocks incoming ERC23 tokens to prevent accidental loss of tokens. * @author Remco Bloemen <remco@2π.com>
Should tokens (any ERC20Basic compatible) end up in the contract, it allows the * @dev This blocks incoming ERC23 tokens to prevent accidental loss of tokens.
owner to reclaim the tokens. * Should tokens (any ERC20Basic compatible) end up in the contract, it allows the
*/ * owner to reclaim the tokens.
*/
contract HasNoTokens is Ownable { contract HasNoTokens is Ownable {
/** @dev Reject all ERC23 compatible tokens /**
* @param from_ address The address that is transfering the tokens * @dev Reject all ERC23 compatible tokens
* @param value_ Uint the amount of the specified token * @param from_ address The address that is transferring the tokens
* @param data_ Bytes The data passed from the caller. * @param value_ Uint the amount of the specified token
*/ * @param data_ Bytes The data passed from the caller.
*/
function tokenFallback(address from_, uint value_, bytes data_) external { function tokenFallback(address from_, uint value_, bytes data_) external {
throw; throw;
} }
/** /**
* @dev Reclaim all ERC20Basic compatible tokens * @dev Reclaim all ERC20Basic compatible tokens
* @param tokenAddr address The address of the token contract * @param tokenAddr address The address of the token contract
*/ */
function reclaimToken(address tokenAddr) external onlyOwner { function reclaimToken(address tokenAddr) external onlyOwner {
ERC20Basic tokenInst = ERC20Basic(tokenAddr); ERC20Basic tokenInst = ERC20Basic(tokenAddr);
uint256 balance = tokenInst.balanceOf(this); uint256 balance = tokenInst.balanceOf(this);
......
pragma solidity ^0.4.8; pragma solidity ^0.4.8;
/* /**
* Multisig * @title Multisig
* Interface contract for multisig proxy contracts; see below for docs. * @dev Interface contract for multisig proxy contracts; see below for docs.
*/ */
contract Multisig { contract Multisig {
// EVENTS // EVENTS
...@@ -26,4 +26,3 @@ contract Multisig { ...@@ -26,4 +26,3 @@ contract Multisig {
function execute(address _to, uint _value, bytes _data) external returns (bytes32); function execute(address _to, uint _value, bytes _data) external returns (bytes32);
function confirm(bytes32 _h) returns (bool); function confirm(bytes32 _h) returns (bool);
} }
...@@ -4,9 +4,11 @@ import "./HasNoEther.sol"; ...@@ -4,9 +4,11 @@ import "./HasNoEther.sol";
import "./HasNoTokens.sol"; import "./HasNoTokens.sol";
import "./HasNoContracts.sol"; import "./HasNoContracts.sol";
/** @title Base contract for contracts that should not own things. /**
* @author Remco Bloemen <remco@2π.com> * @title Base contract for contracts that should not own things.
* @devSolves a class of errors where a contract accidentally becomes owner of Ether, Tokens or Owned contracts. See respective base contracts for details. * @author Remco Bloemen <remco@2π.com>
*/ * @dev Solves a class of errors where a contract accidentally becomes owner of Ether, Tokens or
* Owned contracts. See respective base contracts for details.
*/
contract NoOwner is HasNoEther, HasNoTokens, HasNoContracts { contract NoOwner is HasNoEther, HasNoTokens, HasNoContracts {
} }
...@@ -3,9 +3,8 @@ pragma solidity ^0.4.8; ...@@ -3,9 +3,8 @@ pragma solidity ^0.4.8;
/** /**
* @title Ownable * @title Ownable
*
* @dev The Ownable contract has an owner address, and provides basic authorization control * @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions". * functions, this simplifies the implementation of "user permissions".
*/ */
contract Ownable { contract Ownable {
address public owner; address public owner;
...@@ -21,7 +20,7 @@ contract Ownable { ...@@ -21,7 +20,7 @@ contract Ownable {
/** /**
* @dev The onlyOwner modifier throws if called by any account other than the owner. * @dev Throws if called by any account other than the owner.
*/ */
modifier onlyOwner() { modifier onlyOwner() {
if (msg.sender != owner) { if (msg.sender != owner) {
...@@ -32,8 +31,7 @@ contract Ownable { ...@@ -32,8 +31,7 @@ contract Ownable {
/** /**
* @dev The transferOwnership function allows the current owner to transfer control of the * @dev Allows the current owner to transfer control of the contract to a newOwner.
* contract to a newOwner.
* @param newOwner The address to transfer ownership to. * @param newOwner The address to transfer ownership to.
*/ */
function transferOwnership(address newOwner) onlyOwner { function transferOwnership(address newOwner) onlyOwner {
......
...@@ -3,8 +3,8 @@ pragma solidity ^0.4.8; ...@@ -3,8 +3,8 @@ pragma solidity ^0.4.8;
/** /**
* @title Shareable * @title Shareable
* @dev inheritable "property" contract that enables methods to be protected by requiring the acquiescence of either a single, or, crucially, each of a number of, designated owners. * @dev inheritable "property" contract that enables methods to be protected by requiring the
* * acquiescence of either a single, or, crucially, each of a number of, designated owners.
* @dev Usage: use modifiers onlyowner (just own owned) or onlymanyowners(hash), whereby the same hash must be provided by some number (specified in constructor) of the set of owners (specified in the constructor) before the interior is executed. * @dev Usage: use modifiers onlyowner (just own owned) or onlymanyowners(hash), whereby the same hash must be provided by some number (specified in constructor) of the set of owners (specified in the constructor) before the interior is executed.
*/ */
contract Shareable { contract Shareable {
...@@ -41,21 +41,25 @@ contract Shareable { ...@@ -41,21 +41,25 @@ contract Shareable {
} }
_; _;
} }
// multi-sig function modifier: the operation must have an intrinsic hash in order /**
// that later attempts can be realised as the same underlying operation and * @dev Modifier for multisig functions.
// thus count as confirmations. * @param _operation The operation must have an intrinsic hash in order
* that later attempts can be realised as the same underlying operation and
* thus count as confirmations.
*/
modifier onlymanyowners(bytes32 _operation) { modifier onlymanyowners(bytes32 _operation) {
if (confirmAndCheck(_operation)) { if (confirmAndCheck(_operation)) {
_; _;
} }
} }
/** @dev Constructor is given number of sigs required to do protected "onlymanyowners" transactions /**
* as well as the selection of addresses capable of confirming them. * @dev Constructor is given the number of sigs required to do protected "onlymanyowners"
* @param _owners address[] A list of owners * transactions as well as the selection of addresses capable of confirming them.
* @param _required Uint The amout required for a transaction to be approved. * @param _owners A list of owners.
*/ * @param _required The amount required for a transaction to be approved.
*/
function Shareable(address[] _owners, uint _required) { function Shareable(address[] _owners, uint _required) {
owners[1] = msg.sender; owners[1] = msg.sender;
ownerIndex[msg.sender] = 1; ownerIndex[msg.sender] = 1;
...@@ -70,9 +74,9 @@ contract Shareable { ...@@ -70,9 +74,9 @@ contract Shareable {
} }
/** /**
* @dev Revokes a prior confirmation of the given operation * @dev Revokes a prior confirmation of the given operation
* @param _operation bytes32 A string the identfies the operation. * @param _operation bytes32 A string the identfies the operation.
*/ */
function revoke(bytes32 _operation) external { function revoke(bytes32 _operation) external {
uint index = ownerIndex[msg.sender]; uint index = ownerIndex[msg.sender];
// make sure they're an owner // make sure they're an owner
...@@ -89,29 +93,29 @@ contract Shareable { ...@@ -89,29 +93,29 @@ contract Shareable {
} }
/** /**
* @dev Gets an owner by 0-indexed position (using numOwners as the count) * @dev Gets an owner by 0-indexed position (using numOwners as the count)
* @param ownerIndex Uint The index of the owner * @param ownerIndex Uint The index of the owner
* @return The address of the owner * @return The address of the owner
*/ */
function getOwner(uint ownerIndex) external constant returns (address) { function getOwner(uint ownerIndex) external constant returns (address) {
return address(owners[ownerIndex + 1]); return address(owners[ownerIndex + 1]);
} }
/** /**
* @dev Checks if given address is an owner. * @dev Checks if given address is an owner.
* @param _addr address The address which you want to check. * @param _addr address The address which you want to check.
* @return True if the address is an owner and fase otherwise. * @return True if the address is an owner and fase otherwise.
*/ */
function isOwner(address _addr) constant returns (bool) { function isOwner(address _addr) constant returns (bool) {
return ownerIndex[_addr] > 0; return ownerIndex[_addr] > 0;
} }
/** /**
* @dev Function to check is specific owner has already confirme the operation * @dev Function to check is specific owner has already confirme the operation.
* @param _operation bytes32 The operation identifier * @param _operation The operation identifier.
* @param _owner address The owner address * @param _owner The owner address.
* @return True if the owner has confirmed and flase otherwise * @return True if the owner has confirmed and false otherwise.
*/ */
function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) { function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) {
var pending = pendings[_operation]; var pending = pendings[_operation];
uint index = ownerIndex[_owner]; uint index = ownerIndex[_owner];
...@@ -127,10 +131,10 @@ contract Shareable { ...@@ -127,10 +131,10 @@ contract Shareable {
} }
/** /**
* @dev Confirm and operation and checks if it's already executable * @dev Confirm and operation and checks if it's already executable.
* @param _operation bytes32 The operation identifier * @param _operation The operation identifier.
* @return returns true when operation can be executed * @return Returns true when operation can be executed.
*/ */
function confirmAndCheck(bytes32 _operation) internal returns (bool) { function confirmAndCheck(bytes32 _operation) internal returns (bool) {
// determine what index the present sender is: // determine what index the present sender is:
uint index = ownerIndex[msg.sender]; uint index = ownerIndex[msg.sender];
...@@ -171,8 +175,8 @@ contract Shareable { ...@@ -171,8 +175,8 @@ contract Shareable {
/** /**
* @dev Clear the pedings list. * @dev Clear the pending list.
*/ */
function clearPending() internal { function clearPending() internal {
uint length = pendingsIndex.length; uint length = pendingsIndex.length;
for (uint i = 0; i < length; ++i) { for (uint i = 0; i < length; ++i) {
......
...@@ -7,7 +7,7 @@ import '../SafeMath.sol'; ...@@ -7,7 +7,7 @@ import '../SafeMath.sol';
/** /**
* @title PullPayment * @title PullPayment
* @dev Base contract supporting async send for pull payments. Inherit from this * @dev Base contract supporting async send for pull payments. Inherit from this
contract and use asyncSend instead of send. * contract and use asyncSend instead of send.
*/ */
contract PullPayment { contract PullPayment {
using SafeMath for uint; using SafeMath for uint;
...@@ -16,9 +16,9 @@ contract PullPayment { ...@@ -16,9 +16,9 @@ contract PullPayment {
uint public totalPayments; uint public totalPayments;
/** /**
* @dev store sent amount as credit to be pulled, called by payer * @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest address The destination address of the funds * @param dest The destination address of the funds.
* @param amount uint The amount to transfer * @param amount The amount to transfer.
*/ */
function asyncSend(address dest, uint amount) internal { function asyncSend(address dest, uint amount) internal {
payments[dest] = payments[dest].add(amount); payments[dest] = payments[dest].add(amount);
...@@ -26,7 +26,7 @@ contract PullPayment { ...@@ -26,7 +26,7 @@ contract PullPayment {
} }
/** /**
@dev withdraw accumulated balance, called by payee. * @dev withdraw accumulated balance, called by payee.
*/ */
function withdrawPayments() { function withdrawPayments() {
address payee = msg.sender; address payee = msg.sender;
......
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