From 7f7238378c992c2473c73420337d2fd2ea0545bf Mon Sep 17 00:00:00 2001 From: Francisco Giordano Date: Fri, 31 Mar 2017 12:53:19 -0300 Subject: [PATCH] change type of owners from uint[] to address[] fixes #175 --- contracts/ownership/Shareable.sol | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contracts/ownership/Shareable.sol b/contracts/ownership/Shareable.sol index e07516bd1..62fbc2fee 100644 --- a/contracts/ownership/Shareable.sol +++ b/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;