In getUsdValue() function, the input parameter 'amount' can be checked if it is zero, then zero can be returned directly.
In getUsdValue(), if the amount parameter value is zero, it still gets the price from the pricefeed, and does the calculation to anyways return zero.
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L361
Since the getUSDValue() is called inside the loop for each collateral tokens, whose balance might not be non-zero most times, unnecessary calls to price feed and the following calculation are made for each iteration.
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L356
Manual Review
The amount parameter in getUsdValue()fucntion can be checked if its zero, then zero value can be returned
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.