Skip to content

Commit

Permalink
fix: vault manager withdraw
Browse files Browse the repository at this point in the history
  • Loading branch information
ricklista committed Nov 12, 2024
1 parent c41aacd commit 15b0fd4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions contracts/psm/VaultManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ contract VaultManager is ReentrancyGuardUpgradeable, AccessControlUpgradeable, U
}

function _distribute(uint256 amount) private {
require(adapters.length > 0, "no adapter");
uint256 remain = amount;
uint256 totalPoint = getTotalPoint();

Expand Down Expand Up @@ -119,7 +118,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));
Expand All @@ -135,6 +133,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;

Expand Down

0 comments on commit 15b0fd4

Please sign in to comment.