Skip to content

Commit

Permalink
strict stETH withdrawal request validation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bulbozaur committed Nov 7, 2024
1 parent 9fecfff commit 4a37dae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions contracts/Escrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,10 @@ contract Escrow is IEscrow {
uint256 minStETHWithdrawalRequestAmount = WITHDRAWAL_QUEUE.MIN_STETH_WITHDRAWAL_AMOUNT();
uint256 maxStETHWithdrawalRequestAmount = WITHDRAWAL_QUEUE.MAX_STETH_WITHDRAWAL_AMOUNT();

/// @dev This check ensures that even if MIN_STETH_WITHDRAWAL_AMOUNT is set too low,
/// the withdrawal batch request process can still be completed successfully
if (stETHRemaining < Math.max(_MIN_TRANSFERRABLE_ST_ETH_AMOUNT, minStETHWithdrawalRequestAmount)) {
/// @dev The remaining stETH amount must be greater than the minimum threshold to create a withdrawal request.
uint256 remainingStETHThreshold = Math.max(_MIN_TRANSFERRABLE_ST_ETH_AMOUNT, minStETHWithdrawalRequestAmount);

if (stETHRemaining < remainingStETHThreshold) {
return _batchesQueue.close();
}

Expand All @@ -363,7 +364,7 @@ contract Escrow is IEscrow {

stETHRemaining = ST_ETH.balanceOf(address(this));

if (stETHRemaining < minStETHWithdrawalRequestAmount) {
if (stETHRemaining < remainingStETHThreshold) {
_batchesQueue.close();
}
}
Expand Down

0 comments on commit 4a37dae

Please sign in to comment.