-
Notifications
You must be signed in to change notification settings - Fork 563
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
Eliminate throw() per issue #44. #61
base: master
Are you sure you want to change the base?
Eliminate throw() per issue #44. #61
Conversation
Thanks. Is this ready to merge? |
Yes, this is ready to merge, thanks. |
@@ -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 comment
The 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 comment
The 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.
Hi, any reason this has not been merged? Looking to launch an ICO and would prefer not using deprecated features. Are there any issues with the pull request? |
No particular reason besides lack of capacity in review pipeline. I'll have mycoworker @villesundell to review this, merge tomorrow. Please if you need anything, @namanyayg, join our Gitter chat. |
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 overall quality is high, thank you for contributing this!
@@ -43,7 +39,7 @@ contract TestMigrationTarget is StandardToken, UpgradeAgent { | |||
} | |||
|
|||
function() public payable { | |||
throw; | |||
require(false); |
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 that we should use revert().. ...if this would be a normal function. However, in this case I think we can just leave an empty function and remove the "payable" modifier?
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.
Removed "payable" modifier and require() to leave an empty function.
contracts/UpgradeableToken.sol
Outdated
@@ -121,8 +116,7 @@ contract UpgradeableToken is StandardToken { | |||
* This allows us to set a new owner for the upgrade mechanism. | |||
*/ | |||
function setUpgradeMaster(address master) public { | |||
if (master == 0x0) throw; | |||
if (msg.sender != upgradeMaster) throw; | |||
require(master != 0x0 && msg.sender == upgradeMaster); |
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 "semantically" these should be two separate require()s?
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.
Changed to two separate require()s.
// Called in a bad state | ||
throw; | ||
} | ||
require(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading); // Called in a bad state |
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 am not sure should these be two separate require()s, afterall those are dealing with the same variable "state".
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.
Since they are dealing with the same data, think better to use same require().
contracts/TokenTranchePricing.sol
Outdated
@@ -150,7 +144,7 @@ contract TokenTranchePricing is PricingStrategy, Ownable { | |||
} | |||
|
|||
function() payable { | |||
throw; // No money on this contract |
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.
Same as with TestMigrationTarget.sol: I suppose we can have this as an empty function, and remove the "payable" modifier.
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.
Removed "payable" modifier and require() resulting in empty function.
contracts/TokenTranchePricing.sol
Outdated
if(_tranches.length % 2 == 1 || _tranches.length >= MAX_TRANCHES*2) { | ||
throw; | ||
} | ||
require((_tranches.length % 2 == 0) && (_tranches.length < MAX_TRANCHES*2)); |
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.
Should we have two require()s here? (I am not sure, since we are working with the same variable)
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.
Since they are dealing with the same data, think better to use same require(). Have changed condition to _tranches.length <= MAX_TRANCHES * 2 similar to EthTranchePricing.sol.
contracts/BonusFinalizeAgent.sol
Outdated
@@ -35,17 +35,10 @@ contract BonusFinalizeAgent is FinalizeAgent { | |||
uint public allocatedBonus; | |||
|
|||
function BonusFinalizeAgent(CrowdsaleToken _token, Crowdsale _crowdsale, uint _bonusBasePoints, address _teamMultisig) { | |||
require(address(_crowdsale) != 0 && address(_teamMultisig) != 0); |
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.
Should these be two separate require()s?
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.
Thanks for the compliments, changed to two separate require()s as requested.
contracts/Crowdsale.sol
Outdated
@@ -163,7 +152,7 @@ contract Crowdsale is Haltable { | |||
* Don't expect to just send in money and get tokens. | |||
*/ | |||
function() payable { | |||
throw; | |||
require(false); |
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.
We could remove the "payable" modifier and the require() to make an empty function (In my opinion the function should be stay there anyway to signal that this is intentional)
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.
Removed "payable" modifier and require() to make empty function as requested.
contracts/Crowdsale.sol
Outdated
} else if(getState() == State.Funding) { | ||
// Retail participants can only come in when the crowdsale is running | ||
// pass | ||
} else { | ||
// Unwanted state | ||
throw; | ||
assert(false); |
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.
This should be probably revert()?
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.
Changed to revert() as requested.
contracts/Crowdsale.sol
Outdated
|
||
assignTokens(receiver, tokenAmount); | ||
|
||
// Pocket the money | ||
if(!multisigWallet.send(weiAmount)) throw; | ||
require(multisigWallet.send(weiAmount)); |
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.
We could use .transfer() instead of .send(), then require() would not be needed.
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.
Changed to use .transfer() as requested.
contracts/Crowdsale.sol
Outdated
investedAmountOf[msg.sender] = 0; | ||
weiRefunded = weiRefunded.plus(weiValue); | ||
Refund(msg.sender, weiValue); | ||
if (!msg.sender.send(weiValue)) throw; | ||
require(msg.sender.send(weiValue)); |
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.
We could use .transfer() instead of .send(), eliminating the need for require()
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.
Changed to use .transfer() as requested.
…minate-throw # Conflicts: # contracts/MilestonePricing.sol
This is still pending, but slowly being merged to the master bit by bit. |
No description provided.