mirror of
https://github.com/status-im/open-bounty.git
synced 2025-02-03 05:03:38 +00:00
cleanup and smaller stub
This commit is contained in:
parent
9c2775d87f
commit
cc4e742d03
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.11;
|
||||
pragma solidity ^0.4.15;
|
||||
|
||||
import "./MultiSigStub.sol";
|
||||
|
||||
@ -6,8 +6,9 @@ contract MultiSigFactory {
|
||||
|
||||
event Create(address indexed caller, address createdContract);
|
||||
|
||||
function create(address[] owners, uint required) returns (MultisigStub stub){
|
||||
stub = new MultiSigStub(owners, required);
|
||||
Create(msg.sender, stub);
|
||||
function create(address[] owners, uint256 required) returns (address wallet){
|
||||
wallet = new MultiSigStub(owners, required);
|
||||
Create(msg.sender, wallet);
|
||||
}
|
||||
|
||||
}
|
@ -1,23 +1,14 @@
|
||||
pragma solidity ^0.4.11;
|
||||
pragma solidity ^0.4.15;
|
||||
|
||||
/**
|
||||
* @title MultiSigStub
|
||||
* Contact that delegates calls to a library to build a full MultiSigWallet that is cheap to create.
|
||||
*/
|
||||
contract MultiSigStub {
|
||||
mapping (uint => Transaction) public transactions;
|
||||
mapping (uint => mapping (address => bool)) public confirmations;
|
||||
address[] public owners;
|
||||
|
||||
struct Transaction {
|
||||
address destination;
|
||||
uint value;
|
||||
bytes data;
|
||||
bool executed;
|
||||
}
|
||||
|
||||
function MultiSigStub(address[] _owners, uint _required) {
|
||||
bytes4 sig = bytes4(sha3("Constructor(address[],uint256)"));
|
||||
function MultiSigStub(address[] _owners, uint256 _required) {
|
||||
//bytes4 sig = bytes4(sha3("Constructor(address[],uint256)"));
|
||||
bytes4 sig = 0xe0c4e63b;
|
||||
uint argarraysize = (2 + _owners.length);
|
||||
uint argsize = (1 + argarraysize) * 32;
|
||||
uint size = 4 + argsize;
|
||||
@ -61,7 +52,7 @@ contract MultiSigStub {
|
||||
private
|
||||
returns(bytes32 m_result)
|
||||
{
|
||||
address target = 0xcafecafecafecafecafecafecafecafecafecafe; //will be replaced by correct value
|
||||
address target = 0x370A93cd1DC15875fF02aa0b952D44Bb3dD905E5; //will be replaced by correct value
|
||||
m_result = _malloc(32);
|
||||
bool failed;
|
||||
|
||||
@ -72,63 +63,5 @@ contract MultiSigStub {
|
||||
assert(!failed);
|
||||
}
|
||||
|
||||
/// @dev Returns list of owners.
|
||||
/// @return List of owner addresses.
|
||||
function getOwners()
|
||||
public
|
||||
constant
|
||||
returns (address[])
|
||||
{
|
||||
return owners;
|
||||
}
|
||||
|
||||
/// @dev Returns array with owner addresses, which confirmed transaction.
|
||||
/// @param transactionId Transaction ID.
|
||||
/// @return Returns array of owner addresses.
|
||||
function getConfirmations(uint transactionId)
|
||||
public
|
||||
constant
|
||||
returns (address[] _confirmations)
|
||||
{
|
||||
address[] memory confirmationsTemp = new address[](owners.length);
|
||||
uint count = 0;
|
||||
uint i;
|
||||
for (i=0; i<owners.length; i++)
|
||||
if (confirmations[transactionId][owners[i]]) {
|
||||
confirmationsTemp[count] = owners[i];
|
||||
count += 1;
|
||||
}
|
||||
_confirmations = new address[](count);
|
||||
for (i=0; i<count; i++)
|
||||
_confirmations[i] = confirmationsTemp[i];
|
||||
}
|
||||
|
||||
/// @dev Returns list of transaction IDs in defined range.
|
||||
|
||||
/// @param from Index start position of transaction array.
|
||||
/// @param to Index end position of transaction array.
|
||||
/// @param pending Include pending transactions.
|
||||
/// @param executed Include executed transactions.
|
||||
/// @return Returns array of transaction IDs.
|
||||
function getTransactionIds(uint from, uint to, bool pending, bool executed)
|
||||
public
|
||||
constant
|
||||
returns (uint[] _transactionIds)
|
||||
{
|
||||
uint[] memory transactionIdsTemp = new uint[](transactionCount);
|
||||
uint count = 0;
|
||||
uint i;
|
||||
for (i=0; i<transactionCount; i++)
|
||||
if ( pending && !transactions[i].executed
|
||||
|| executed && transactions[i].executed)
|
||||
{
|
||||
transactionIdsTemp[count] = i;
|
||||
count += 1;
|
||||
}
|
||||
_transactionIds = new uint[](to - from);
|
||||
for (i=from; i<to; i++)
|
||||
_transactionIds[i - from] = transactionIdsTemp[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.11;
|
||||
pragma solidity ^0.4.15;
|
||||
|
||||
contract ERC20 {
|
||||
uint256 public totalSupply;
|
||||
@ -102,9 +102,10 @@ contract MultiSigTokenWallet {
|
||||
Deposit(msg.sender, msg.value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
/**
|
||||
* Public functions
|
||||
*
|
||||
**/
|
||||
/// @dev Contract constructor sets initial owners and required number of confirmations.
|
||||
/// @param _owners List of initial owners.
|
||||
/// @param _required Number of required confirmations.
|
||||
|
Loading…
x
Reference in New Issue
Block a user