The calculation deltaBDV = newBDV.sub(ogBDV) assumes that the new BDV is always greater than or equal to the original BDV (ogBDV). However, this assumption may not hold true in all cases. If for some reason the new BDV is less than the original BDV, the subtraction newBDV.sub(ogBDV) will result in a negative value.
See the below code:
The calculation of deltaStalk relies on deltaBDV. If deltaBDV is negative, it would result in unexpected behavior or incorrect calculations for the amount of stalk to mint, potentially leading to incorrect rewards for users.
Manual Review
To mitigate this issue, you should add a check to ensure that the new BDV is greater than or equal to the original BDV before calculating deltaBDV. If the new BDV is less than the original BDV, you should handle this case appropriately, such as reverting with an error message or taking corrective actions.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.