/** @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 {
/** @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 {
* @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) {