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

`returnIfBelowMin` should be used when `lpTokenSupply < lastLpTokenSupply`

Summary

returnIfBelowMin should be used when lpTokenSupply < lastLpTokenSupply instead of lpTokenSupply > lastLpTokenSupply

Vulnerability Details

The _capLpTokenSupply function expects a boolean value denoted as returnIfBelowMin. When this value is set to true, the function returns an empty array with a length of 0. Within the _capReserves function, a call to _capLpTokenSupply is made with returnIfBelowMin set to true. However, an issue arises regarding the intended usage of returnIfBelowMin. According to its name, it suggests that it should be employed when lpTokenSupply < lastLpTokenSupply. Nevertheless, in practice, returnIfBelowMin is utilized when lpTokenSupply > lastLpTokenSupply, contrary to its apparent purpose. This discrepancy requires attention to ensure the correct interpretation and application of the code.

Impact

cappedReserves calculation will be effected in _capReserves.

Tools Used

Manual review

Recommendations

use returnIfBelowMin when lpTokenSupply < lastLpTokenSupply and lpTokenSupply < minLpTokenSupply

Updates

Lead Judging Commences

giovannidisiena Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Calc LP below min

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

Calc LP below min

Support

FAQs

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