converted if() throw convention to require()/assert()/revert()

This commit is contained in:
Peter Murray
2017-07-09 13:57:43 -04:00
committed by Francisco Giordano
parent f3867f8477
commit 18581f138f
17 changed files with 87 additions and 132 deletions

View File

@ -25,19 +25,19 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
* @param _owners A list of owners.
* @param _required The amount required for a transaction to be approved.
*/
function MultisigWallet(address[] _owners, uint256 _required, uint256 _daylimit)
Shareable(_owners, _required)
function MultisigWallet(address[] _owners, uint256 _required, uint256 _daylimit)
Shareable(_owners, _required)
DayLimit(_daylimit) { }
/**
* @dev destroys the contract sending everything to `_to`.
/**
* @dev destroys the contract sending everything to `_to`.
*/
function destroy(address _to) onlymanyowners(keccak256(msg.data)) external {
selfdestruct(_to);
}
/**
* @dev Fallback function, receives value and emits a deposit event.
/**
* @dev Fallback function, receives value and emits a deposit event.
*/
function() payable {
// just being sent some cash?
@ -46,10 +46,10 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
}
/**
* @dev Outside-visible transaction entry point. Executes transaction immediately if below daily
* spending limit. If not, goes into multisig process. We provide a hash on return to allow the
* sender to provide shortcuts for the other confirmations (allowing them to avoid replicating
* the _to, _value, and _data arguments). They still get the option of using them if they want,
* @dev Outside-visible transaction entry point. Executes transaction immediately if below daily
* spending limit. If not, goes into multisig process. We provide a hash on return to allow the
* sender to provide shortcuts for the other confirmations (allowing them to avoid replicating
* the _to, _value, and _data arguments). They still get the option of using them if they want,
* anyways.
* @param _to The receiver address
* @param _value The value to send
@ -61,7 +61,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
SingleTransact(msg.sender, _value, _to, _data);
// yes - just execute the call.
if (!_to.call.value(_value)(_data)) {
throw;
revert();
}
return 0;
}
@ -76,30 +76,28 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
}
/**
* @dev Confirm a transaction by providing just the hash. We use the previous transactions map,
* @dev Confirm a transaction by providing just the hash. We use the previous transactions map,
* txs, in order to determine the body of the transaction from the hash provided.
* @param _h The transaction hash to approve.
*/
function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
if (txs[_h].to != 0) {
if (!txs[_h].to.call.value(txs[_h].value)(txs[_h].data)) {
throw;
}
assert(txs[_h].to.call.value(txs[_h].value)(txs[_h].data));
MultiTransact(msg.sender, _h, txs[_h].value, txs[_h].to, txs[_h].data);
delete txs[_h];
return true;
}
}
/**
* @dev Updates the daily limit value.
/**
* @dev Updates the daily limit value.
* @param _newLimit uint256 to represent the new limit.
*/
function setDailyLimit(uint256 _newLimit) onlymanyowners(keccak256(msg.data)) external {
_setDailyLimit(_newLimit);
}
/**
/**
* @dev Resets the value spent to enable more spending
*/
function resetSpentToday() onlymanyowners(keccak256(msg.data)) external {
@ -108,7 +106,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
// INTERNAL METHODS
/**
/**
* @dev Clears the list of transactions pending approval.
*/
function clearPending() internal {