Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

timloh-gtoken
Copy link

No description provided.

@miohtama
Copy link
Contributor

Thanks. Is this ready to merge?

@timloh-gtoken
Copy link
Author

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));
Copy link
Contributor

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

Copy link
Author

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.

@namanyayg
Copy link

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?

@miohtama
Copy link
Contributor

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.

Copy link
Contributor

@villesundell villesundell left a 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);
Copy link
Contributor

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?

Copy link
Author

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.

@@ -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);
Copy link
Contributor

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?

Copy link
Author

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
Copy link
Contributor

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".

Copy link
Author

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().

@@ -150,7 +144,7 @@ contract TokenTranchePricing is PricingStrategy, Ownable {
}

function() payable {
throw; // No money on this contract
Copy link
Contributor

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.

Copy link
Author

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.

if(_tranches.length % 2 == 1 || _tranches.length >= MAX_TRANCHES*2) {
throw;
}
require((_tranches.length % 2 == 0) && (_tranches.length < MAX_TRANCHES*2));
Copy link
Contributor

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)

Copy link
Author

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.

@@ -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);
Copy link
Contributor

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?

Copy link
Author

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.

@@ -163,7 +152,7 @@ contract Crowdsale is Haltable {
* Don't expect to just send in money and get tokens.
*/
function() payable {
throw;
require(false);
Copy link
Contributor

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)

Copy link
Author

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.

} else if(getState() == State.Funding) {
// Retail participants can only come in when the crowdsale is running
// pass
} else {
// Unwanted state
throw;
assert(false);
Copy link
Contributor

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()?

Copy link
Author

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.


assignTokens(receiver, tokenAmount);

// Pocket the money
if(!multisigWallet.send(weiAmount)) throw;
require(multisigWallet.send(weiAmount));
Copy link
Contributor

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.

Copy link
Author

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.

investedAmountOf[msg.sender] = 0;
weiRefunded = weiRefunded.plus(weiValue);
Refund(msg.sender, weiValue);
if (!msg.sender.send(weiValue)) throw;
require(msg.sender.send(weiValue));
Copy link
Contributor

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()

Copy link
Author

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.

@miohtama
Copy link
Contributor

miohtama commented Nov 27, 2017

This is still pending, but slowly being merged to the master bit by bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants