do-while does not check the first condition and prevents the assembly from executing lots of opcodes needed for conditions checks and all these places are right for it because these all always execute the code inside loops on the first condition.
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L118
Deployment Cost
Calculation Type | Before | After | Gas Saved |
---|---|---|---|
Avg | 1004332 | 1004274 | 58 |
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L353-L357
Calculation Type | Before | After | Gas Saved |
---|---|---|---|
Avg | 42356 | 42211 | 145 |
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.