If the DecentralizedStableCoin is deployed in the constructor of DSCEngine then it will ensure that it becomes the Owner of DecentralizedStableCoin otherwise if manual owner transfer is not done by the deployer on DecentralizedStableCoin then it can stop all the mint and burn functionality of the DSCEngine contract. As only owner can mint or burn.
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L112
Use i_dsc = new DecentralizedStableCoin(); in the constructor of DSCEngine contract.
The function _burnDsc() doesn’t check the amountDscToBurn before subtracting it from s_DSCMinted mapping of user. Which can easily cause underflow errors.
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L273
Similarly, The function _redeemCollateral() doesn’t check amountCollateral before subtracting it from s_collateralDeposited mapping.
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L285C1-L285C1
Add a check if amountDscToBurn <= s_DSCMinted[onBehalfOf] before subtracting.
Add a check if amountCollateral <= s_collateralDeposited[from][tokenCollateralAddress] before subtracting.
There is not check for zero address on the input param dscAddress of the constructor. If address(0) is sent, it can make the whole protocol unusable after deployment.
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L112-L123
Add a check of dscAddress not equal to address(0).
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.