Skip to content

Commit

Permalink
feat: allow manager to pause the deposit
Browse files Browse the repository at this point in the history
  • Loading branch information
alpanaca committed Jan 19, 2024
1 parent b2f6bb8 commit c6647d2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/AutomatedVaultManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,16 @@ contract AutomatedVaultManager is Initializable, Ownable2StepUpgradeable, Reentr
}
}

function pauseDeposit(address _vaultToken, bool _isPaused) external {
if (!isManager[_vaultToken][msg.sender]) {
revert AutomatedVaultManager_Unauthorized();
}

vaultInfos[_vaultToken].isDepositPaused = _isPaused;

emit LogSetIsDepositPaused(_vaultToken, _isPaused);
}

function setIsWithdrawPaused(address[] calldata _vaultTokens, bool _isPaused) external onlyOwner {
uint256 _len = _vaultTokens.length;
for (uint256 _i; _i < _len;) {
Expand Down
11 changes: 11 additions & 0 deletions test/automated-vault-manager/AutomatedVaultManager_Deposit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ contract AutomatedVaultManagerDepositTest is BaseAutomatedVaultUnitTest {
vaultManager.deposit(address(this), address(_vaultToken), _depositParams, 0);
}

function testRevert_WhenDepositIsEmergencyPausedByManager() public {
address _vaultToken = _openDefaultVault();

vm.prank(MANAGER);
vaultManager.pauseDeposit(_vaultToken, true);

AutomatedVaultManager.TokenAmount[] memory _depositParams = new AutomatedVaultManager.TokenAmount[](0);
vm.expectRevert(abi.encodeWithSignature("AutomatedVaultManager_EmergencyPaused()"));
vaultManager.deposit(address(this), address(_vaultToken), _depositParams, 0);
}

function testRevert_WhenDepositTokenThatIsNotAllowed() public {
address vaultToken = _openDefaultVault();
vm.prank(DEPLOYER);
Expand Down

0 comments on commit c6647d2

Please sign in to comment.