Open code423n4 opened 3 years ago
cmichel
Allocaiton.calcProtocolExposureDelta should break out of the loop to save gas after protocolExposedDeltaUsd is set.
Allocaiton.calcProtocolExposureDelta
protocolExposedDeltaUsd
if (protocolExposedDeltaUsd == 0 && protocolExposure[i] > sysState.rebalanceThreshold) { // ...Calculate the delta between exposure and target uint256 target = sysState.rebalanceThreshold.sub(sysState.targetBuffer); protocolExposedDeltaUsd = protocolExposure[i].sub(target).mul(sysState.totalCurrentAssetsUsd).div( PERCENTAGE_DECIMAL_FACTOR ); protocolExposedIndex = i; // @audit break here }
Handle
cmichel
Vulnerability details
Vulnerability Details
Allocaiton.calcProtocolExposureDelta
should break out of the loop to save gas afterprotocolExposedDeltaUsd
is set.