|
|
|
@ -3,8 +3,8 @@ pragma solidity ^0.4.8; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @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. |
|
|
|
|
*/ |
|
|
|
|
contract Shareable { |
|
|
|
@ -42,19 +42,23 @@ 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 |
|
|
|
|
// thus count as confirmations. |
|
|
|
|
/** |
|
|
|
|
* @dev Modifier for multisig functions. |
|
|
|
|
* @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) { |
|
|
|
|
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. |
|
|
|
|
* @param _owners address[] A list of owners |
|
|
|
|
* @param _required Uint The amout required for a transaction to be approved. |
|
|
|
|
/** |
|
|
|
|
* @dev Constructor is given the number of sigs required to do protected "onlymanyowners" |
|
|
|
|
* transactions as well as the selection of addresses capable of confirming them. |
|
|
|
|
* @param _owners A list of owners. |
|
|
|
|
* @param _required The amount required for a transaction to be approved. |
|
|
|
|
*/ |
|
|
|
|
function Shareable(address[] _owners, uint _required) { |
|
|
|
|
owners[1] = msg.sender; |
|
|
|
@ -107,10 +111,10 @@ contract Shareable { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Function to check is specific owner has already confirme the operation |
|
|
|
|
* @param _operation bytes32 The operation identifier |
|
|
|
|
* @param _owner address The owner address |
|
|
|
|
* @return True if the owner has confirmed and flase otherwise |
|
|
|
|
* @dev Function to check is specific owner has already confirme the operation. |
|
|
|
|
* @param _operation The operation identifier. |
|
|
|
|
* @param _owner The owner address. |
|
|
|
|
* @return True if the owner has confirmed and false otherwise. |
|
|
|
|
*/ |
|
|
|
|
function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) { |
|
|
|
|
var pending = pendings[_operation]; |
|
|
|
@ -127,9 +131,9 @@ contract Shareable { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Confirm and operation and checks if it's already executable |
|
|
|
|
* @param _operation bytes32 The operation identifier |
|
|
|
|
* @return returns true when operation can be executed |
|
|
|
|
* @dev Confirm and operation and checks if it's already executable. |
|
|
|
|
* @param _operation The operation identifier. |
|
|
|
|
* @return Returns true when operation can be executed. |
|
|
|
|
*/ |
|
|
|
|
function confirmAndCheck(bytes32 _operation) internal returns (bool) { |
|
|
|
|
// determine what index the present sender is: |
|
|
|
@ -171,7 +175,7 @@ contract Shareable { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Clear the pedings list. |
|
|
|
|
* @dev Clear the pending list. |
|
|
|
|
*/ |
|
|
|
|
function clearPending() internal { |
|
|
|
|
uint length = pendingsIndex.length; |
|
|
|
|