The amountCollateral should be more than zero. so that redeemCollateral value will be greater than zero.
Add moreThanZero(amountCollateral) nonReentrant in below function =>
function redeemCollateralForDsc(address tokenCollateralAddress, uint256 amountCollateral, uint256 amountDscToBurn)
external
{
burnDsc(amountDscToBurn);
redeemCollateral(tokenCollateralAddress, amountCollateral);
// redeemCollateral already checks health factor
}
If the moreThanZero(amountCollateral) and nonReentrant modifiers are not added to the redeemCollateralForDsc function, then the function will not check if the amountCollateral argument is greater than zero and will not prevent reentrancy attacks.
This means that it would be possible for a user to call the function with an amountCollateral argument of zero, which could get errors in the function’s execution. Additionally, without the nonReentrant modifier, the function would be vulnerable to reentrancy attacks, where an attacker could potentially call the function again before it has finished executing.
Manual Review
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.