Gas optimization: Reduce storage write #97
Labels
bug
Something isn't working
G (Gas Optimization)
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
gzeon
Vulnerability details
Proof of Concept
https://github.com/code-423n4/2021-11-yaxis/blob/146febcb61ae7fe20b0920849c4f4bbe111c6ba7/contracts/v3/alchemix/Alchemist.sol#L630
The line can be rewritten as
_remainingAmount = _remainingAmount.add(_borrowFeeAmount);
to reduce a storage write. Alternatively use a memory variable to preserve code readability.
The text was updated successfully, but these errors were encountered: