Can return from the getUsdValue()
method if amount is 0
If the amount passed is 0, then the USD value will be 0. There is no point in calling the oracle and performing bunch of operations just to multiply the final answer with 0.
Link to code - https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L361
Code Review using VSCode
Add amount == 0
check and return early.
Code change:
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.