diff --git a/contracts/contracts/interfaces/aerodrome/ISugarHelper.sol b/contracts/contracts/interfaces/aerodrome/ISugarHelper.sol index f0191ee297..eb2c00e548 100644 --- a/contracts/contracts/interfaces/aerodrome/ISugarHelper.sol +++ b/contracts/contracts/interfaces/aerodrome/ISugarHelper.sol @@ -29,7 +29,7 @@ interface ISugarHelper { uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96 - ) external pure returns (uint256 liquidity); + ) external pure returns (uint128 liquidity); /// @notice Computes the amount of token0 for a given amount of token1 and price range /// @param amount1 Amount of token1 to estimate liquidity diff --git a/contracts/contracts/strategies/aerodrome/AerodromeAMOStrategy.sol b/contracts/contracts/strategies/aerodrome/AerodromeAMOStrategy.sol index 8799a3cd01..b2459777ca 100644 --- a/contracts/contracts/strategies/aerodrome/AerodromeAMOStrategy.sol +++ b/contracts/contracts/strategies/aerodrome/AerodromeAMOStrategy.sol @@ -351,7 +351,7 @@ contract AerodromeAMOStrategy is InitializableAbstractStrategy { */ function depositAll() external override onlyVault nonReentrant { uint256 _wethBalance = IERC20(WETH).balanceOf(address(this)); - if (_wethBalance > 0) { + if (_wethBalance > 1e12) { _deposit(WETH, _wethBalance); } } @@ -431,9 +431,6 @@ contract AerodromeAMOStrategy is InitializableAbstractStrategy { */ if (tokenId != 0 && _swapWeth && _amountToSwap > 0) { _ensureWETHBalance(_amountToSwap); - - // burn remaining OETHb -- TODO: - _burnOethbOnTheContract(); } // in some cases we will just want to add liquidity and not issue a swap to move the @@ -536,6 +533,8 @@ contract AerodromeAMOStrategy is InitializableAbstractStrategy { _amountOethbCollected, underlyingAssets ); + + _burnOethbOnTheContract(); } /** @@ -550,7 +549,7 @@ contract AerodromeAMOStrategy is InitializableAbstractStrategy { uint256 _balance = _tokenToSwap.balanceOf(address(this)); if (_balance < _amountToSwap) { - // This should never trigger since _removeLiquidityToEnsureSwap will already + // This should never trigger since _ensureWETHBalance will already // throw an error if there is not enough WETH if (_swapWeth) { revert NotEnoughWethForSwap(_balance, _amountToSwap); @@ -605,7 +604,8 @@ contract AerodromeAMOStrategy is InitializableAbstractStrategy { function _addLiquidity() internal gaugeUnstakeAndRestake { uint256 _wethBalance = IERC20(WETH).balanceOf(address(this)); uint256 _oethbBalance = IERC20(OETHb).balanceOf(address(this)); - if (_wethBalance == 0) { + // don't deposit small liquidity amounts + if (_wethBalance <= 1e12) { return; } @@ -867,8 +867,6 @@ contract AerodromeAMOStrategy is InitializableAbstractStrategy { _ensureWETHBalance(_amount); - // burn remaining OETHb - _burnOethbOnTheContract(); _withdraw(_recipient, _amount); } @@ -884,8 +882,6 @@ contract AerodromeAMOStrategy is InitializableAbstractStrategy { if (_balance > 0) { _withdraw(vaultAddress, _balance); } - // burn remaining OETHb - _burnOethbOnTheContract(); } function _withdraw(address _recipient, uint256 _amount) internal { diff --git a/contracts/test/strategies/aerodrome-amo.base.fork-test.js b/contracts/test/strategies/aerodrome-amo.base.fork-test.js index d3c9936392..cdb4298fd3 100644 --- a/contracts/test/strategies/aerodrome-amo.base.fork-test.js +++ b/contracts/test/strategies/aerodrome-amo.base.fork-test.js @@ -682,7 +682,7 @@ describe("ForkTest: Aerodrome AMO Strategy (Base)", async function () { oethUnits("0") ); - await assetLpNOTStakedInGauge(); + await verifyEndConditions(false); }); it("Should withdraw when there's little OETHb in the pool", async () => { @@ -774,13 +774,15 @@ describe("ForkTest: Aerodrome AMO Strategy (Base)", async function () { oethUnits("0") ); - await assetLpNOTStakedInGauge(); + await verifyEndConditions(false); }); }); describe("Deposit and rebalance", function () { it("Should be able to deposit to the strategy", async () => { await mintAndDepositToStrategy(); + + await verifyEndConditions(); }); it("Should revert when not depositing WETH or amount is 0", async () => { @@ -1219,8 +1221,12 @@ describe("ForkTest: Aerodrome AMO Strategy (Base)", async function () { * - nft LP token should remain staked * - there should be no substantial amount of WETH / OETHb left on the strategy contract */ - const verifyEndConditions = async () => { - await assetLpStakedInGauge(); + const verifyEndConditions = async (lpStaked = true) => { + if (lpStaked) { + await assetLpStakedInGauge(); + } else { + await assetLpNOTStakedInGauge(); + } await expect(await weth.balanceOf(aerodromeAmoStrategy.address)).to.lte( oethUnits("0.00001")