-
Notifications
You must be signed in to change notification settings - Fork 0
audit:feedback-3 #38
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
audit:feedback-3 #38
Conversation
|
|
||
| /// @dev gets allocated Incentives | ||
| /// @return allocatedRewards Allocated rewards. | ||
| function getAllocatedIncentives() external view returns (uint256 allocatedRewards) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so sexy to be able to instansiate vars like this
src/DerolasAuction.sol
Outdated
| require(msg.sender == owner, "Unauthorized account"); | ||
| uint256 incentiveBalance = IToken(incentiveTokenAddress).balanceOf(address(this)); | ||
| uint256 incentiveBalance = IToken(incentiveTokenAddress).balanceOf(address(this)) - allocatedRewards; | ||
| require(incentiveBalance > 0, "No incentive token balance to withdraw"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if in line
incentiveBalance = IToken(incentiveTokenAddress).balanceOf(address(this)) - allocatedRewards;
IToken(incentiveTokenAddress).balanceOf(address(this)) < allocatedRewards
u not calculate negative number, but "arithmetic revert"
require(incentiveBalance > 0, "No incentive token balance to withdraw"); - not needed, anyway uint can't be negative
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see;
8f0bc1b
| require(msg.sender == owner, "Unauthorized account"); | ||
| uint256 incentiveBalance = IToken(incentiveTokenAddress).balanceOf(address(this)) - allocatedRewards; | ||
| require(incentiveBalance > 0, "No incentive token balance to withdraw"); | ||
| if (incentiveBalance == 0) revert NoAvailableIncentiveBalance(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary as no need to emit events if 0.
negative case is covered by the language itself which will revert.
No description provided.