Skip to content

Commit

Permalink
Add pause logic to ManagerWithMerkleVerification, so that strategist …
Browse files Browse the repository at this point in the history
…calls can be paused immediately by a multisig
  • Loading branch information
crispymangoes committed Apr 3, 2024
1 parent 546ff96 commit 61d9a48
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/base/Roles/ManagerWithMerkleVerification.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ contract ManagerWithMerkleVerification is Auth {
*/
bytes32 internal flashLoanIntentHash = bytes32(0);

/**
* @notice Used to pause calls to `manageVaultWithMerkleVerification`.
*/
bool public isPaused;

//============================== ERRORS ===============================

error ManagerWithMerkleVerification__InvalidManageProofLength();
Expand All @@ -51,11 +56,14 @@ contract ManagerWithMerkleVerification is Auth {
error ManagerWithMerkleVerification__FlashLoanNotInProgress();
error ManagerWithMerkleVerification__BadFlashLoanIntentHash();
error ManagerWithMerkleVerification__FailedToVerifyManageProof();
error ManagerWithMerkleVerification__Paused();

//============================== EVENTS ===============================

event ManageRootUpdated(address strategist, bytes32 oldRoot, bytes32 newRoot);
event BoringVaultManaged(uint256 callsMade);
event Paused();
event Unpaused();

//============================== IMMUTABLES ===============================

Expand Down Expand Up @@ -85,6 +93,22 @@ contract ManagerWithMerkleVerification is Auth {
emit ManageRootUpdated(strategist, oldRoot, _manageRoot);
}

/**
* @notice Pause this contract, which prevents future calls to `manageVaultWithMerkleVerification`.
*/
function pause() external requiresAuth {
isPaused = true;
emit Paused();
}

/**
* @notice Unpause this contract, which allows future calls to `manageVaultWithMerkleVerification`.
*/
function unpause() external requiresAuth {
isPaused = false;
emit Unpaused();
}

// ========================================= STRATEGIST FUNCTIONS =========================================

/**
Expand All @@ -98,6 +122,7 @@ contract ManagerWithMerkleVerification is Auth {
bytes[] calldata targetData,
uint256[] calldata values
) external requiresAuth {
if (isPaused) revert ManagerWithMerkleVerification__Paused();
uint256 targetsLength = targets.length;
if (targetsLength != manageProofs.length) revert ManagerWithMerkleVerification__InvalidManageProofLength();
if (targetsLength != targetData.length) revert ManagerWithMerkleVerification__InvalidTargetDataLength();
Expand Down

0 comments on commit 61d9a48

Please sign in to comment.