Skip to content

Commit 5dd627f

Browse files
Tim Lohvillesundell
authored andcommitted
Eliminate throw from GnosisWallet.sol.
1 parent 00f073f commit 5dd627f

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

contracts/GnosisWallet.sol

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,59 +36,50 @@ contract MultiSigWallet {
3636
}
3737

3838
modifier onlyWallet() {
39-
if (msg.sender != address(this))
40-
throw;
39+
require(msg.sender == address(this));
4140
_;
4241
}
4342

4443
modifier ownerDoesNotExist(address owner) {
45-
if (isOwner[owner])
46-
throw;
44+
require(!isOwner[owner]);
4745
_;
4846
}
4947

5048
modifier ownerExists(address owner) {
51-
if (!isOwner[owner])
52-
throw;
49+
require(isOwner[owner]);
5350
_;
5451
}
5552

5653
modifier transactionExists(uint transactionId) {
57-
if (transactions[transactionId].destination == 0)
58-
throw;
54+
require(transactions[transactionId].destination != 0);
5955
_;
6056
}
6157

6258
modifier confirmed(uint transactionId, address owner) {
63-
if (!confirmations[transactionId][owner])
64-
throw;
59+
require(confirmations[transactionId][owner]);
6560
_;
6661
}
6762

6863
modifier notConfirmed(uint transactionId, address owner) {
69-
if (confirmations[transactionId][owner])
70-
throw;
64+
require(!confirmations[transactionId][owner]);
7165
_;
7266
}
7367

7468
modifier notExecuted(uint transactionId) {
75-
if (transactions[transactionId].executed)
76-
throw;
69+
require(!transactions[transactionId].executed);
7770
_;
7871
}
7972

8073
modifier notNull(address _address) {
81-
if (_address == 0)
82-
throw;
74+
require(_address != 0);
8375
_;
8476
}
8577

8678
modifier validRequirement(uint ownerCount, uint _required) {
87-
if ( ownerCount > MAX_OWNER_COUNT
88-
|| _required > ownerCount
89-
|| _required == 0
90-
|| ownerCount == 0)
91-
throw;
79+
require(ownerCount <= MAX_OWNER_COUNT
80+
&& _required <= ownerCount
81+
&& _required != 0
82+
&& ownerCount != 0);
9283
_;
9384
}
9485

@@ -111,8 +102,7 @@ contract MultiSigWallet {
111102
validRequirement(_owners.length, _required)
112103
{
113104
for (uint i=0; i<_owners.length; i++) {
114-
if (isOwner[_owners[i]] || _owners[i] == 0)
115-
throw;
105+
require(!isOwner[_owners[i]] && _owners[i] != 0);
116106
isOwner[_owners[i]] = true;
117107
}
118108
owners = _owners;

0 commit comments

Comments
 (0)