Skip to content

Commit d67a168

Browse files
cheetimlohvillesundell
authored andcommitted
Changes as requested by @villesundell.
1 parent 5dd627f commit d67a168

12 files changed

+35
-31
lines changed

contracts/BonusFinalizeAgent.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ contract BonusFinalizeAgent is FinalizeAgent {
3535
uint public allocatedBonus;
3636

3737
function BonusFinalizeAgent(CrowdsaleToken _token, Crowdsale _crowdsale, uint _bonusBasePoints, address _teamMultisig) {
38-
require(address(_crowdsale) != 0 && address(_teamMultisig) != 0);
38+
require(address(_crowdsale) != 0);
39+
require(address(_teamMultisig) != 0);
3940
token = _token;
4041
crowdsale = _crowdsale;
4142
teamMultisig = _teamMultisig;

contracts/Crowdsale.sol

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ contract Crowdsale is Haltable {
151151
/**
152152
* Don't expect to just send in money and get tokens.
153153
*/
154-
function() payable {
155-
require(false);
154+
function() {
156155
}
157156

158157
/**
@@ -176,7 +175,7 @@ contract Crowdsale is Haltable {
176175
// pass
177176
} else {
178177
// Unwanted state
179-
assert(false);
178+
revert();
180179
}
181180

182181
uint weiAmount = msg.value;
@@ -209,7 +208,7 @@ contract Crowdsale is Haltable {
209208
assignTokens(receiver, tokenAmount);
210209

211210
// Pocket the money
212-
require(multisigWallet.send(weiAmount));
211+
multisigWallet.transfer(weiAmount);
213212

214213
// Tell us invest was success
215214
Invested(receiver, weiAmount, tokenAmount, customerId);
@@ -429,7 +428,7 @@ contract Crowdsale is Haltable {
429428
investedAmountOf[msg.sender] = 0;
430429
weiRefunded = weiRefunded.plus(weiValue);
431430
Refund(msg.sender, weiValue);
432-
require(msg.sender.send(weiValue));
431+
msg.sender.transfer(weiValue);
433432
}
434433

435434
/**

contracts/EthTranchePricing.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ contract EthTranchePricing is PricingStrategy, Ownable {
4848
/// @param _tranches uint[] tranches Pairs of (start amount, price)
4949
function EthTranchePricing(uint[] _tranches) {
5050
// Need to have tuples, length check
51-
require((_tranches.length % 2 == 0) && (_tranches.length < MAX_TRANCHES*2));
51+
require((_tranches.length % 2 == 0) && (_tranches.length <= MAX_TRANCHES*2));
5252

5353
trancheCount = _tranches.length / 2;
5454

@@ -153,8 +153,8 @@ contract EthTranchePricing is PricingStrategy, Ownable {
153153
return value.times(multiplier) / price;
154154
}
155155

156-
function() payable {
157-
require(false); // No money on this contract
156+
function() {
157+
// No money on this contract
158158
}
159159

160160
}

contracts/ExtraFinalizeAgent.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ contract ExtraFinalizeAgent is FinalizeAgent {
3838
uint public accountedTokenSales;
3939

4040
function ExtraFinalizeAgent(CrowdsaleToken _token, Crowdsale _crowdsale, uint _bonusBasePoints, address _teamMultisig, uint _accountedTokenSales) {
41-
require(address(_crowdsale) != 0 && address(_teamMultisig) != 0);
41+
require(address(_crowdsale) != 0);
42+
require(address(_teamMultisig) != 0);
4243

4344
token = _token;
4445
crowdsale = _crowdsale;

contracts/MilestonePricing.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ contract MilestonePricing is PricingStrategy, Ownable {
4646
/// @param _milestones uint[] milestones Pairs of (time, price)
4747
function MilestonePricing(uint[] _milestones) {
4848
// Need to have tuples, length check
49-
require((_milestones.length % 2 == 0) && (_milestones.length < MAX_MILESTONE*2));
49+
require((_milestones.length % 2 == 0) && (_milestones.length <= MAX_MILESTONE*2));
5050

5151
milestoneCount = _milestones.length / 2;
5252

@@ -143,8 +143,8 @@ contract MilestonePricing is PricingStrategy, Ownable {
143143
return false;
144144
}
145145

146-
function() payable {
147-
require(false); // No money on this contract
146+
function() {
147+
// No money on this contract
148148
}
149149

150150
}

contracts/PaymentForwarder.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ contract PaymentForwarder is Haltable {
6868
paymentsByBenefactor[benefactor] += weiAmount;
6969

7070
// May run out of gas
71-
require(teamMultisig.send(weiAmount));
71+
teamMultisig.transfer(weiAmount);
7272
}
7373

7474
/**

contracts/PreICOProxyBuyer.sol

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ contract PreICOProxyBuyer is Ownable, Haltable {
8888
function PreICOProxyBuyer(address _owner, uint _freezeEndsAt, uint _weiMinimumLimit, uint _weiMaximumLimit, uint _weiCap) {
8989

9090
// Give argument
91-
require(_freezeEndsAt != 0 && _weiMinimumLimit != 0 && _weiMaximumLimit != 0);
91+
require(_freezeEndsAt != 0);
92+
require(_weiMinimumLimit != 0);
93+
require(_weiMaximumLimit != 0);
9294

9395
owner = _owner;
9496

@@ -157,7 +159,7 @@ contract PreICOProxyBuyer is Ownable, Haltable {
157159
function buyForEverybody() stopNonOwnersInEmergency public {
158160

159161
// Only allow buy once
160-
require(getState() == State.Funding) ;
162+
require(getState() == State.Funding);
161163

162164
// Crowdsale not yet set
163165
require(address(crowdsale) != 0);
@@ -234,7 +236,7 @@ contract PreICOProxyBuyer is Ownable, Haltable {
234236
require(balances[investor] != 0);
235237
uint amount = balances[investor];
236238
delete balances[investor];
237-
require(investor.call.value(amount)());
239+
investor.transfer(amount);
238240
Refunded(investor, amount);
239241
}
240242

@@ -285,7 +287,6 @@ contract PreICOProxyBuyer is Ownable, Haltable {
285287
}
286288

287289
/** Explicitly call function from your wallet. */
288-
function() payable {
289-
require(false);
290+
function() {
290291
}
291292
}

contracts/PresaleFundCollector.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ contract PresaleFundCollector is Ownable {
5656
function PresaleFundCollector(address _owner, uint _freezeEndsAt, uint _weiMinimumLimit) {
5757

5858
// Give argument
59-
require(_freezeEndsAt != 0 && _weiMinimumLimit != 0);
59+
require(_freezeEndsAt != 0);
60+
require(_weiMinimumLimit != 0);
6061

6162
owner = _owner;
6263

@@ -139,7 +140,7 @@ contract PresaleFundCollector is Ownable {
139140
require(balances[investor] != 0);
140141
uint amount = balances[investor];
141142
delete balances[investor];
142-
require(investor.send(amount));
143+
investor.transfer(amount);
143144
Refunded(investor, amount);
144145
}
145146

@@ -151,7 +152,6 @@ contract PresaleFundCollector is Ownable {
151152
}
152153

153154
/** Explicitly call function from your wallet. */
154-
function() payable {
155-
require(false);
155+
function() {
156156
}
157157
}

contracts/TimeVault.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ contract TimeVault {
3535

3636
function TimeVault(address _teamMultisig, StandardTokenExt _token, uint _unlockedAt) {
3737
// Sanity check
38-
require(_teamMultisig != 0x0 && address(_token) != 0x0);
38+
require(_teamMultisig != 0x0);
39+
require(address(_token) != 0x0);
3940

4041
teamMultisig = _teamMultisig;
4142
token = _token;
@@ -57,6 +58,7 @@ contract TimeVault {
5758
}
5859

5960
// disallow ETH payment for this vault
60-
function () { require(false); }
61+
function () {
62+
}
6163

6264
}

contracts/TokenTranchePricing.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ contract TokenTranchePricing is PricingStrategy, Ownable {
4848
/// @param _tranches uint[] tranches Pairs of (start amount, price)
4949
function TokenTranchePricing(uint[] _tranches) {
5050
// Need to have tuples, length check
51-
require((_tranches.length % 2 == 0) && (_tranches.length < MAX_TRANCHES*2));
51+
require((_tranches.length % 2 == 0) && (_tranches.length <= MAX_TRANCHES*2));
5252

5353
trancheCount = _tranches.length / 2;
5454

@@ -143,8 +143,8 @@ contract TokenTranchePricing is PricingStrategy, Ownable {
143143
return value.times(multiplier) / price;
144144
}
145145

146-
function() payable {
147-
require(false); // No money on this contract
146+
function() {
147+
// No money on this contract
148148
}
149149

150150
}

0 commit comments

Comments
 (0)