Skip to content

Commit

Permalink
fix 6
Browse files Browse the repository at this point in the history
  • Loading branch information
vaporkane committed Jun 4, 2023
1 parent b15c00e commit a840dc0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
16 changes: 16 additions & 0 deletions src/AMO2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -657,4 +657,20 @@ contract xETH_AMO is AccessControl {

stETH.safeTransfer(msg.sender, output);
}

/**
* @notice Recover any token from AMO
* @param token Token to recover
* @param to Recipient address
* @param amount Amount to recover
*/
function recoverToken(
address token,
address to,
uint256 amount
) external onlyRole(DEFAULT_ADMIN_ROLE) {
IERC20(token).safeTransfer(to, amount);

emit RecoveredToken(token, to, amount);
}
}
11 changes: 6 additions & 5 deletions src/CVXStaker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ contract CVXStaker is Ownable {
}

/**
* @notice Recover any token from AMO
* @notice Recover any token from cvxStaker
* @param token Token to recover
* @param to Recipient address
* @param amount Amount to recover
Expand Down Expand Up @@ -163,18 +163,19 @@ contract CVXStaker is Ownable {
/**
* @dev Withdraws all staked tokens from the reward pool and unwraps them to the original tokens.
* @param claim A boolean indicating whether to claim rewards before withdrawing.
* @param sendToOperator A boolean indicating whether to send the unwrapped tokens to the operator.
* @param sendToOwner A boolean indicating whether to send the unwrapped tokens to the owner.
* If false, the tokens will remain in the contract.
* Only the contract owner can call this function.
*/
function withdrawAllAndUnwrap(
bool claim,
bool sendToOperator
bool sendToOwner
) external onlyOwner {
IBaseRewardPool(cvxPoolInfo.rewards).withdrawAllAndUnwrap(claim);
if (sendToOperator) {
if (sendToOwner) {
uint256 totalBalance = clpToken.balanceOf(address(this));
clpToken.safeTransfer(operator, totalBalance);
/// @dev msg.sender is the owner, due to onlyOwner modifier
clpToken.safeTransfer(msg.sender, totalBalance);
}
}

Expand Down

0 comments on commit a840dc0

Please sign in to comment.