Merge pull request #176 from frangio/shareable-owners-type

Change type of `owners` from uint[] to address[]
pull/177/head
Manuel Aráoz 8 years ago committed by GitHub
commit f2159be68d
  1. 20
      contracts/ownership/Shareable.sol

@ -23,9 +23,9 @@ contract Shareable {
uint public required;
// list of owners
uint[256] owners;
address[256] owners;
// index on the list of owners to allow reverse lookup
mapping(uint => uint) ownerIndex;
mapping(address => uint) ownerIndex;
// the ongoing operations.
mapping(bytes32 => PendingState) pendings;
bytes32[] pendingsIndex;
@ -57,18 +57,18 @@ contract Shareable {
// constructor is given number of sigs required to do protected "onlymanyowners" transactions
// as well as the selection of addresses capable of confirming them.
function Shareable(address[] _owners, uint _required) {
owners[1] = uint(msg.sender);
ownerIndex[uint(msg.sender)] = 1;
owners[1] = msg.sender;
ownerIndex[msg.sender] = 1;
for (uint i = 0; i < _owners.length; ++i) {
owners[2 + i] = uint(_owners[i]);
ownerIndex[uint(_owners[i])] = 2 + i;
owners[2 + i] = _owners[i];
ownerIndex[_owners[i]] = 2 + i;
}
required = _required;
}
// Revokes a prior confirmation of the given operation
function revoke(bytes32 _operation) external {
uint index = ownerIndex[uint(msg.sender)];
uint index = ownerIndex[msg.sender];
// make sure they're an owner
if (index == 0) {
return;
@ -88,12 +88,12 @@ contract Shareable {
}
function isOwner(address _addr) constant returns (bool) {
return ownerIndex[uint(_addr)] > 0;
return ownerIndex[_addr] > 0;
}
function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) {
var pending = pendings[_operation];
uint index = ownerIndex[uint(_owner)];
uint index = ownerIndex[_owner];
// make sure they're an owner
if (index == 0) {
@ -107,7 +107,7 @@ contract Shareable {
function confirmAndCheck(bytes32 _operation) internal returns (bool) {
// determine what index the present sender is:
uint index = ownerIndex[uint(msg.sender)];
uint index = ownerIndex[msg.sender];
// make sure they're an owner
if (index == 0) {
return;

Loading…
Cancel
Save