From 446e5405eb60c2b3aa48c4b57603d246e790a5cd Mon Sep 17 00:00:00 2001 From: BkChoy Date: Tue, 12 Nov 2024 02:44:35 -0500 Subject: [PATCH] call checkUpkeep in L2Transmitter::executeQueuedWithdrawals --- contracts/core/interfaces/IWithdrawalPool.sol | 2 ++ contracts/metisStaking/L2Transmitter.sol | 3 +++ 2 files changed, 5 insertions(+) diff --git a/contracts/core/interfaces/IWithdrawalPool.sol b/contracts/core/interfaces/IWithdrawalPool.sol index c0fca65f..2e88b3b5 100644 --- a/contracts/core/interfaces/IWithdrawalPool.sol +++ b/contracts/core/interfaces/IWithdrawalPool.sol @@ -11,4 +11,6 @@ interface IWithdrawalPool { function queueWithdrawal(address _account, uint256 _amount) external; function performUpkeep(bytes calldata _performData) external; + + function checkUpkeep(bytes calldata) external view returns (bool, bytes memory); } diff --git a/contracts/metisStaking/L2Transmitter.sol b/contracts/metisStaking/L2Transmitter.sol index 70a29a2b..b925a01a 100644 --- a/contracts/metisStaking/L2Transmitter.sol +++ b/contracts/metisStaking/L2Transmitter.sol @@ -138,6 +138,9 @@ contract L2Transmitter is UUPSUpgradeable, OwnableUpgradeable, CCIPReceiverUpgra * @notice Executes withdrawals queued in the Withdrawal Pool **/ function executeQueuedWithdrawals() public { + (bool upkeepNeeded, ) = withdrawalPool.checkUpkeep(""); + if (!upkeepNeeded) return; + uint256 queuedTokens = l2Strategy.getTotalQueuedTokens(); uint256 queuedWithdrawals = withdrawalPool.getTotalQueuedWithdrawals(); uint256 toWithdraw = MathUpgradeable.min(queuedTokens, queuedWithdrawals);