Skip to content

Commit b0be4a0

Browse files
authored
Merge pull request #1731 from lidofinance/fix/vault-partials-forbid-improve
refactor: optimize partial withdrawal check in VaultHub
2 parents ffd6c57 + 02ece02 commit b0be4a0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

contracts/0.8.25/vaults/VaultHub.sol

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,14 +892,15 @@ contract VaultHub is PausableUntilWithRoles {
892892
VaultConnection storage connection = _checkConnectionAndOwner(_vault);
893893
VaultRecord storage record = _vaultRecord(_vault);
894894

895-
uint256 minPartialAmountInGwei = type(uint256).max;
895+
bool hasPartialWithdrawals = false;
896896
for (uint256 i = 0; i < _amountsInGwei.length; i++) {
897-
if (_amountsInGwei[i] > 0 && _amountsInGwei[i] < minPartialAmountInGwei) {
898-
minPartialAmountInGwei = _amountsInGwei[i];
897+
if (_amountsInGwei[i] > 0) {
898+
hasPartialWithdrawals = true;
899+
break;
899900
}
900901
}
901902

902-
if (minPartialAmountInGwei < type(uint256).max) {
903+
if (hasPartialWithdrawals) {
903904
_requireFreshReport(_vault, record);
904905

905906
/// @dev NB: Disallow partial withdrawals when the vault has obligations shortfall in order to prevent the

0 commit comments

Comments
 (0)