-
Notifications
You must be signed in to change notification settings - Fork 564
Eliminate throw() per issue #44. #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
53c72f5
2e32e1c
af7f0f2
a6e94f1
6e5a19c
2c6668f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,59 +36,50 @@ contract MultiSigWallet { | |
} | ||
|
||
modifier onlyWallet() { | ||
if (msg.sender != address(this)) | ||
throw; | ||
require(msg.sender == address(this)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For Gnosis, let's just use fresh upstream file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will use upstream file once upstream has merged my pull request gnosis/MultiSigWallet#12 that eliminates throw and other warnings, thanks. |
||
_; | ||
} | ||
|
||
modifier ownerDoesNotExist(address owner) { | ||
if (isOwner[owner]) | ||
throw; | ||
require(!isOwner[owner]); | ||
_; | ||
} | ||
|
||
modifier ownerExists(address owner) { | ||
if (!isOwner[owner]) | ||
throw; | ||
require(isOwner[owner]); | ||
_; | ||
} | ||
|
||
modifier transactionExists(uint transactionId) { | ||
if (transactions[transactionId].destination == 0) | ||
throw; | ||
require(transactions[transactionId].destination != 0); | ||
_; | ||
} | ||
|
||
modifier confirmed(uint transactionId, address owner) { | ||
if (!confirmations[transactionId][owner]) | ||
throw; | ||
require(confirmations[transactionId][owner]); | ||
_; | ||
} | ||
|
||
modifier notConfirmed(uint transactionId, address owner) { | ||
if (confirmations[transactionId][owner]) | ||
throw; | ||
require(!confirmations[transactionId][owner]); | ||
_; | ||
} | ||
|
||
modifier notExecuted(uint transactionId) { | ||
if (transactions[transactionId].executed) | ||
throw; | ||
require(!transactions[transactionId].executed); | ||
_; | ||
} | ||
|
||
modifier notNull(address _address) { | ||
if (_address == 0) | ||
throw; | ||
require(_address != 0); | ||
_; | ||
} | ||
|
||
modifier validRequirement(uint ownerCount, uint _required) { | ||
if ( ownerCount > MAX_OWNER_COUNT | ||
|| _required > ownerCount | ||
|| _required == 0 | ||
|| ownerCount == 0) | ||
throw; | ||
require(ownerCount <= MAX_OWNER_COUNT | ||
&& _required <= ownerCount | ||
&& _required != 0 | ||
&& ownerCount != 0); | ||
_; | ||
} | ||
|
||
|
@@ -111,8 +102,7 @@ contract MultiSigWallet { | |
validRequirement(_owners.length, _required) | ||
{ | ||
for (uint i=0; i<_owners.length; i++) { | ||
if (isOwner[_owners[i]] || _owners[i] == 0) | ||
throw; | ||
require(!isOwner[_owners[i]] && _owners[i] != 0); | ||
isOwner[_owners[i]] = true; | ||
} | ||
owners = _owners; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should probably be moved to the same place the "throw" used to be? Minting should be optional, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The require() ensures that token is either mintable or is pre-allocated an initial supply so minting is optional as long as initial supply of tokens has been pre-allocated. Hence, I think start of function is an appropriate place for the require().