Skip to content

Commit

Permalink
call checkUpkeep in L2Transmitter::executeQueuedWithdrawals
Browse files Browse the repository at this point in the history
  • Loading branch information
BkChoy committed Nov 28, 2024
1 parent 980e9ed commit 446e540
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/core/interfaces/IWithdrawalPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
3 changes: 3 additions & 0 deletions contracts/metisStaking/L2Transmitter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 446e540

Please sign in to comment.