Eliminate throw() per issue #44.#61
Eliminate throw() per issue #44.#61timloh-gtoken wants to merge 6 commits intoTokenMarketNet:masterfrom
Conversation
|
Thanks. Is this ready to merge? |
|
Yes, this is ready to merge, thanks. |
| modifier onlyWallet() { | ||
| if (msg.sender != address(this)) | ||
| throw; | ||
| require(msg.sender == address(this)); |
There was a problem hiding this comment.
For Gnosis, let's just use fresh upstream file
There was a problem hiding this comment.
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. |
villesundell
left a comment
There was a problem hiding this comment.
The overall quality is high, thank you for contributing this!
|
|
||
| function() public payable { | ||
| throw; | ||
| require(false); |
There was a problem hiding this comment.
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.
Removed "payable" modifier and require() to leave an empty function.
contracts/UpgradeableToken.sol
Outdated
| 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.
I think "semantically" these should be two separate require()s?
There was a problem hiding this comment.
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.
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.
Since they are dealing with the same data, think better to use same require().
| } | ||
|
|
||
| function() payable { | ||
| throw; // No money on this contract |
There was a problem hiding this comment.
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.
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.
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.
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
| 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.
Should these be two separate require()s?
There was a problem hiding this comment.
Thanks for the compliments, changed to two separate require()s as requested.
contracts/Crowdsale.sol
Outdated
| */ | ||
| function() payable { | ||
| throw; | ||
| require(false); |
There was a problem hiding this comment.
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.
Removed "payable" modifier and require() to make empty function as requested.
contracts/Crowdsale.sol
Outdated
| } else { | ||
| // Unwanted state | ||
| throw; | ||
| assert(false); |
There was a problem hiding this comment.
This should be probably revert()?
There was a problem hiding this comment.
Changed to revert() as requested.
contracts/Crowdsale.sol
Outdated
|
|
||
| // Pocket the money | ||
| if(!multisigWallet.send(weiAmount)) throw; | ||
| require(multisigWallet.send(weiAmount)); |
There was a problem hiding this comment.
We could use .transfer() instead of .send(), then require() would not be needed.
There was a problem hiding this comment.
Changed to use .transfer() as requested.
contracts/Crowdsale.sol
Outdated
| 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.
We could use .transfer() instead of .send(), eliminating the need for require()
There was a problem hiding this comment.
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.