File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -182,10 +182,12 @@ contract DSCEngine is ReentrancyGuard {
182182 _revertIfHealthFactorIsBroken (msg .sender );
183183 }
184184
185- //q I think here is an error of underflow
186185 function burnDSC (uint256 amount ) public moreThanZero (amount) {
186+ uint256 startingUserHealthFactor = _healthFactor (msg .sender );
187187 _burnDSC (msg .sender , msg .sender , amount);
188- _revertIfHealthFactorIsBroken (msg .sender );
188+ uint256 endingUserHealthFactor = _healthFactor (msg .sender );
189+ if (endingUserHealthFactor <= startingUserHealthFactor) revert DSCEngine__HealthFactorIsNotImproved (); // being extra safe
190+ // _revertIfHealthFactorIsBroken(msg.sender); // this does not allow liquidatable account to partially burn some DSC
189191 }
190192
191193 // $100 ETH backing $50 DSC
You can’t perform that action at this time.
0 commit comments