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

FERTILIZER_AMOUNT_PRECISION is not used for precision of fertilizer in _getMintFertilizerOut

Summary

The precision constant FERTILIZER_AMOUNT_PRECISION isn't utilized in FertilizerFacet::_getMintFertilizerOut().

Impact

This results in minted fertilizer amounts being significantly lower than expected.

Vulnerability Details

For instance, if FERTILIZER_AMOUNT_PRECISION is not applied in the calculation, a token input of 1 may yield only 0.000001 fertilizer instead of the expected 1.

Tools Used

Manual review

Recommendations

use FERTILIZER_AMOUNT_PRECISION in FertilizerFace::_getMintFertilizerOut()

function _getMintFertilizerOut(
uint256 tokenAmountIn,
address barnRaiseToken
) public view returns (uint256 fertilizerAmountOut) {
fertilizerAmountOut = tokenAmountIn.div(
LibUsdOracle.getUsdPrice(barnRaiseToken)
-- );
++ ).mul(FERTILIZER_AMOUNT_PRECISION);
}
Updates

Lead Judging Commences

giovannidisiena Lead Judge over 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.