gas

Redundant check for transfer success

Reward

Total

24.49 USDC

Selected
24.49 USDC
Selected Submission

Redundant check for transfer success

Severity

Gas Optimization

Summary

Inside the _burnDSC method, DSCEngine contract checks for success of transferFrom call and reverts if it is false:

 bool success = i_dsc.transferFrom(dscFrom, address(this), amountDscToBurn);
// This conditional is hypothtically unreachable
if (!success) {
    revert DSCEngine__TransferFailed();
}

However, if the transferFrom method will not succeed, it will revert. In other case it will always return true. Therefore this check is redundant and can be removed for gas optimization.

Vulnerability Details

n/a

Impact

Unnecessary gas consumption

Tools Used

Manual review

Recommendations

Remove the success check