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

Modifier isBalanceEnough is not needed #1

Open
cleanunicorn opened this issue Aug 8, 2022 · 0 comments
Open

Modifier isBalanceEnough is not needed #1

cleanunicorn opened this issue Aug 8, 2022 · 0 comments

Comments

@cleanunicorn
Copy link
Member

cleanunicorn commented Aug 8, 2022

Description

This is not needed since the tx will fail anyway if not enough ether is available.

/**
* @dev Throws if _amount exceeds contract balance
*
* @param _amount amount to withdraw
*/
modifier isBalanceEnough(uint256 _amount) {
require(_amount <= address(this).balance, "Not Enough Balance");
_;
}

Recommendation

Remove modifier since this will not change how the contract functions.

Keep the modifier isBalanceNotZero since this will not create a "no-operation" transaction that doesn't transfer any ether.

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

No branches or pull requests

1 participant