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

Allow non-beneficiaries to trigger release of their funds #1275

Merged
merged 5 commits into from Sep 5, 2018

Conversation

frangio
Copy link
Contributor

@frangio frangio commented Sep 4, 2018

Fixes #1132.

@frangio frangio added kind:improvement contracts Smart contract code. breaking change Changes that break backwards compatibility of the public API. labels Sep 4, 2018
@frangio frangio added this to the v2.0 milestone Sep 4, 2018
Copy link
Contributor

@nventuro nventuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks @frangio! Are these all the instances of #1132 you found, or is there any more work remaining?

We're getting a false-positive falling coverage warning: SplitPayment has less than 100% coverage (due to an assert), and that file is shorter after this PR - nothing to worry about.

address payee = msg.sender;

require(shares[payee] > 0);
function release(address _payee) public {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ninja API-change!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to ask for comments on this. What do you think? I felt that the previous name was not representative now.

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 a plain withdraw is better than both of those, actually. I'm also not sure why we have escrow.withdraw but pullPayment.withdrawPayments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we've had this discussion before. The thing is TokenTimelock is using release. It would be nice to make it consistent and use the same term everywhere, if it makes sense.

Copy link
Contributor

@nventuro nventuro Sep 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably have 😛 I'd rather rename TokenTimelock's to withdraw, but this is not the place for that discussion.

const gasCost = (new web3.BigNumber(gas)).times(gasPrice);

await this.bounty.withdrawPayments({ from: researcher, gasPrice: gasPrice });
await this.bounty.withdrawPayments(researcher, { gasPrice: 0 });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gasPrice: 0 thing is something we should include in the testing guide (#1077).

@@ -51,7 +51,7 @@ contract('PostDeliveryCrowdsale', function ([_, investor, wallet, purchaser]) {
});

it('does not allow beneficiaries to withdraw tokens before crowdsale ends', async function () {
await expectThrow(this.crowdsale.withdrawTokens({ from: investor }), EVMRevert);
await expectThrow(this.crowdsale.withdrawTokens(investor), EVMRevert);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to do { from: anyone } on these, for further clarification? I'm not a fan of the extra verboseness, but dislike using the default account.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've never discussed this but I've actually always used the _ account as the anyone account.

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 we should use anyone, if only just for the sake of explicitness (in a separate PR)

@frangio
Copy link
Contributor Author

frangio commented Sep 5, 2018

@nventuro These are all the instances I found, by searching for the use of msg.sender.

@frangio frangio merged commit 4eb4d71 into OpenZeppelin:master Sep 5, 2018
@frangio frangio deleted the anyone-trigger branch September 5, 2018 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Changes that break backwards compatibility of the public API. contracts Smart contract code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants