DeFiHardhat
35,000 USDC
View results
Submission Details
Severity: low
Invalid

Underflow error in the `remainingRecapitalization()` function.

Summary

In the remainingRecapitalization() if totalSupply() is zero also the uint256 totalDollars which will lead to underflow of the return value of the function.

Vulnerability Details

See the following code of the remainingRecapitalization():

function remainingRecapitalization()
internal
view
returns (uint256 remaining)
{
AppStorage storage s = LibAppStorage.diamondStorage();
uint256 totalDollars = C
.dollarPerUnripeLP()
.mul(C.unripeLP().totalSupply())
.div(DECIMALS);
totalDollars = totalDollars / 1e6 * 1e6; // round down to nearest USDC
if (s.recapitalized >= totalDollars) return 0;
return totalDollars.sub(s.recapitalized);
}

Impact

In case totalSupply() is zero the remainingRecapitalization() will revert due to underflow error.

Tools Used

Manual review

Recommendations

Add an appropriate check of totalSupply() to ensure that is not zero before returning the value of function remainingRecapitalization()

Updates

Lead Judging Commences

giovannidisiena Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

Informational/Invalid

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.