Skip to content

Commit

Permalink
Added improveMetapoolBalance checks to existing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 committed Sep 1, 2023
1 parent e1d192e commit 4ee8d0e
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions contracts/contracts/strategies/ConvexEthMetaStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
override
onlyVault
nonReentrant
improveMetapoolBalance
{
_deposit(_weth, _amount);
}
Expand Down Expand Up @@ -235,7 +236,13 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
/**
* @notice Deposit the strategy's entire balance of WETH into the Curve Metapool
*/
function depositAll() external override onlyVault nonReentrant {
function depositAll()
external
override
onlyVault
nonReentrant
improveMetapoolBalance
{
uint256 balance = weth.balanceOf(address(this));
if (balance > 0) {
_deposit(address(weth), balance);
Expand All @@ -257,7 +264,7 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
address _recipient,
address _weth,
uint256 _amount
) external override onlyVault nonReentrant {
) external override onlyVault nonReentrant improveMetapoolBalance {
require(_amount > 0, "Invalid amount");
require(_weth == address(weth), "Can only withdraw WETH");

Expand Down Expand Up @@ -324,7 +331,13 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
* @notice Remove all ETH and OETH from the Metapool, burn the OETH,
* convert the ETH to WETH and transfer to the Vault contract.
*/
function withdrawAll() external override onlyVaultOrGovernor nonReentrant {
function withdrawAll()
external
override
onlyVaultOrGovernor
nonReentrant
improveMetapoolBalance
{
uint256 gaugeTokens = cvxRewardStaker.balanceOf(address(this));
_lpWithdraw(gaugeTokens);

Expand Down Expand Up @@ -373,8 +386,8 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
function mintAndAddOTokens(uint256 _oTokens)
external
onlyStrategist
improveMetapoolBalance
nonReentrant
improveMetapoolBalance
{
IVault(vaultAddress).mintForStrategy(_oTokens);

Expand Down Expand Up @@ -417,8 +430,8 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
function removeAndBurnOTokens(uint256 _lpTokens)
external
onlyStrategist
improveMetapoolBalance
nonReentrant
improveMetapoolBalance
{
// Withdraw Metapool LP tokens from Convex and remove OTokens from the Metapool
uint256 oethToBurn = _withdrawAndRemoveFromPool(
Expand Down Expand Up @@ -452,8 +465,8 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
function removeOnlyAssets(uint256 _lpTokens)
external
onlyStrategist
improveMetapoolBalance
nonReentrant
improveMetapoolBalance
{
// Withdraw Metapool LP tokens from Convex and remove ETH from the Metapool
uint256 ethAmount = _withdrawAndRemoveFromPool(_lpTokens, ethCoinIndex);
Expand Down

0 comments on commit 4ee8d0e

Please sign in to comment.