Skip to content
This repository was archived by the owner on Dec 28, 2019. It is now read-only.

Conversation

@axic
Copy link
Contributor

@axic axic commented Oct 28, 2018

No description provided.

@axic axic requested a review from lrettig October 28, 2018 13:59
@axic axic force-pushed the beneficiary-limit branch from ba2f4f0 to 340166c Compare October 28, 2018 17:07
if (totalWithdrawn >= beneficiaryLimit)
owner().transfer(this.balance);
else {
uint256 amonut = Math.min(this.balance, beneficiaryLimit);
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this could be expressed more cleanly:

uint256 amountToBeneficiary = Math.min(this.balance - totalWithdrawn, beneficiaryLimit)
uint256 amountToOwner = this.balance - amountToBeneficiary
totalWithdrawn += amountToBeneficiary
_beneficiary.transfer(amountToBeneficiary)
owner().transfer(amountToOwner)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can be called repeatedly. It is a lot of extra gas doing those calls with 0 eth.

@axic axic force-pushed the beneficiary-limit branch from 340166c to 5ba159d Compare October 29, 2018 09:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants