From 21f51b89b0ea0e4f8bc6547cf68fbe968562f5e7 Mon Sep 17 00:00:00 2001 From: Aleksandr Tarelkin Date: Mon, 11 Nov 2024 12:00:04 +0300 Subject: [PATCH] fix: var naming and comment --- contracts/Escrow.sol | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/contracts/Escrow.sol b/contracts/Escrow.sol index ce2a5de7..f4ea64f9 100644 --- a/contracts/Escrow.sol +++ b/contracts/Escrow.sol @@ -348,9 +348,12 @@ contract Escrow is IEscrow { uint256 maxStETHWithdrawalRequestAmount = WITHDRAWAL_QUEUE.MAX_STETH_WITHDRAWAL_AMOUNT(); /// @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); + /// Using only `minStETHWithdrawalRequestAmount` is insufficient because it is an external variable + /// that could be decreased independently. Introducing `minWithdrawableStETHAmount` provides + /// an internal safeguard, enforcing a minimum threshold within the contract. + uint256 minWithdrawableStETHAmount = Math.max(_MIN_TRANSFERRABLE_ST_ETH_AMOUNT, minStETHWithdrawalRequestAmount); - if (stETHRemaining < remainingStETHThreshold) { + if (stETHRemaining < minWithdrawableStETHAmount) { return _batchesQueue.close(); } @@ -364,7 +367,7 @@ contract Escrow is IEscrow { stETHRemaining = ST_ETH.balanceOf(address(this)); - if (stETHRemaining < remainingStETHThreshold) { + if (stETHRemaining < minWithdrawableStETHAmount) { _batchesQueue.close(); } }