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.
|
/// @dev Contract constructor sets initial owners and required number of confirmations.
|
||||||
/// @param _owners List of initial owners.
|
/// @param _owners List of initial owners.
|
||||||
/// @param _required Number of required confirmations.
|
/// @param _required Number of required confirmations.
|
||||||
@ -115,6 +103,19 @@ contract MultiSigWallet {
|
|||||||
required = _required;
|
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.
|
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
|
||||||
/// @param owner Address of new owner.
|
/// @param owner Address of new owner.
|
||||||
function addOwner(address owner)
|
function addOwner(address owner)
|
||||||
@ -225,9 +226,9 @@ contract MultiSigWallet {
|
|||||||
notExecuted(transactionId)
|
notExecuted(transactionId)
|
||||||
{
|
{
|
||||||
if (isConfirmed(transactionId)) {
|
if (isConfirmed(transactionId)) {
|
||||||
Transaction storage tx = transactions[transactionId];
|
Transaction storage transaction = transactions[transactionId];
|
||||||
(tx.executed,) = tx.destination.call{value: tx.value}(tx.data);
|
(transaction.executed,) = transaction.destination.call{value: transaction.value}(transaction.data);
|
||||||
if (tx.executed)
|
if (transaction.executed)
|
||||||
emit Execution(transactionId);
|
emit Execution(transactionId);
|
||||||
else
|
else
|
||||||
emit ExecutionFailure(transactionId);
|
emit ExecutionFailure(transactionId);
|
||||||
@ -249,30 +250,7 @@ contract MultiSigWallet {
|
|||||||
if (count == required)
|
if (count == required)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
|
|
||||||
/*
|
|
||||||
* 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -362,4 +340,27 @@ contract MultiSigWallet {
|
|||||||
for (i=from; i<to; i++)
|
for (i=from; i<to; i++)
|
||||||
_transactionIds[i - from] = transactionIdsTemp[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