Only use amount
when needed can save gas
#279
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2021-12-yetifinance/blob/5f5bf61209b722ba568623d8446111b1ea5cb61c/packages/contracts/contracts/TroveManagerLiquidations.sol#L839-L847
Since
amount
is only needed inif (whitelist.isWrapped(token)) {...}
, souint amount = _colls.amounts[i];
should be moved to insideif (whitelist.isWrapped(token)) {...}
.Furthermore, considering that
amount
is only used once, it can be replaced with_colls.amounts[i]
.Recommendation
Change to:
The text was updated successfully, but these errors were encountered: