You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a new local variable uint128 _liquidatorMaxPer = oleTokenDistribution.liquidatorMaxPer; and uint _extraBalance = oleTokenDistribution.extraBalance;.
The if block at L141-144 can also be rewritten to:
Handle
tqts
Vulnerability details
Impact
Gas optimization
Proof of Concept
https://github.com/code-423n4/2022-01-openleverage/blob/501e8f5c7ebaf1242572712626a77a3d65bdd3ad/openleverage-contracts/contracts/ControllerV1.sol#L115-L145
In
ControllerV1.LiquidateAllowed(), the state variablesoleTokenDistribution.liquidatorMaxPerandoleTokenDistribution.extraBalanceare used several times, and could be optimized.Tools Used
Manual review
Recommended Mitigation Steps
Create a new local variable
uint128 _liquidatorMaxPer = oleTokenDistribution.liquidatorMaxPer;anduint _extraBalance = oleTokenDistribution.extraBalance;.The
ifblock at L141-144 can also be rewritten to: