Currently, the protocol login allows everyone to call redeemCollateral
and burnDsc
and because of that in certain conditions, underflow can occur.
If a user who has 0 collateral deposited and respectively dsc minted or wants to redeem more than he has and calls redeemCollateral
or burnDsc
will lead to underflow on these lines:
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/DSCEngine.sol#L285
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/DSCEngine.sol#L273
No impact. It will lead to unexpected reverts in the user interface.
Manual
Add some type of checking at the beginning of the functions to verify the amount which user gives as an argument to redeem collateral or burn dsc should be lower or equal to his amounts in the two mappings which are used.
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.