mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #12835 from dtedesco1/develop
Fix MultiSigWallet.sol order of functions
This commit is contained in:
commit
1bc1f8bdbb
@ -88,18 +88,6 @@ contract MultiSigWallet {
|
||||
_;
|
||||
}
|
||||
|
||||
/// @dev Receive function allows to deposit ether.
|
||||
receive()
|
||||
external
|
||||
payable
|
||||
{
|
||||
if (msg.value > 0)
|
||||
emit Deposit(msg.sender, msg.value);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
@ -115,6 +103,19 @@ contract MultiSigWallet {
|
||||
required = _required;
|
||||
}
|
||||
|
||||
/// @dev Receive function allows to deposit ether.
|
||||
receive()
|
||||
external
|
||||
payable
|
||||
{
|
||||
if (msg.value > 0)
|
||||
emit Deposit(msg.sender, msg.value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
|
||||
/// @param owner Address of new owner.
|
||||
function addOwner(address owner)
|
||||
@ -225,9 +226,9 @@ contract MultiSigWallet {
|
||||
notExecuted(transactionId)
|
||||
{
|
||||
if (isConfirmed(transactionId)) {
|
||||
Transaction storage tx = transactions[transactionId];
|
||||
(tx.executed,) = tx.destination.call{value: tx.value}(tx.data);
|
||||
if (tx.executed)
|
||||
Transaction storage transaction = transactions[transactionId];
|
||||
(transaction.executed,) = transaction.destination.call{value: transaction.value}(transaction.data);
|
||||
if (transaction.executed)
|
||||
emit Execution(transactionId);
|
||||
else
|
||||
emit ExecutionFailure(transactionId);
|
||||
@ -249,30 +250,7 @@ contract MultiSigWallet {
|
||||
if (count == required)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal functions
|
||||
*/
|
||||
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
|
||||
/// @param destination Transaction target address.
|
||||
/// @param value Transaction ether value.
|
||||
/// @param data Transaction data payload.
|
||||
/// @return transactionId Returns transaction ID.
|
||||
function addTransaction(address destination, uint value, bytes memory data)
|
||||
internal
|
||||
notNull(destination)
|
||||
returns (uint transactionId)
|
||||
{
|
||||
transactionId = transactionCount;
|
||||
transactions[transactionId] = Transaction({
|
||||
destination: destination,
|
||||
value: value,
|
||||
data: data,
|
||||
executed: false
|
||||
});
|
||||
transactionCount += 1;
|
||||
emit Submission(transactionId);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -362,4 +340,27 @@ contract MultiSigWallet {
|
||||
for (i=from; i<to; i++)
|
||||
_transactionIds[i - from] = transactionIdsTemp[i];
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Internal functions
|
||||
*/
|
||||
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
|
||||
/// @param destination Transaction target address.
|
||||
/// @param value Transaction ether value.
|
||||
/// @param data Transaction data payload.
|
||||
/// @return transactionId Returns transaction ID.
|
||||
function addTransaction(address destination, uint value, bytes memory data)
|
||||
internal
|
||||
notNull(destination)
|
||||
returns (uint transactionId)
|
||||
{
|
||||
transactionId = transactionCount;
|
||||
transactions[transactionId] = Transaction({
|
||||
destination: destination,
|
||||
value: value,
|
||||
data: data,
|
||||
executed: false
|
||||
});
|
||||
transactionCount += 1;
|
||||
emit Submission(transactionId);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user