From e409cebbad737a556976ad40a4bf50aa45d1207b Mon Sep 17 00:00:00 2001 From: rick Date: Tue, 12 Nov 2024 17:40:00 +0800 Subject: [PATCH] fix: vault manager withdraw --- contracts/psm/VaultManager.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/psm/VaultManager.sol b/contracts/psm/VaultManager.sol index d43c6e1..8ec2178 100644 --- a/contracts/psm/VaultManager.sol +++ b/contracts/psm/VaultManager.sol @@ -119,7 +119,6 @@ contract VaultManager is ReentrancyGuardUpgradeable, AccessControlUpgradeable, U */ function withdraw(address receiver, uint256 amount) external nonReentrant onlyPSMOrManager { require(amount > 0, "withdraw amount cannot be zero"); - require(adapters.length > 0, "no adapter"); uint256 remain = amount; uint256 vaultBalance = IERC20(token).balanceOf(address(this)); @@ -135,6 +134,7 @@ contract VaultManager is ReentrancyGuardUpgradeable, AccessControlUpgradeable, U } if (remain > 0) { + require(adapters.length > 0, "no adapter"); // withdraw token from adapters uint256 startIdx = block.number % adapters.length;