From e6923c3c771122591749300e27015a0d887597a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Feb 2026 13:52:51 +0100 Subject: [PATCH 1/9] Replace deprecated mint(address,uint256,uint256) with mint(uint256) in IVault Update the IVault interface to use the new single-param mint signature and fix all contract callers: MockNonRebasing, MockRebornMinter, AbstractOTokenZapper, OSonicZapper, and PlumeBridgeHelperModule. --- .../automation/PlumeBridgeHelperModule.sol | 10 +++----- contracts/contracts/interfaces/IVault.sol | 23 +------------------ contracts/contracts/mocks/MockNonRebasing.sol | 2 +- .../contracts/mocks/MockRebornMinter.sol | 7 ++---- .../contracts/zapper/AbstractOTokenZapper.sol | 2 +- contracts/contracts/zapper/OSonicZapper.sol | 2 +- 6 files changed, 9 insertions(+), 37 deletions(-) diff --git a/contracts/contracts/automation/PlumeBridgeHelperModule.sol b/contracts/contracts/automation/PlumeBridgeHelperModule.sol index 2c2da15ba5..0d8c181c5e 100644 --- a/contracts/contracts/automation/PlumeBridgeHelperModule.sol +++ b/contracts/contracts/automation/PlumeBridgeHelperModule.sol @@ -163,11 +163,12 @@ contract PlumeBridgeHelperModule is } // Redeem for WETH using Vault + // redeem(uint256,uint256) was removed from VaultCore; use hardcoded selector success = safeContract.execTransactionFromModule( address(vault), 0, // Value abi.encodeWithSelector( - vault.redeem.selector, + bytes4(keccak256("redeem(uint256,uint256)")), oethpAmount, oethpAmount ), @@ -231,12 +232,7 @@ contract PlumeBridgeHelperModule is success = safeContract.execTransactionFromModule( address(vault), 0, // Value - abi.encodeWithSelector( - vault.mint.selector, - address(weth), - wethAmount, - wethAmount - ), + abi.encodeWithSelector(vault.mint.selector, wethAmount), 0 // Call ); require(success, "Failed to mint OETHp"); diff --git a/contracts/contracts/interfaces/IVault.sol b/contracts/contracts/interfaces/IVault.sol index c517cf82b0..55fae1009f 100644 --- a/contracts/contracts/interfaces/IVault.sol +++ b/contracts/contracts/interfaces/IVault.sol @@ -117,16 +117,10 @@ interface IVault { ) external; // VaultCore.sol - function mint( - address _asset, - uint256 _amount, - uint256 _minimumOusdAmount - ) external; + function mint(uint256 _amount) external; function mintForStrategy(uint256 _amount) external; - function redeem(uint256 _amount, uint256 _minimumUnitAmount) external; - function burnForStrategy(uint256 _amount) external; function allocate() external; @@ -137,17 +131,6 @@ interface IVault { function checkBalance(address _asset) external view returns (uint256); - /// @notice Deprecated: use calculateRedeemOutput - function calculateRedeemOutputs(uint256 _amount) - external - view - returns (uint256[] memory); - - function calculateRedeemOutput(uint256 _amount) - external - view - returns (uint256); - function getAssetCount() external view returns (uint256); function getAllAssets() external view returns (address[] memory); @@ -159,8 +142,6 @@ interface IVault { /// @notice Deprecated. function isSupportedAsset(address _asset) external view returns (bool); - function dripper() external view returns (address); - function asset() external view returns (address); function initialize(address) external; @@ -216,7 +197,5 @@ interface IVault { function previewYield() external view returns (uint256 yield); - function weth() external view returns (address); - // slither-disable-end constable-states } diff --git a/contracts/contracts/mocks/MockNonRebasing.sol b/contracts/contracts/mocks/MockNonRebasing.sol index b3ad870347..405dea3b3e 100644 --- a/contracts/contracts/mocks/MockNonRebasing.sol +++ b/contracts/contracts/mocks/MockNonRebasing.sol @@ -43,7 +43,7 @@ contract MockNonRebasing { address _asset, uint256 _amount ) public { - IVault(_vaultContract).mint(_asset, _amount, 0); + IVault(_vaultContract).mint(_amount); } function redeemOusd(address _vaultContract, uint256 _amount) public { diff --git a/contracts/contracts/mocks/MockRebornMinter.sol b/contracts/contracts/mocks/MockRebornMinter.sol index aa7394b7d1..51d2297a70 100644 --- a/contracts/contracts/mocks/MockRebornMinter.sol +++ b/contracts/contracts/mocks/MockRebornMinter.sol @@ -98,15 +98,12 @@ contract Reborner { address asset = sanctum.asset(); address vault = sanctum.vault(); IERC20(asset).approve(vault, 1e6); - IVault(vault).mint(asset, 1e6, 0); + IVault(vault).mint(1e6); log("We are now minting.."); } function redeem() public { - log("We are attempting to redeem.."); - address vault = sanctum.vault(); - IVault(vault).redeem(1e18, 1e18); - log("We are now redeeming.."); + revert("Redeem no longer supported"); } function transfer() public { diff --git a/contracts/contracts/zapper/AbstractOTokenZapper.sol b/contracts/contracts/zapper/AbstractOTokenZapper.sol index 06445d1442..e095fa1b69 100644 --- a/contracts/contracts/zapper/AbstractOTokenZapper.sol +++ b/contracts/contracts/zapper/AbstractOTokenZapper.sol @@ -123,7 +123,7 @@ abstract contract AbstractOTokenZapper { returns (uint256) { uint256 toMint = weth.balanceOf(address(this)); - vault.mint(address(weth), toMint, minOToken); + vault.mint(toMint); uint256 mintedAmount = oToken.balanceOf(address(this)); require(mintedAmount >= minOToken, "Zapper: not enough minted"); diff --git a/contracts/contracts/zapper/OSonicZapper.sol b/contracts/contracts/zapper/OSonicZapper.sol index cd08f45bb8..8465e751da 100644 --- a/contracts/contracts/zapper/OSonicZapper.sol +++ b/contracts/contracts/zapper/OSonicZapper.sol @@ -125,7 +125,7 @@ contract OSonicZapper { returns (uint256) { uint256 toMint = wS.balanceOf(address(this)); - vault.mint(address(wS), toMint, minOS); + vault.mint(toMint); uint256 mintedAmount = OS.balanceOf(address(this)); require(mintedAmount >= minOS, "Zapper: not enough minted"); From 8c85bdcbb3e903d357fd738af9332e1d60dccaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Feb 2026 13:52:58 +0100 Subject: [PATCH 2/9] Rewrite EthereumBridgeHelperModule with async withdrawal and remove Plume Remove all Plume/LayerZero bridging code and replace synchronous vault redeem with async withdrawal pattern (requestWithdrawal + claimWithdrawal). Add unwrapAndRequestWithdrawal, claimAndBridgeToBase, and claimWithdrawal. --- .../automation/EthereumBridgeHelperModule.sol | 189 ++++++------------ 1 file changed, 64 insertions(+), 125 deletions(-) diff --git a/contracts/contracts/automation/EthereumBridgeHelperModule.sol b/contracts/contracts/automation/EthereumBridgeHelperModule.sol index 547eff1c63..515b1dfc1a 100644 --- a/contracts/contracts/automation/EthereumBridgeHelperModule.sol +++ b/contracts/contracts/automation/EthereumBridgeHelperModule.sol @@ -1,13 +1,11 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; -import { AbstractLZBridgeHelperModule, AbstractSafeModule } from "./AbstractLZBridgeHelperModule.sol"; -import { AbstractCCIPBridgeHelperModule, IRouterClient } from "./AbstractCCIPBridgeHelperModule.sol"; +// solhint-disable-next-line max-line-length +import { AbstractCCIPBridgeHelperModule, AbstractSafeModule, IRouterClient } from "./AbstractCCIPBridgeHelperModule.sol"; import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; -import { IOFT } from "@layerzerolabs/oft-evm/contracts/interfaces/IOFT.sol"; - import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC4626 } from "../../lib/openzeppelin/interfaces/IERC4626.sol"; import { IWETH9 } from "../interfaces/IWETH9.sol"; @@ -15,7 +13,6 @@ import { IVault } from "../interfaces/IVault.sol"; contract EthereumBridgeHelperModule is AccessControlEnumerable, - AbstractLZBridgeHelperModule, AbstractCCIPBridgeHelperModule { IVault public constant vault = @@ -27,12 +24,6 @@ contract EthereumBridgeHelperModule is IERC4626 public constant woeth = IERC4626(0xDcEe70654261AF21C44c093C300eD3Bb97b78192); - uint32 public constant LZ_PLUME_ENDPOINT_ID = 30370; - IOFT public constant LZ_WOETH_OMNICHAIN_ADAPTER = - IOFT(0x7d1bEa5807e6af125826d56ff477745BB89972b8); - IOFT public constant LZ_ETH_OMNICHAIN_ADAPTER = - IOFT(0x77b2043768d28E9C9aB44E1aBfC95944bcE57931); - IRouterClient public constant CCIP_ROUTER = IRouterClient(0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D); @@ -40,26 +31,6 @@ contract EthereumBridgeHelperModule is constructor(address _safeContract) AbstractSafeModule(_safeContract) {} - /** - * @dev Bridges wOETH to Plume. - * @param woethAmount Amount of wOETH to bridge. - * @param slippageBps Slippage in 10^4 basis points. - */ - function bridgeWOETHToPlume(uint256 woethAmount, uint256 slippageBps) - public - payable - onlyOperator - { - _bridgeTokenWithLz( - LZ_PLUME_ENDPOINT_ID, - woeth, - LZ_WOETH_OMNICHAIN_ADAPTER, - woethAmount, - slippageBps, - false - ); - } - /** * @dev Bridges wOETH to Base using CCIP. * @param woethAmount Amount of wOETH to bridge. @@ -77,34 +48,6 @@ contract EthereumBridgeHelperModule is ); } - /** - * @dev Bridges wETH to Plume. - * @param wethAmount Amount of wETH to bridge. - * @param slippageBps Slippage in 10^4 basis points. - */ - function bridgeWETHToPlume(uint256 wethAmount, uint256 slippageBps) - public - payable - onlyOperator - { - // Unwrap into ETH - safeContract.execTransactionFromModule( - address(weth), - 0, // Value - abi.encodeWithSelector(weth.withdraw.selector, wethAmount), - 0 // Call - ); - - _bridgeTokenWithLz( - LZ_PLUME_ENDPOINT_ID, - IERC20(address(weth)), - LZ_ETH_OMNICHAIN_ADAPTER, - wethAmount, - slippageBps, - true - ); - } - /** * @dev Bridges wETH to Base using CCIP. * @param wethAmount Amount of wETH to bridge. @@ -169,12 +112,7 @@ contract EthereumBridgeHelperModule is success = safeContract.execTransactionFromModule( address(vault), 0, // Value - abi.encodeWithSelector( - vault.mint.selector, - address(weth), - wethAmount, - wethAmount - ), + abi.encodeWithSelector(vault.mint.selector, wethAmount), 0 // Call ); require(success, "Failed to mint OETH"); @@ -211,25 +149,6 @@ contract EthereumBridgeHelperModule is return woeth.balanceOf(address(safeContract)) - woethAmount; } - /** - * @dev Mints OETH and wraps it into wOETH, then bridges it to Plume. - * @param wethAmount Amount of WETH to mint. - * @param slippageBps Bridge slippage in 10^4 basis points. - * @param useNativeToken Whether to use native token to mint. - */ - function mintWrapAndBridgeToPlume( - uint256 wethAmount, - uint256 slippageBps, - bool useNativeToken - ) external payable onlyOperator { - if (useNativeToken) { - wrapETH(wethAmount); - } - - uint256 woethAmount = _mintAndWrap(wethAmount); - bridgeWOETHToPlume(woethAmount, slippageBps); - } - /** * @dev Mints OETH and wraps it into wOETH, then bridges it to Base using CCIP. * @param wethAmount Amount of WETH to mint. @@ -249,25 +168,60 @@ contract EthereumBridgeHelperModule is } /** - * @dev Unwraps wOETH and redeems it to get WETH. + * @dev Unwraps wOETH and requests an async withdrawal from the Vault. * @param woethAmount Amount of wOETH to unwrap. - * @return Amount of WETH received. + * @return requestId The withdrawal request ID. + * @return oethAmount Amount of OETH queued for withdrawal. */ - function unwrapAndRedeem(uint256 woethAmount) + function unwrapAndRequestWithdrawal(uint256 woethAmount) external onlyOperator - returns (uint256) + returns (uint256 requestId, uint256 oethAmount) + { + return _unwrapAndRequestWithdrawal(woethAmount); + } + + /** + * @dev Claims a previously requested withdrawal and bridges WETH to Base. + * @param requestId The withdrawal request ID to claim. + */ + function claimAndBridgeToBase(uint256 requestId) + external + payable + onlyOperator + { + uint256 wethAmount = _claimWithdrawal(requestId); + bridgeWETHToBase(wethAmount); + } + + /** + * @dev Claims a previously requested withdrawal. + * @param requestId The withdrawal request ID to claim. + * @return wethAmount Amount of WETH received. + */ + function claimWithdrawal(uint256 requestId) + external + onlyOperator + returns (uint256 wethAmount) { - return _unwrapAndRedeem(woethAmount); + return _claimWithdrawal(requestId); } /** - * @dev Unwraps wOETH and redeems it to get WETH. + * @dev Unwraps wOETH and requests an async withdrawal from the Vault. * @param woethAmount Amount of wOETH to unwrap. - * @return Amount of WETH received. + * @return requestId The withdrawal request ID. + * @return oethAmount Amount of OETH queued for withdrawal. */ - function _unwrapAndRedeem(uint256 woethAmount) internal returns (uint256) { - uint256 oethAmount = oeth.balanceOf(address(safeContract)); + function _unwrapAndRequestWithdrawal(uint256 woethAmount) + internal + returns (uint256 requestId, uint256 oethAmount) + { + // Read the next withdrawal index before requesting + // (safe because requestWithdrawal is nonReentrant) + requestId = vault.withdrawalQueueMetadata().nextWithdrawalIndex; + + oethAmount = oeth.balanceOf(address(safeContract)); // Unwrap wOETH bool success = safeContract.execTransactionFromModule( @@ -285,53 +239,38 @@ contract EthereumBridgeHelperModule is oethAmount = oeth.balanceOf(address(safeContract)) - oethAmount; - // Redeem OETH using Vault to get WETH + // Request async withdrawal from Vault success = safeContract.execTransactionFromModule( address(vault), 0, // Value abi.encodeWithSelector( - vault.redeem.selector, - oethAmount, + vault.requestWithdrawal.selector, oethAmount ), 0 // Call ); - require(success, "Failed to redeem OETH"); - - return oethAmount; + require(success, "Failed to request withdrawal"); } /** - * @dev Unwraps wOETH and redeems it to get WETH, then bridges it to Plume. - * @param woethAmount Amount of wOETH to unwrap. - * @param slippageBps Bridge slippage in 10^4 basis points. + * @dev Claims a previously requested withdrawal from the Vault. + * @param requestId The withdrawal request ID to claim. + * @return wethAmount Amount of WETH received. */ - function unwrapRedeemAndBridgeToPlume( - uint256 woethAmount, - uint256 slippageBps - ) external payable onlyOperator { - uint256 wethAmount = _unwrapAndRedeem(woethAmount); - // Unwrap into ETH - safeContract.execTransactionFromModule( - address(weth), + function _claimWithdrawal(uint256 requestId) + internal + returns (uint256 wethAmount) + { + wethAmount = weth.balanceOf(address(safeContract)); + + bool success = safeContract.execTransactionFromModule( + address(vault), 0, // Value - abi.encodeWithSelector(weth.withdraw.selector, wethAmount), + abi.encodeWithSelector(vault.claimWithdrawal.selector, requestId), 0 // Call ); + require(success, "Failed to claim withdrawal"); - bridgeWETHToPlume(wethAmount, slippageBps); - } - - /** - * @dev Unwraps wOETH and redeems it to get WETH, then bridges it to Base using CCIP. - * @param woethAmount Amount of wOETH to unwrap. - */ - function unwrapRedeemAndBridgeToBase(uint256 woethAmount) - external - payable - onlyOperator - { - uint256 wethAmount = _unwrapAndRedeem(woethAmount); - bridgeWETHToBase(wethAmount); + wethAmount = weth.balanceOf(address(safeContract)) - wethAmount; } } From 2198af5353df3e929510ca1f70bac9cc343e8e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Feb 2026 13:53:04 +0100 Subject: [PATCH 3/9] Update BaseBridgeHelperModule to use async withdrawal Replace synchronous vault redeem with async withdrawal pattern. Remove depositWOETHAndBridgeWETH (no longer single-TX). Add depositWOETHAndRequestWithdrawal, claimWithdrawal, and claimAndBridgeWETH. --- .../automation/BaseBridgeHelperModule.sol | 108 +++++++++++++----- 1 file changed, 78 insertions(+), 30 deletions(-) diff --git a/contracts/contracts/automation/BaseBridgeHelperModule.sol b/contracts/contracts/automation/BaseBridgeHelperModule.sol index d2a505f67b..e46801423c 100644 --- a/contracts/contracts/automation/BaseBridgeHelperModule.sol +++ b/contracts/contracts/automation/BaseBridgeHelperModule.sol @@ -73,41 +73,66 @@ contract BaseBridgeHelperModule is /** * @dev Deposits wOETH into the bridgedWOETH strategy. * @param woethAmount Amount of wOETH to deposit. - * @param redeemWithVault Whether to redeem the wOETH for WETH using the Vault. - * @return Amount of WETH received. + * @return oethbAmount Amount of OETHb received. */ - function depositWOETH(uint256 woethAmount, bool redeemWithVault) + function depositWOETH(uint256 woethAmount) external onlyOperator returns (uint256) { - return _depositWOETH(woethAmount, redeemWithVault); + return _depositWOETH(woethAmount); } /** - * @dev Deposits wOETH into the bridgedWOETH strategy and bridges it to Ethereum. + * @dev Deposits wOETH into the bridgedWOETH strategy and requests an + * async withdrawal of the resulting OETHb from the Vault. * @param woethAmount Amount of wOETH to deposit. - * @return Amount of WETH received. + * @return requestId The withdrawal request ID. + * @return oethbAmount Amount of OETHb queued for withdrawal. */ - function depositWOETHAndBridgeWETH(uint256 woethAmount) + function depositWOETHAndRequestWithdrawal(uint256 woethAmount) external onlyOperator - returns (uint256) + returns (uint256 requestId, uint256 oethbAmount) + { + oethbAmount = _depositWOETH(woethAmount); + requestId = _requestWithdrawal(oethbAmount); + } + + /** + * @dev Claims a previously requested withdrawal and bridges WETH to Ethereum. + * @param requestId The withdrawal request ID to claim. + */ + function claimAndBridgeWETH(uint256 requestId) + external + payable + onlyOperator { - uint256 wethAmount = _depositWOETH(woethAmount, true); + uint256 wethAmount = _claimWithdrawal(requestId); bridgeWETHToEthereum(wethAmount); - return wethAmount; + } + + /** + * @dev Claims a previously requested withdrawal. + * @param requestId The withdrawal request ID to claim. + * @return wethAmount Amount of WETH received. + */ + function claimWithdrawal(uint256 requestId) + external + onlyOperator + returns (uint256 wethAmount) + { + return _claimWithdrawal(requestId); } /** * @dev Deposits wOETH into the bridgedWOETH strategy. * @param woethAmount Amount of wOETH to deposit. - * @param redeemWithVault Whether to redeem the wOETH for WETH using the Vault. - * @return Amount of WETH received. + * @return oethbAmount Amount of OETHb received. */ - function _depositWOETH(uint256 woethAmount, bool redeemWithVault) + function _depositWOETH(uint256 woethAmount) internal - returns (uint256) + returns (uint256 oethbAmount) { // Update oracle price bridgedWOETHStrategy.updateWOETHOraclePrice(); @@ -115,7 +140,7 @@ contract BaseBridgeHelperModule is // Rebase to account for any yields from price update vault.rebase(); - uint256 oethbAmount = oethb.balanceOf(address(safeContract)); + oethbAmount = oethb.balanceOf(address(safeContract)); // Approve bridgedWOETH strategy to move wOETH bool success = safeContract.execTransactionFromModule( @@ -146,25 +171,53 @@ contract BaseBridgeHelperModule is // Rebase to account for any yields from price update // and backing asset change from deposit vault.rebase(); + } - if (!redeemWithVault) { - return oethbAmount; - } + /** + * @dev Requests an async withdrawal from the Vault. + * @param oethbAmount Amount of OETHb to withdraw. + * @return requestId The withdrawal request ID. + */ + function _requestWithdrawal(uint256 oethbAmount) + internal + returns (uint256 requestId) + { + // Read the next withdrawal index before requesting + // (safe because requestWithdrawal is nonReentrant) + requestId = vault.withdrawalQueueMetadata().nextWithdrawalIndex; - // Redeem for WETH using Vault - success = safeContract.execTransactionFromModule( + bool success = safeContract.execTransactionFromModule( address(vault), 0, // Value abi.encodeWithSelector( - vault.redeem.selector, - oethbAmount, + vault.requestWithdrawal.selector, oethbAmount ), 0 // Call ); - require(success, "Failed to redeem OETHb"); + require(success, "Failed to request withdrawal"); + } + + /** + * @dev Claims a previously requested withdrawal from the Vault. + * @param requestId The withdrawal request ID to claim. + * @return wethAmount Amount of WETH received. + */ + function _claimWithdrawal(uint256 requestId) + internal + returns (uint256 wethAmount) + { + wethAmount = weth.balanceOf(address(safeContract)); - return oethbAmount; + bool success = safeContract.execTransactionFromModule( + address(vault), + 0, // Value + abi.encodeWithSelector(vault.claimWithdrawal.selector, requestId), + 0 // Call + ); + require(success, "Failed to claim withdrawal"); + + wethAmount = weth.balanceOf(address(safeContract)) - wethAmount; } /** @@ -213,12 +266,7 @@ contract BaseBridgeHelperModule is success = safeContract.execTransactionFromModule( address(vault), 0, // Value - abi.encodeWithSelector( - vault.mint.selector, - address(weth), - wethAmount, - wethAmount - ), + abi.encodeWithSelector(vault.mint.selector, wethAmount), 0 // Call ); require(success, "Failed to mint OETHb"); From ef862bb27b7329d8cac2b15f620026403b55aeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Feb 2026 13:53:16 +0100 Subject: [PATCH 4/9] Update tests for new mint(uint256) signature and async withdrawal Replace all vault.mint(asset, amount, minAmount) calls with vault.mint(amount) across test files. Update bridge helper tests to match new async withdrawal API. Remove unused variable declarations. --- contracts/test/_fixture-sonic.js | 4 +- contracts/test/_fixture.js | 8 +- .../merkl-pool-booster.sonic.fork-test.js | 6 +- ...metropolis-pool-booster.sonic.fork-test.js | 6 +- .../poolBooster.sonic.fork-test.js | 6 +- .../shadow-pool-booster.sonic.fork-test.js | 6 +- .../bridge-helper.base.fork-test.js | 6 +- .../bridge-helper.mainnet.fork-test.js | 112 +----------- .../bridge-helper.plume.fork-test.js | 6 +- .../base/aerodrome-amo.base.fork-test.js | 24 +-- .../base/curve-amo.base.fork-test.js | 10 +- .../crosschain/cross-chain-strategy.js | 2 +- .../curve-amo-oeth.mainnet.fork-test.js | 12 +- .../curve-amo-ousd.mainnet.fork-test.js | 10 +- .../sonic/swapx-amo.sonic.fork-test.js | 6 +- .../test/token/oeth.mainnet.fork-test.js | 4 +- contracts/test/token/woeth.js | 2 +- .../test/token/woeth.mainnet.fork-test.js | 6 +- contracts/test/vault/deposit.js | 5 +- contracts/test/vault/index.js | 20 +-- contracts/test/vault/oeth-vault.js | 170 +++++++----------- .../vault/oeth-vault.mainnet.fork-test.js | 17 +- .../test/vault/oethb-vault.base.fork-test.js | 6 +- .../test/vault/oethp-vault.plume.fork-test.js | 6 +- contracts/test/vault/os-vault.sonic.js | 11 +- contracts/test/vault/rebase.js | 2 +- contracts/test/vault/redeem.js | 50 +++--- .../test/vault/vault.mainnet.fork-test.js | 8 +- contracts/test/vault/vault.sonic.fork-test.js | 20 +-- 29 files changed, 168 insertions(+), 383 deletions(-) diff --git a/contracts/test/_fixture-sonic.js b/contracts/test/_fixture-sonic.js index 0d320dc748..41ff1b2364 100644 --- a/contracts/test/_fixture-sonic.js +++ b/contracts/test/_fixture-sonic.js @@ -282,7 +282,7 @@ async function swapXAMOFixture( // Mint OS with wS // This will sit in the vault, not the strategy - await oSonicVault.connect(nick).mint(wS.address, mintAmount, 0); + await oSonicVault.connect(nick).mint(mintAmount); } // Add ETH to the Metapool @@ -324,7 +324,7 @@ async function swapXAMOFixture( const osAmount = parseUnits(config.poolAddOSAmount.toString(), 18); // Mint OS with wS - await oSonicVault.connect(rafael).mint(wS.address, osAmount, 0); + await oSonicVault.connect(rafael).mint(osAmount); // transfer OS to the pool await oSonic.connect(rafael).transfer(swapXPool.address, osAmount); diff --git a/contracts/test/_fixture.js b/contracts/test/_fixture.js index accaf235e8..df32daa0fb 100644 --- a/contracts/test/_fixture.js +++ b/contracts/test/_fixture.js @@ -248,7 +248,7 @@ const createAccountTypes = async ({ vault, ousd, ousdUnlocked, deploy }) => { await fundAccounts(); const usdc = await ethers.getContract("MockUSDC"); await usdc.connect(matt).approve(vault.address, usdcUnits("1000")); - await vault.connect(matt).mint(usdc.address, usdcUnits("1000"), 0); + await vault.connect(matt).mint(usdcUnits("1000")); } const createAccount = async () => { @@ -722,9 +722,7 @@ const defaultFixture = deployments.createFixture(async () => { await usdc .connect(user) .approve(vaultAndTokenContracts.vault.address, usdcUnits("100")); - await vaultAndTokenContracts.vault - .connect(user) - .mint(usdc.address, usdcUnits("100"), 0); + await vaultAndTokenContracts.vault.connect(user).mint(usdcUnits("100")); // Fund WETH contract await hardhatSetBalance(user.address, "50000"); @@ -978,7 +976,7 @@ async function morphoOUSDv2Fixture( // Mint OUSD with USDC // This will sit in the vault, not the strategy - await vault.connect(josh).mint(usdc.address, usdcMintAmount, 0); + await vault.connect(josh).mint(usdcMintAmount); // Add USDC to the strategy if (config?.depositToStrategy) { diff --git a/contracts/test/poolBooster/merkl-pool-booster.sonic.fork-test.js b/contracts/test/poolBooster/merkl-pool-booster.sonic.fork-test.js index 9ba5ada3ce..4fbe18923e 100644 --- a/contracts/test/poolBooster/merkl-pool-booster.sonic.fork-test.js +++ b/contracts/test/poolBooster/merkl-pool-booster.sonic.fork-test.js @@ -15,7 +15,6 @@ describe("ForkTest: Merkl Pool Booster", function () { let fixture, poolBoosterMerklFactory, nick, - wS, oSonicVault, oSonic, strategist, @@ -23,7 +22,6 @@ describe("ForkTest: Merkl Pool Booster", function () { beforeEach(async () => { fixture = await sonicFixture(); nick = fixture.nick; - wS = fixture.wS; oSonicVault = fixture.oSonicVault; oSonic = fixture.oSonic; poolBoosterMerklFactory = fixture.poolBoosterMerklFactory; @@ -33,9 +31,7 @@ describe("ForkTest: Merkl Pool Booster", function () { await ensureTokenIsApproved(oSonic); // mint some OS to Nick - await oSonicVault - .connect(nick) - .mint(wS.address, oethUnits("10000"), oethUnits("0")); + await oSonicVault.connect(nick).mint(oethUnits("10000")); }); it("Should have correct deployment params", async () => { diff --git a/contracts/test/poolBooster/metropolis-pool-booster.sonic.fork-test.js b/contracts/test/poolBooster/metropolis-pool-booster.sonic.fork-test.js index a8635e9417..b8b2a38957 100644 --- a/contracts/test/poolBooster/metropolis-pool-booster.sonic.fork-test.js +++ b/contracts/test/poolBooster/metropolis-pool-booster.sonic.fork-test.js @@ -11,23 +11,19 @@ describe("ForkTest: Metropolis Pool Booster", function () { let fixture, poolBoosterFactoryMetropolis, nick, - wS, oSonicVault, oSonic, strategist; beforeEach(async () => { fixture = await sonicFixture(); nick = fixture.nick; - wS = fixture.wS; oSonicVault = fixture.oSonicVault; oSonic = fixture.oSonic; poolBoosterFactoryMetropolis = fixture.poolBoosterFactoryMetropolis; strategist = await impersonateAndFund(addresses.multichainStrategist); // mint some OS to Nick - await oSonicVault - .connect(nick) - .mint(wS.address, oethUnits("1000000"), oethUnits("0")); + await oSonicVault.connect(nick).mint(oethUnits("1000000")); }); it("Should deploy a Pool Booster for a Metropolis pool", async () => { diff --git a/contracts/test/poolBooster/poolBooster.sonic.fork-test.js b/contracts/test/poolBooster/poolBooster.sonic.fork-test.js index c10119e858..0b1c1a3b4d 100644 --- a/contracts/test/poolBooster/poolBooster.sonic.fork-test.js +++ b/contracts/test/poolBooster/poolBooster.sonic.fork-test.js @@ -17,11 +17,9 @@ describe("ForkTest: Pool Booster", function () { let fixture, strategist; beforeEach(async () => { fixture = await sonicFixture(); - const { wS, oSonicVault, nick } = fixture; + const { oSonicVault, nick } = fixture; // mint some OS - await oSonicVault - .connect(nick) - .mint(wS.address, oethUnits("1000"), oethUnits("0")); + await oSonicVault.connect(nick).mint(oethUnits("1000")); strategist = await impersonateAndFund(addresses.multichainStrategist); }); diff --git a/contracts/test/poolBooster/shadow-pool-booster.sonic.fork-test.js b/contracts/test/poolBooster/shadow-pool-booster.sonic.fork-test.js index fbce7d8961..e810d77da9 100644 --- a/contracts/test/poolBooster/shadow-pool-booster.sonic.fork-test.js +++ b/contracts/test/poolBooster/shadow-pool-booster.sonic.fork-test.js @@ -16,11 +16,9 @@ describe("ForkTest: Shadow Pool Booster (for S/WETH pool)", function () { let fixture; beforeEach(async () => { fixture = await sonicFixture(); - const { wS, oSonicVault, nick } = fixture; + const { oSonicVault, nick } = fixture; // mint some OS - await oSonicVault - .connect(nick) - .mint(wS.address, oethUnits("1000"), oethUnits("0")); + await oSonicVault.connect(nick).mint(oethUnits("1000")); }); it("Should create a pool booster for Shadow and bribe", async () => { diff --git a/contracts/test/safe-modules/bridge-helper.base.fork-test.js b/contracts/test/safe-modules/bridge-helper.base.fork-test.js index dd13824c32..6d591724da 100644 --- a/contracts/test/safe-modules/bridge-helper.base.fork-test.js +++ b/contracts/test/safe-modules/bridge-helper.base.fork-test.js @@ -58,7 +58,7 @@ describe("ForkTest: Bridge Helper Safe Module (Base)", function () { // Make sure Vault has some WETH _mintWETH(nick, "10000"); await weth.connect(nick).approve(oethbVault.address, oethUnits("10000")); - await oethbVault.connect(nick).mint(weth.address, oethUnits("10000"), "0"); + await oethbVault.connect(nick).mint(oethUnits("10000")); // Update oracle price await woethStrategy.updateWOETHOraclePrice(); @@ -82,9 +82,7 @@ describe("ForkTest: Bridge Helper Safe Module (Base)", function () { ); // Deposit 1 wOETH for OETHb and redeem it for WETH - await bridgeHelperModule - .connect(safeSigner) - .depositWOETH(oethUnits("1"), true); + await bridgeHelperModule.connect(safeSigner).depositWOETH(oethUnits("1")); const supplyAfter = await oethb.totalSupply(); const wethBalanceAfter = await weth.balanceOf(safeSigner.address); diff --git a/contracts/test/safe-modules/bridge-helper.mainnet.fork-test.js b/contracts/test/safe-modules/bridge-helper.mainnet.fork-test.js index e66bc9a134..7f47e4a7aa 100644 --- a/contracts/test/safe-modules/bridge-helper.mainnet.fork-test.js +++ b/contracts/test/safe-modules/bridge-helper.mainnet.fork-test.js @@ -4,8 +4,6 @@ const { } = require("../_fixture"); const { oethUnits } = require("../helpers"); const { expect } = require("chai"); -const addresses = require("../../utils/addresses"); -//const { impersonateAndFund } = require("../../utils/signers"); const mainnetFixture = createFixtureLoader(bridgeHelperModuleFixture); @@ -21,7 +19,7 @@ describe("ForkTest: Bridge Helper Safe Module (Ethereum)", function () { const _mintOETH = async (amount, user) => { await weth.connect(user).approve(oethVault.address, amount); - await oethVault.connect(user).mint(weth.address, amount, amount); + await oethVault.connect(user).mint(amount); }; const _mintWOETH = async (amount, user, receiver) => { @@ -32,78 +30,6 @@ describe("ForkTest: Bridge Helper Safe Module (Ethereum)", function () { await woeth.connect(user).mint(amount, receiver); }; - it("Should bridge wOETH to Plume", async () => { - const { woeth, josh, safeSigner, bridgeHelperModule } = fixture; - - // Mint 1 wOETH - await _mintWOETH(oethUnits("1"), josh, safeSigner.address); - - const balanceBefore = await woeth.balanceOf(safeSigner.address); - - // Bridge 1 wOETH to Ethereum - const tx = await bridgeHelperModule.connect(safeSigner).bridgeWOETHToPlume( - oethUnits("1"), - 50 // 0.5% slippage - ); - - // Check balance - const balanceAfter = await woeth.balanceOf(safeSigner.address); - expect(balanceAfter).to.eq(balanceBefore.sub(oethUnits("1"))); - - // Check events - const { events } = await tx.wait(); - - const lzBridgeEvent = events.find( - (e) => - e.address.toLowerCase() === - addresses.mainnet.WOETHOmnichainAdapter.toLowerCase() - ); - - expect(lzBridgeEvent.topics[2]).to.eq( - "0x0000000000000000000000004ff1b9d9ba8558f5eafcec096318ea0d8b541971" - ); - const [endpointId, amountSentLD, minAmountLD] = - ethers.utils.defaultAbiCoder.decode( - ["uint256", "uint256", "uint256"], - lzBridgeEvent.data - ); - expect(endpointId).to.eq("30370"); - expect(amountSentLD).to.eq(oethUnits("1")); - expect(minAmountLD).to.eq(oethUnits("1")); - }); - - it("Should bridge WETH to Plume", async () => { - const { weth, josh, safeSigner, bridgeHelperModule } = fixture; - - await weth.connect(josh).transfer(safeSigner.address, oethUnits("1.1")); - - // Bridge 1 WETH to Plume - const tx = await bridgeHelperModule.connect(safeSigner).bridgeWETHToPlume( - oethUnits("1"), - 100 // 1% slippage - ); - - const { events } = await tx.wait(); - - const lzBridgeEvent = events.find( - (e) => - e.address.toLowerCase() === - addresses.mainnet.ETHOmnichainAdapter.toLowerCase() - ); - - expect(lzBridgeEvent.topics[2]).to.eq( - "0x0000000000000000000000004ff1b9d9ba8558f5eafcec096318ea0d8b541971" - ); - const [endpointId, amountSentLD, minAmountLD] = - ethers.utils.defaultAbiCoder.decode( - ["uint256", "uint256", "uint256"], - lzBridgeEvent.data - ); - expect(endpointId).to.eq("30370"); - expect(amountSentLD).to.eq(oethUnits("1")); - expect(minAmountLD).to.gt(oethUnits("0.99")); - }); - it("Should bridge wOETH to Base", async () => { const { woeth, josh, safeSigner, bridgeHelperModule } = fixture; @@ -177,40 +103,4 @@ describe("ForkTest: Bridge Helper Safe Module (Ethereum)", function () { woethSupplyBefore.add(woethAmount) ); }); - - // Redeem has been deprecated for now, so skipping this test - /* - it("Should unwrap WOETH and redeem it to WETH", async () => { - const { woeth, weth, josh, safeSigner, bridgeHelperModule, oethVault } = - fixture; - - await oethVault.connect(josh).rebase(); - - // Do a huge yield deposit to fund the Vault - await impersonateAndFund(josh.address, "10000"); - await weth.connect(josh).deposit({ value: oethUnits("9500") }); - await weth.connect(josh).approve(oethVault.address, oethUnits("9500")); - await oethVault.connect(josh).mint(weth.address, oethUnits("9000"), "0"); - - const woethAmount = oethUnits("1"); - - // Make sure Safe has some wOETH - await _mintWOETH(woethAmount, josh, safeSigner.address); - - const wethExpected = await woeth.previewRedeem(woethAmount); - - const wethBalanceBefore = await weth.balanceOf(safeSigner.address); - const woethBalanceBefore = await woeth.balanceOf(safeSigner.address); - - await bridgeHelperModule.connect(safeSigner).unwrapAndRedeem(woethAmount); - - const wethBalanceAfter = await weth.balanceOf(safeSigner.address); - const woethBalanceAfter = await woeth.balanceOf(safeSigner.address); - - expect(wethBalanceAfter).to.approxEqualTolerance( - wethBalanceBefore.add(wethExpected) - ); - expect(woethBalanceAfter).to.eq(woethBalanceBefore.sub(woethAmount)); - }); - */ }); diff --git a/contracts/test/safe-modules/bridge-helper.plume.fork-test.js b/contracts/test/safe-modules/bridge-helper.plume.fork-test.js index 41f5c35fd0..b75d386189 100644 --- a/contracts/test/safe-modules/bridge-helper.plume.fork-test.js +++ b/contracts/test/safe-modules/bridge-helper.plume.fork-test.js @@ -106,7 +106,7 @@ describe("ForkTest: Bridge Helper Safe Module (Plume)", function () { // Make sure Vault has some WETH _mintWETH(governor, oethUnits("1")); await weth.connect(governor).approve(oethpVault.address, oethUnits("1")); - await oethpVault.connect(governor).mint(weth.address, oethUnits("1"), "0"); + await oethpVault.connect(governor).mint(oethUnits("1")); // Update oracle price await woethStrategy.updateWOETHOraclePrice(); @@ -181,9 +181,7 @@ describe("ForkTest: Bridge Helper Safe Module (Plume)", function () { await oethpVault.rebase(); await woethStrategy.updateWOETHOraclePrice(); - await oethpVault - .connect(governor) - .mint(weth.address, oethUnits("1.1"), "0"); + await oethpVault.connect(governor).mint(oethUnits("1.1")); const woethAmount = oethUnits("1"); const expectedWETH = await woethStrategy.getBridgedWOETHValue(woethAmount); diff --git a/contracts/test/strategies/base/aerodrome-amo.base.fork-test.js b/contracts/test/strategies/base/aerodrome-amo.base.fork-test.js index a78a97bcde..23c072c46c 100644 --- a/contracts/test/strategies/base/aerodrome-amo.base.fork-test.js +++ b/contracts/test/strategies/base/aerodrome-amo.base.fork-test.js @@ -75,9 +75,7 @@ describe("Base Fork Test: Aerodrome AMO Strategy empty pool setup (Base)", async .timestamp; await weth.connect(rafael).approve(oethbVault.address, oethUnits("200")); - await oethbVault - .connect(rafael) - .mint(weth.address, oethUnits("200"), oethUnits("199.999")); + await oethbVault.connect(rafael).mint(oethUnits("200")); // we need to supply liquidity in 2 separate transactions so liquidity position is populated // outside the active tick. @@ -115,7 +113,7 @@ describe("Base Fork Test: Aerodrome AMO Strategy empty pool setup (Base)", async // Haven't found a way to test for this in the strategy contract yet it.skip("Revert when there is no token id yet and no liquidity to perform the swap.", async () => { const amount = oethUnits("5"); - await oethbVault.connect(rafael).mint(weth.address, amount, amount); + await oethbVault.connect(rafael).mint(amount); await oethbVault .connect(governor) @@ -221,7 +219,7 @@ describe("Base Fork Test: Aerodrome AMO Strategy empty pool setup (Base)", async const balanceOETHb = await oethb.balanceOf(rafael.address); if (!swapWeth && balanceOETHb.lt(amount)) { await weth.connect(rafael).approve(oethbVault.address, amount); - await oethbVault.connect(rafael).mint(weth.address, amount, amount); + await oethbVault.connect(rafael).mint(amount); } const sqrtRatioX96Tick1000 = BigNumber.from( @@ -315,9 +313,7 @@ describe("ForkTest: Aerodrome AMO Strategy (Base)", async function () { .timestamp; await weth.connect(rafael).approve(oethbVault.address, oethUnits("200")); - await oethbVault - .connect(rafael) - .mint(weth.address, oethUnits("200"), oethUnits("199.999")); + await oethbVault.connect(rafael).mint(oethUnits("200")); // we need to supply liquidity in 2 separate transactions so liquidity position is populated // outside the active tick. @@ -832,7 +828,7 @@ describe("ForkTest: Aerodrome AMO Strategy (Base)", async function () { const amount = oethUnits("5"); weth.connect(rafael).approve(oethbVault.address, amount); - await oethbVault.connect(rafael).mint(weth.address, amount, amount); + await oethbVault.connect(rafael).mint(amount); const gov = await aerodromeAmoStrategy.governor(); await oethbVault @@ -1337,7 +1333,7 @@ describe("ForkTest: Aerodrome AMO Strategy (Base)", async function () { const balanceOETHb = await oethb.balanceOf(rafael.address); if (!swapWeth && balanceOETHb.lt(amount)) { await weth.connect(rafael).approve(oethbVault.address, amount); - await oethbVault.connect(rafael).mint(weth.address, amount, amount); + await oethbVault.connect(rafael).mint(amount); // Deal WETH and mint OETHb } @@ -1411,9 +1407,7 @@ describe("ForkTest: Aerodrome AMO Strategy (Base)", async function () { await setERC20TokenBalance(user.address, weth, amount + balance, hre); } await weth.connect(user).approve(oethbVault.address, amount); - const tx = await oethbVault - .connect(user) - .mint(weth.address, amount, amount); + const tx = await oethbVault.connect(user).mint(amount); return tx; }; @@ -1430,7 +1424,7 @@ describe("ForkTest: Aerodrome AMO Strategy (Base)", async function () { const _amount = oethUnits("5000"); await setERC20TokenBalance(nick.address, weth, _amount, hre); await weth.connect(nick).approve(oethbVault.address, _amount); - await oethbVault.connect(nick).mint(weth.address, _amount, _amount); + await oethbVault.connect(nick).mint(_amount); } const balance = await weth.balanceOf(user.address); @@ -1438,7 +1432,7 @@ describe("ForkTest: Aerodrome AMO Strategy (Base)", async function () { await setERC20TokenBalance(user.address, weth, amount + balance, hre); } await weth.connect(user).approve(oethbVault.address, amount); - await oethbVault.connect(user).mint(weth.address, amount, amount); + await oethbVault.connect(user).mint(amount); const gov = await oethbVault.governor(); const tx = await oethbVault diff --git a/contracts/test/strategies/base/curve-amo.base.fork-test.js b/contracts/test/strategies/base/curve-amo.base.fork-test.js index 799d4cd040..edd065f38c 100644 --- a/contracts/test/strategies/base/curve-amo.base.fork-test.js +++ b/contracts/test/strategies/base/curve-amo.base.fork-test.js @@ -777,7 +777,7 @@ describe("Base Fork Test: Curve AMO strategy", function () { await setERC20TokenBalance(user.address, weth, amount.add(balance), hre); } await weth.connect(user).approve(oethbVault.address, amount); - await oethbVault.connect(user).mint(weth.address, amount, amount); + await oethbVault.connect(user).mint(amount); const gov = await oethbVault.governor(); log(`Depositing ${formatUnits(amount)} WETH to AMO strategy`); @@ -811,9 +811,7 @@ describe("Base Fork Test: Curve AMO strategy", function () { await weth .connect(nick) .approve(oethbVault.address, amount.mul(101).div(10)); - await oethbVault - .connect(nick) - .mint(weth.address, amount.mul(101).div(10), amount); + await oethbVault.connect(nick).mint(amount.mul(101).div(10)); await oethb.connect(nick).approve(curvePool.address, amount); // prettier-ignore await curvePool @@ -881,9 +879,7 @@ describe("Base Fork Test: Curve AMO strategy", function () { ); } await weth.connect(nick).approve(oethbVault.address, oethbAmount); - await oethbVault - .connect(nick) - .mint(weth.address, oethbAmount, oethbAmount); + await oethbVault.connect(nick).mint(oethbAmount); await oethb.connect(nick).approve(curvePool.address, oethbAmount); log( `Adding ${formatUnits( diff --git a/contracts/test/strategies/crosschain/cross-chain-strategy.js b/contracts/test/strategies/crosschain/cross-chain-strategy.js index 6815d238b2..bef6fdd50e 100644 --- a/contracts/test/strategies/crosschain/cross-chain-strategy.js +++ b/contracts/test/strategies/crosschain/cross-chain-strategy.js @@ -39,7 +39,7 @@ describe("ForkTest: CrossChainRemoteStrategy", function () { const mint = async (amount) => { await usdc.connect(josh).approve(vault.address, await units(amount, usdc)); - await vault.connect(josh).mint(usdc.address, await units(amount, usdc), 0); + await vault.connect(josh).mint(await units(amount, usdc)); }; const depositToMasterStrategy = async (amount) => { diff --git a/contracts/test/strategies/curve-amo-oeth.mainnet.fork-test.js b/contracts/test/strategies/curve-amo-oeth.mainnet.fork-test.js index bbcf6340b1..09b428b5de 100644 --- a/contracts/test/strategies/curve-amo-oeth.mainnet.fork-test.js +++ b/contracts/test/strategies/curve-amo-oeth.mainnet.fork-test.js @@ -90,7 +90,7 @@ describe("Curve AMO OETH strategy", function () { await setERC20TokenBalance(nick.address, weth, ousdUnits("5000000"), hre); await weth.connect(nick).approve(oethVault.address, ousdUnits("0")); await weth.connect(nick).approve(oethVault.address, ousdUnits("5000000")); - await oethVault.connect(nick).mint(weth.address, ousdUnits("2000000"), 0); + await oethVault.connect(nick).mint(ousdUnits("2000000")); await oeth .connect(nick) .approve(curvePool.address, ousdUnits("1000000000")); @@ -989,7 +989,7 @@ describe("Curve AMO OETH strategy", function () { await weth.connect(user).approve(oethVault.address, 0); await weth.connect(user).approve(oethVault.address, amount); - await oethVault.connect(user).mint(weth.address, amount, amount); + await oethVault.connect(user).mint(amount); const gov = await oethVault.governor(); const tx = await oethVault @@ -1023,9 +1023,7 @@ describe("Curve AMO OETH strategy", function () { await weth .connect(nick) .approve(oethVault.address, amount.mul(101).div(10)); - await oethVault - .connect(nick) - .mint(weth.address, amount.mul(101).div(10), amount); + await oethVault.connect(nick).mint(amount.mul(101).div(10)); await oeth.connect(nick).approve(curvePool.address, amount); // prettier-ignore await curvePool @@ -1088,9 +1086,7 @@ describe("Curve AMO OETH strategy", function () { } await weth.connect(nick).approve(oethVault.address, 0); await weth.connect(nick).approve(oethVault.address, ousdAmount.mul(2)); - await oethVault - .connect(nick) - .mint(weth.address, ousdAmount.mul(101).div(100), 0); + await oethVault.connect(nick).mint(ousdAmount.mul(101).div(100)); await oeth.connect(nick).approve(curvePool.address, ousdAmount); // prettier-ignore await curvePool diff --git a/contracts/test/strategies/curve-amo-ousd.mainnet.fork-test.js b/contracts/test/strategies/curve-amo-ousd.mainnet.fork-test.js index 0b4accf29f..4e326ab235 100644 --- a/contracts/test/strategies/curve-amo-ousd.mainnet.fork-test.js +++ b/contracts/test/strategies/curve-amo-ousd.mainnet.fork-test.js @@ -90,7 +90,7 @@ describe("Fork Test: Curve AMO OUSD strategy", function () { await setERC20TokenBalance(nick.address, usdc, "5000000", hre); await usdc.connect(nick).approve(ousdVault.address, usdcUnits("0")); await usdc.connect(nick).approve(ousdVault.address, usdcUnits("5000000")); - await ousdVault.connect(nick).mint(usdc.address, usdcUnits("2000000"), 0); + await ousdVault.connect(nick).mint(usdcUnits("2000000")); await ousd.connect(nick).approve(curvePool.address, ousdUnits("2000000")); await usdc.connect(nick).approve(curvePool.address, usdcUnits("2000000")); // prettier-ignore @@ -993,7 +993,7 @@ describe("Fork Test: Curve AMO OUSD strategy", function () { await usdc.connect(user).approve(ousdVault.address, 0); await usdc.connect(user).approve(ousdVault.address, amount); - await ousdVault.connect(user).mint(usdc.address, amount, amount); + await ousdVault.connect(user).mint(amount); const gov = await ousdVault.governor(); const tx = await ousdVault @@ -1027,9 +1027,7 @@ describe("Fork Test: Curve AMO OUSD strategy", function () { await usdc .connect(nick) .approve(ousdVault.address, amount.mul(101).div(10)); - await ousdVault - .connect(nick) - .mint(usdc.address, amount.mul(101).div(10), amount); + await ousdVault.connect(nick).mint(amount.mul(101).div(10)); await ousd.connect(nick).approve(curvePool.address, amount); // prettier-ignore await curvePool @@ -1094,7 +1092,7 @@ describe("Fork Test: Curve AMO OUSD strategy", function () { await usdc.connect(nick).approve(ousdVault.address, ousdAmount.mul(2)); await ousdVault .connect(nick) - .mint(usdc.address, ousdAmount.mul(101).div(100).div(1e12), 0); + .mint(ousdAmount.mul(101).div(100).div(1e12)); await ousd.connect(nick).approve(curvePool.address, ousdAmount); // prettier-ignore await curvePool diff --git a/contracts/test/strategies/sonic/swapx-amo.sonic.fork-test.js b/contracts/test/strategies/sonic/swapx-amo.sonic.fork-test.js index 0945b59fe2..5f4acaed0e 100644 --- a/contracts/test/strategies/sonic/swapx-amo.sonic.fork-test.js +++ b/contracts/test/strategies/sonic/swapx-amo.sonic.fork-test.js @@ -482,7 +482,7 @@ describe("Sonic ForkTest: SwapX AMO Strategy", function () { const osAmountIn = parseUnits("10000000"); // Mint OS using wS - await oSonicVault.connect(clement).mint(wS.address, osAmountIn, 0); + await oSonicVault.connect(clement).mint(osAmountIn); attackerBalanceBefore.os = await oSonic.balanceOf(clement.address); attackerBalanceBefore.ws = await wS.balanceOf(clement.address); @@ -830,7 +830,7 @@ describe("Sonic ForkTest: SwapX AMO Strategy", function () { // transfer wS to the pool await wS.connect(clement).transfer(swapXPool.address, bigAmount); // Mint OS with wS - await oSonicVault.connect(clement).mint(wS.address, bigAmount.mul(5), 0); + await oSonicVault.connect(clement).mint(bigAmount.mul(5)); // transfer OS to the pool await oSonic.connect(clement).transfer(swapXPool.address, bigAmount); // mint pool LP tokens @@ -1247,7 +1247,7 @@ describe("Sonic ForkTest: SwapX AMO Strategy", function () { wS, } = fixture; - await oSonicVault.connect(clement).mint(wS.address, wsDepositAmount, 0); + await oSonicVault.connect(clement).mint(wsDepositAmount); const dataBefore = await snapData(); await logSnapData(dataBefore, "\nBefore depositing wS to strategy"); diff --git a/contracts/test/token/oeth.mainnet.fork-test.js b/contracts/test/token/oeth.mainnet.fork-test.js index c83e066995..2c47da62e1 100644 --- a/contracts/test/token/oeth.mainnet.fork-test.js +++ b/contracts/test/token/oeth.mainnet.fork-test.js @@ -64,9 +64,7 @@ describe("ForkTest: OETH", function () { // Mint some OETH to the eip7702 user await weth.connect(eip770User).deposit({ value: ethUnits("13") }); await weth.connect(eip770User).approve(oethVault.address, ethUnits("3")); - await oethVault - .connect(eip770User) - .mint(weth.address, ethUnits("3"), ethUnits("0")); + await oethVault.connect(eip770User).mint(ethUnits("3")); // EIP7702 keep 1 OETH and transfer 1 OETH to a smart contract (USDC in this case) // and transfer 1 OETH to a wallet (josh in this case) diff --git a/contracts/test/token/woeth.js b/contracts/test/token/woeth.js index b4447d8726..5bc3730842 100644 --- a/contracts/test/token/woeth.js +++ b/contracts/test/token/woeth.js @@ -27,7 +27,7 @@ describe("WOETH", function () { // mint some OETH for (const user of [matt, josh]) { - await oethVault.connect(user).mint(weth.address, oethUnits("100"), 0); + await oethVault.connect(user).mint(oethUnits("100")); } // Josh wraps 50 OETH to WOETH diff --git a/contracts/test/token/woeth.mainnet.fork-test.js b/contracts/test/token/woeth.mainnet.fork-test.js index 6fe28f8248..b256f74fb3 100644 --- a/contracts/test/token/woeth.mainnet.fork-test.js +++ b/contracts/test/token/woeth.mainnet.fork-test.js @@ -8,12 +8,10 @@ const { oethUnits } = require("../helpers"); const oethWhaleFixture = async () => { const fixture = await simpleOETHFixture(); - const { weth, oeth, oethVault, woeth, domen } = fixture; + const { oeth, oethVault, woeth, domen } = fixture; // Domen is a OETH whale - await oethVault - .connect(domen) - .mint(weth.address, oethUnits("20000"), oethUnits("19999")); + await oethVault.connect(domen).mint(oethUnits("20000")); await oeth.connect(domen).approve(woeth.address, oethUnits("20000")); diff --git a/contracts/test/vault/deposit.js b/contracts/test/vault/deposit.js index e76c29f63b..2225336819 100644 --- a/contracts/test/vault/deposit.js +++ b/contracts/test/vault/deposit.js @@ -44,8 +44,7 @@ describe("Vault deposit pausing", function () { await vault.connect(governor).pauseCapital(); expect(await vault.connect(anna).capitalPaused()).to.be.true; await usdc.connect(anna).approve(vault.address, usdcUnits("50.0")); - await expect(vault.connect(anna).mint(usdc.address, usdcUnits("50.0"), 0)) - .to.be.reverted; + await expect(vault.connect(anna).mint(usdcUnits("50.0"))).to.be.reverted; }); it("Unpausing deposits allows mint", async () => { @@ -55,7 +54,7 @@ describe("Vault deposit pausing", function () { await vault.connect(governor).unpauseCapital(); expect(await vault.connect(anna).capitalPaused()).to.be.false; await usdc.connect(anna).approve(vault.address, usdcUnits("50.0")); - await vault.connect(anna).mint(usdc.address, usdcUnits("50.0"), 0); + await vault.connect(anna).mint(usdcUnits("50.0")); }); it("Deposit pause status can be read", async () => { diff --git a/contracts/test/vault/index.js b/contracts/test/vault/index.js index 86afdf8bfa..1b00de3067 100644 --- a/contracts/test/vault/index.js +++ b/contracts/test/vault/index.js @@ -43,7 +43,7 @@ describe("Vault", function () { // Matt deposits USDC, 6 decimals await usdc.connect(matt).approve(vault.address, usdcUnits("2.0")); - await vault.connect(matt).mint(usdc.address, usdcUnits("2.0"), 0); + await vault.connect(matt).mint(usdcUnits("2.0")); await expect(matt).has.a.balanceOf("102.00", ousd); }); @@ -52,7 +52,7 @@ describe("Vault", function () { await expect(anna).has.a.balanceOf("0.00", ousd); await usdc.connect(anna).approve(vault.address, usdcUnits("50.0")); - await vault.connect(anna).mint(usdc.address, usdcUnits("50.0"), 0); + await vault.connect(anna).mint(usdcUnits("50.0")); await expect(anna).has.a.balanceOf("50.00", ousd); }); @@ -61,7 +61,7 @@ describe("Vault", function () { // Matt deposits USDC, 6 decimals await usdc.connect(matt).approve(vault.address, usdcUnits("2.0")); - await vault.connect(matt).mint(usdc.address, usdcUnits("2.0"), 0); + await vault.connect(matt).mint(usdcUnits("2.0")); // Fixture loads 200 USDS, so result should be 202 expect(await vault.totalValue()).to.equal(utils.parseUnits("202", 18)); }); @@ -71,7 +71,7 @@ describe("Vault", function () { // Matt deposits USDC, 6 decimals await usdc.connect(matt).approve(vault.address, usdcUnits("8.0")); - await vault.connect(matt).mint(usdc.address, usdcUnits("8.0"), 0); + await vault.connect(matt).mint(usdcUnits("8.0")); // Matt sends his OUSD directly to Vault await ousd.connect(matt).transfer(vault.address, ousdUnits("8.0")); // Matt asks Governor for help @@ -121,7 +121,7 @@ describe("Vault", function () { await expect(matt).has.a.balanceOf("100.00", ousd); await usdc.connect(anna).mint(usdcUnits("5000.0")); await usdc.connect(anna).approve(vault.address, usdcUnits("5000.0")); - await vault.connect(anna).mint(usdc.address, usdcUnits("5000.0"), 0); + await vault.connect(anna).mint(usdcUnits("5000.0")); await expect(anna).has.a.balanceOf("5000.00", ousd); await expect(matt).has.a.balanceOf("100.00", ousd); }); @@ -131,7 +131,7 @@ describe("Vault", function () { // Matt deposits USDC, 6 decimals await usdc.connect(matt).approve(vault.address, usdcUnits("8.0")); - await vault.connect(matt).mint(usdc.address, usdcUnits("8.0"), 0); + await vault.connect(matt).mint(usdcUnits("8.0")); // Matt sends his OUSD directly to Vault await ousd.connect(matt).transfer(vault.address, ousdUnits("8.0")); // Matt asks Governor for help @@ -183,7 +183,7 @@ describe("Vault", function () { // Send all USDC to Compound await vault.connect(governor).setDefaultStrategy(mockStrategy.address); await usdc.connect(josh).approve(vault.address, usdcUnits("200")); - await vault.connect(josh).mint(usdc.address, usdcUnits("200"), 0); + await vault.connect(josh).mint(usdcUnits("200")); await vault.connect(governor).allocate(); await vault @@ -210,7 +210,7 @@ describe("Vault", function () { // Send all USDC to Compound await vault.connect(governor).setDefaultStrategy(mockStrategy.address); await usdc.connect(josh).approve(vault.address, usdcUnits("200")); - await vault.connect(josh).mint(usdc.address, usdcUnits("200"), 0); + await vault.connect(josh).mint(usdcUnits("200")); await vault.connect(governor).allocate(); await vault @@ -259,7 +259,7 @@ describe("Vault", function () { await vault.connect(governor).setDefaultStrategy(mockStrategy.address); await usdc.connect(josh).approve(vault.address, usdcUnits("90")); - await vault.connect(josh).mint(usdc.address, usdcUnits("90"), 0); + await vault.connect(josh).mint(usdcUnits("90")); await vault.connect(governor).allocate(); await vault @@ -332,7 +332,7 @@ describe("Vault", function () { // Mint and allocate USDC to Compound. await vault.connect(governor).setDefaultStrategy(mockStrategy.address); await usdc.connect(josh).approve(vault.address, usdcUnits("200")); - await vault.connect(josh).mint(usdc.address, usdcUnits("200"), 0); + await vault.connect(josh).mint(usdcUnits("200")); await vault.connect(governor).allocate(); // Call to withdrawAll by the governor should go thru. diff --git a/contracts/test/vault/oeth-vault.js b/contracts/test/vault/oeth-vault.js index f27fa02b90..5f7df04757 100644 --- a/contracts/test/vault/oeth-vault.js +++ b/contracts/test/vault/oeth-vault.js @@ -84,13 +84,9 @@ describe("OETH Vault", function () { const dataBefore = await snapData(fixtureWithUser); const amount = parseUnits("1", 18); - const minOeth = parseUnits("0.8", 18); - await weth.connect(josh).approve(oethVault.address, amount); - const tx = await oethVault - .connect(josh) - .mint(weth.address, amount, minOeth); + const tx = await oethVault.connect(josh).mint(amount); await expect(tx) .to.emit(oethVault, "Mint") @@ -115,21 +111,19 @@ describe("OETH Vault", function () { }); it("Fail to mint if amount is zero", async () => { - const { oethVault, weth, josh } = fixture; + const { oethVault, josh } = fixture; - const tx = oethVault.connect(josh).mint(weth.address, "0", "0"); + const tx = oethVault.connect(josh).mint("0"); await expect(tx).to.be.revertedWith("Amount must be greater than 0"); }); it("Fail to mint if capital is paused", async () => { - const { oethVault, weth, governor } = fixture; + const { oethVault, governor } = fixture; await oethVault.connect(governor).pauseCapital(); expect(await oethVault.capitalPaused()).to.equal(true); - const tx = oethVault - .connect(governor) - .mint(weth.address, oethUnits("10"), "0"); + const tx = oethVault.connect(governor).mint(oethUnits("10")); await expect(tx).to.be.revertedWith("Capital paused"); }); @@ -148,7 +142,7 @@ describe("OETH Vault", function () { // Mint some WETH await weth.connect(domen).approve(oethVault.address, oethUnits("10000")); const mintAmount = oethUnits("100"); - await oethVault.connect(domen).mint(weth.address, mintAmount, "0"); + await oethVault.connect(domen).mint(mintAmount); expect(await weth.balanceOf(mockStrategy.address)).to.eq( mintAmount, @@ -177,7 +171,7 @@ describe("OETH Vault", function () { describe("async withdrawal", () => { it("Should update total supply correctly", async () => { const { oethVault, oeth, weth, daniel } = fixture; - await oethVault.connect(daniel).mint(weth.address, oethUnits("10"), "0"); + await oethVault.connect(daniel).mint(oethUnits("10")); const userBalanceBefore = await weth.balanceOf(daniel.address); const vaultBalanceBefore = await weth.balanceOf(oethVault.address); @@ -208,10 +202,10 @@ describe("OETH Vault", function () { // Mint some WETH await weth.connect(domen).approve(oethVault.address, oethUnits("10000")); - await oethVault.connect(domen).mint(weth.address, oethUnits("100"), "0"); + await oethVault.connect(domen).mint(oethUnits("100")); // Mint a small amount that won't get allocated to the strategy - await oethVault.connect(domen).mint(weth.address, oethUnits("1.23"), "0"); + await oethVault.connect(domen).mint(oethUnits("1.23")); // Withdraw something more than what the Vault holds await oethVault.connect(domen).requestWithdrawal(oethUnits("12.55")); @@ -230,7 +224,7 @@ describe("OETH Vault", function () { it("Should allow every user to withdraw", async () => { const { oethVault, weth, daniel } = fixture; - await oethVault.connect(daniel).mint(weth.address, oethUnits("10"), "0"); + await oethVault.connect(daniel).mint(oethUnits("10")); await oethVault.connect(daniel).requestWithdrawal(oethUnits("10")); await advanceTime(10 * 60); // 10 minutes @@ -311,9 +305,7 @@ describe("OETH Vault", function () { .approve(oethVault.address, oethUnits("10")); // Then mint for strategy - await oethVault - .connect(strategySigner) - .mint(weth.address, oethUnits("10"), "0"); + await oethVault.connect(strategySigner).mint(oethUnits("10")); await expect(await oeth.balanceOf(mockStrategy.address)).to.equal( oethUnits("10") @@ -373,7 +365,7 @@ describe("OETH Vault", function () { describe("Allocate", () => { const delayPeriod = 10 * 60; // 10mins it("Shouldn't allocate as minted amount is lower than autoAllocateThreshold", async () => { - const { oethVault, weth, daniel } = fixture; + const { oethVault, daniel } = fixture; // Set auto allocate threshold to 100 WETH await oethVault @@ -381,14 +373,12 @@ describe("OETH Vault", function () { .setAutoAllocateThreshold(oethUnits("100")); // Mint for 10 WETH - const tx = oethVault - .connect(daniel) - .mint(weth.address, oethUnits("10"), "0"); + const tx = oethVault.connect(daniel).mint(oethUnits("10")); await expect(tx).to.not.emit(oethVault, "AssetAllocated"); }); it("Shouldn't allocate as no WETH available", async () => { - const { oethVault, weth, daniel } = fixture; + const { oethVault, daniel } = fixture; // Deploy default strategy const mockStrategy = await deployWithConfirmation("MockStrategy"); @@ -400,19 +390,17 @@ describe("OETH Vault", function () { .setDefaultStrategy(mockStrategy.address); // Mint will allocate all to default strategy bc no buffer, no threshold - await oethVault.connect(daniel).mint(weth.address, oethUnits("10"), "0"); + await oethVault.connect(daniel).mint(oethUnits("10")); await oethVault.connect(daniel).requestWithdrawal(oethUnits("5")); // Deposit less than queued amount (5 WETH) => _wethAvailable() return 0 - const tx = oethVault - .connect(daniel) - .mint(weth.address, oethUnits("3", "0")); + const tx = oethVault.connect(daniel).mint(oethUnits("3")); expect(tx).to.not.emit(oethVault, "AssetAllocated"); }); it("Shouldn't allocate as WETH available is lower than buffer", async () => { - const { oethVault, weth, daniel } = fixture; + const { oethVault, daniel } = fixture; - await oethVault.connect(daniel).mint(weth.address, oethUnits("100"), "0"); + await oethVault.connect(daniel).mint(oethUnits("100")); // Set vault buffer to 5% await oethVault @@ -422,15 +410,13 @@ describe("OETH Vault", function () { // OETH total supply = 100(first deposit) + 5(second deposit) = 105 // Buffer = 105 * 5% = 5.25 WETH // Second deposit should remain in the vault as below vault buffer - const tx = oethVault.connect(daniel).mint(oethUnits("5"), "0"); + const tx = oethVault.connect(daniel).mint(oethUnits("5")); expect(tx).to.not.emit(oethVault, "AssetAllocated"); }); it("Shouldn't allocate as default strategy is address null", async () => { - const { oethVault, weth, daniel } = fixture; + const { oethVault, daniel } = fixture; - const tx = oethVault - .connect(daniel) - .mint(weth.address, oethUnits("100"), "0"); + const tx = oethVault.connect(daniel).mint(oethUnits("100")); expect(tx).to.not.emit(oethVault, "AssetAllocated"); }); @@ -449,9 +435,7 @@ describe("OETH Vault", function () { }); it("buffer is 0%, 0 WETH in queue", async () => { const { oethVault, daniel, weth } = fixture; - const tx = oethVault - .connect(daniel) - .mint(weth.address, oethUnits("10"), "0"); + const tx = oethVault.connect(daniel).mint(oethUnits("10")); await expect(tx) .to.emit(oethVault, "AssetAllocated") .withArgs(weth.address, mockStrategy.address, oethUnits("10")); @@ -466,9 +450,7 @@ describe("OETH Vault", function () { .connect(await impersonateAndFund(await oethVault.governor())) .setVaultBuffer(oethUnits("0.05")); - const tx = oethVault - .connect(daniel) - .mint(weth.address, oethUnits("10"), "0"); + const tx = oethVault.connect(daniel).mint(oethUnits("10")); await expect(tx) .to.emit(oethVault, "AssetAllocated") .withArgs(weth.address, mockStrategy.address, oethUnits("9.5")); @@ -478,13 +460,9 @@ describe("OETH Vault", function () { }); it("buffer is 0%, 10 WETH in queue", async () => { const { oethVault, daniel, weth } = fixture; - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("10"), "0"); + await oethVault.connect(daniel).mint(oethUnits("10")); await oethVault.connect(daniel).requestWithdrawal(oethUnits("10")); - const tx = oethVault - .connect(daniel) - .mint(weth.address, oethUnits("20"), "0"); + const tx = oethVault.connect(daniel).mint(oethUnits("20")); // 10 WETH in the queue, 10 WETH in strat. New deposit of 20, only 10 WETH available to allocate to strategy. await expect(tx) @@ -496,9 +474,7 @@ describe("OETH Vault", function () { }); it("buffer is 0%, 20 WETH in queue, 10 WETH claimed", async () => { const { oethVault, daniel, weth } = fixture; - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("30"), "0"); + await oethVault.connect(daniel).mint(oethUnits("30")); await oethVault.connect(daniel).requestWithdrawal(oethUnits("10")); await advanceTime(delayPeriod); // Simulate strategist pulling back WETH to the vault. @@ -512,9 +488,7 @@ describe("OETH Vault", function () { // So far, 20 WETH queued, 10 WETH claimed, 0 WETH available, 20 WETH in strat // Deposit 35 WETH, 10 WETH should remain in the vault for withdraw, so strat should have 45WETH. - const tx = oethVault - .connect(daniel) - .mint(weth.address, oethUnits("35"), "0"); + const tx = oethVault.connect(daniel).mint(oethUnits("35")); await expect(tx) .to.emit(oethVault, "AssetAllocated") .withArgs(weth.address, mockStrategy.address, oethUnits("25")); @@ -525,9 +499,7 @@ describe("OETH Vault", function () { }); it("buffer is 5%, 20 WETH in queue, 10 WETH claimed", async () => { const { oethVault, daniel, weth } = fixture; - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("40"), "0"); + await oethVault.connect(daniel).mint(oethUnits("40")); await oethVault.connect(daniel).requestWithdrawal(oethUnits("10")); await advanceTime(delayPeriod); // Simulate strategist pulling back WETH to the vault. @@ -547,9 +519,7 @@ describe("OETH Vault", function () { // Deposit 40 WETH, 10 WETH should remain in the vault for withdraw + 3 (i.e. 20+40 *5%) // So strat should have 57WETH. - const tx = oethVault - .connect(daniel) - .mint(weth.address, oethUnits("40"), "0"); + const tx = oethVault.connect(daniel).mint(oethUnits("40")); await expect(tx) .to.emit(oethVault, "AssetAllocated") .withArgs(weth.address, mockStrategy.address, oethUnits("27")); @@ -565,13 +535,11 @@ describe("OETH Vault", function () { const delayPeriod = 10 * 60; // 10 minutes describe("with all 60 WETH in the vault", () => { beforeEach(async () => { - const { oethVault, weth, daniel, josh, matt } = fixture; + const { oethVault, daniel, josh, matt } = fixture; // Mint some OETH to three users - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("10"), "0"); - await oethVault.connect(josh).mint(weth.address, oethUnits("20"), "0"); - await oethVault.connect(matt).mint(weth.address, oethUnits("30"), "0"); + await oethVault.connect(daniel).mint(oethUnits("10")); + await oethVault.connect(josh).mint(oethUnits("20")); + await oethVault.connect(matt).mint(oethUnits("30")); await oethVault .connect(await impersonateAndFund(await oethVault.governor())) .setMaxSupplyDiff(oethUnits("0.03")); @@ -1221,7 +1189,7 @@ describe("OETH Vault", function () { await oethVault.connect(matt).claimWithdrawal(2); }); it("Fail to claim a new request after mint with NOT enough liquidity", async () => { - const { oethVault, daniel, matt, weth } = fixture; + const { oethVault, daniel, matt } = fixture; // Matt requests all 30 OETH to be withdrawn which is not enough liquidity const requestAmount = oethUnits("30"); @@ -1230,7 +1198,7 @@ describe("OETH Vault", function () { // WETH in the vault = 60 - 15 = 45 WETH // unallocated WETH in the Vault = 45 - 23 = 22 WETH // Add another 6 WETH so the unallocated WETH is 22 + 6 = 28 WETH - await oethVault.connect(daniel).mint(weth.address, oethUnits("6"), 0); + await oethVault.connect(daniel).mint(oethUnits("6")); await advanceTime(delayPeriod); // Advance in time to ensure time delay between request and claim. @@ -1238,7 +1206,7 @@ describe("OETH Vault", function () { await expect(tx).to.be.revertedWith("Queue pending liquidity"); }); it("Should claim a new request after mint adds enough liquidity", async () => { - const { oethVault, daniel, matt, weth } = fixture; + const { oethVault, daniel, matt } = fixture; // Set the claimable amount to the queued amount await oethVault.addWithdrawalQueueLiquidity(); @@ -1254,7 +1222,7 @@ describe("OETH Vault", function () { // unallocated WETH in the Vault = 45 - 23 = 22 WETH // Add another 8 WETH so the unallocated WETH is 22 + 8 = 30 WETH const mintAmount = oethUnits("8"); - await oethVault.connect(daniel).mint(weth.address, mintAmount, 0); + await oethVault.connect(daniel).mint(mintAmount); await assertChangedData( dataBeforeMint, @@ -1310,12 +1278,10 @@ describe("OETH Vault", function () { const { governor, oethVault, weth, daniel, domen, josh, matt } = fixture; // Mint 105 OETH to four users - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("15"), "0"); - await oethVault.connect(josh).mint(weth.address, oethUnits("20"), "0"); - await oethVault.connect(matt).mint(weth.address, oethUnits("30"), "0"); - await oethVault.connect(domen).mint(weth.address, oethUnits("40"), "0"); + await oethVault.connect(daniel).mint(oethUnits("15")); + await oethVault.connect(josh).mint(oethUnits("20")); + await oethVault.connect(matt).mint(oethUnits("30")); + await oethVault.connect(domen).mint(oethUnits("40")); await oethVault .connect(await impersonateAndFund(await oethVault.governor())) .setMaxSupplyDiff(oethUnits("0.03")); @@ -1434,10 +1400,8 @@ describe("OETH Vault", function () { }); describe("when mint covers exactly outstanding requests (32 - 15 = 17 OETH)", () => { beforeEach(async () => { - const { oethVault, daniel, weth } = fixture; - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("17"), "0"); + const { oethVault, daniel } = fixture; + await oethVault.connect(daniel).mint(oethUnits("17")); // Advance in time to ensure time delay between request and claim. await advanceTime(delayPeriod); @@ -1499,10 +1463,8 @@ describe("OETH Vault", function () { }); describe("when mint covers exactly outstanding requests and vault buffer (17 + 1 WETH)", () => { beforeEach(async () => { - const { oethVault, daniel, weth } = fixture; - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("18"), "0"); + const { oethVault, daniel } = fixture; + await oethVault.connect(daniel).mint(oethUnits("18")); }); it("Should deposit 1 WETH to a strategy which is the vault buffer", async () => { const { oethVault, weth, governor } = fixture; @@ -1542,10 +1504,8 @@ describe("OETH Vault", function () { }); describe("when mint more than covers outstanding requests and vault buffer (17 + 1 + 3 = 21 OETH)", () => { beforeEach(async () => { - const { oethVault, daniel, weth } = fixture; - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("21"), "0"); + const { oethVault, daniel } = fixture; + await oethVault.connect(daniel).mint(oethUnits("21")); }); it("Should deposit 4 WETH to a strategy", async () => { const { oethVault, weth, governor } = fixture; @@ -1606,14 +1566,12 @@ describe("OETH Vault", function () { }); describe("with 40 WETH in the queue, 10 WETH in the vault, 30 WETH already claimed", () => { beforeEach(async () => { - const { oethVault, weth, daniel, josh, matt } = fixture; + const { oethVault, daniel, josh, matt } = fixture; // Mint 60 OETH to three users - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("10"), "0"); - await oethVault.connect(josh).mint(weth.address, oethUnits("20"), "0"); - await oethVault.connect(matt).mint(weth.address, oethUnits("10"), "0"); + await oethVault.connect(daniel).mint(oethUnits("10")); + await oethVault.connect(josh).mint(oethUnits("20")); + await oethVault.connect(matt).mint(oethUnits("10")); // Request and claim 10 WETH from Vault await oethVault.connect(daniel).requestWithdrawal(oethUnits("10")); @@ -1690,13 +1648,11 @@ describe("OETH Vault", function () { }); describe("with 40 WETH in the queue, 100 WETH in the vault, 0 WETH in the strategy", () => { beforeEach(async () => { - const { oethVault, weth, daniel, josh, matt } = fixture; + const { oethVault, daniel, josh, matt } = fixture; // Mint 100 OETH to three users - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("10"), "0"); - await oethVault.connect(josh).mint(weth.address, oethUnits("20"), "0"); - await oethVault.connect(matt).mint(weth.address, oethUnits("70"), "0"); + await oethVault.connect(daniel).mint(oethUnits("10")); + await oethVault.connect(josh).mint(oethUnits("20")); + await oethVault.connect(matt).mint(oethUnits("70")); // Request 40 WETH from Vault await oethVault.connect(matt).requestWithdrawal(oethUnits("40")); @@ -1808,11 +1764,9 @@ describe("OETH Vault", function () { .setDefaultStrategy(mockStrategy.address); // Mint 60 OETH to three users - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("10"), "0"); - await oethVault.connect(josh).mint(weth.address, oethUnits("20"), "0"); - await oethVault.connect(matt).mint(weth.address, oethUnits("30"), "0"); + await oethVault.connect(daniel).mint(oethUnits("10")); + await oethVault.connect(josh).mint(oethUnits("20")); + await oethVault.connect(matt).mint(oethUnits("30")); // Request and claim 10 + 20 + 10 = 40 WETH from Vault await oethVault.connect(daniel).requestWithdrawal(oethUnits("10")); @@ -1968,11 +1922,9 @@ describe("OETH Vault", function () { .setDefaultStrategy(mockStrategy.address); // Mint 100 OETH to three users - await oethVault - .connect(daniel) - .mint(weth.address, oethUnits("20"), "0"); - await oethVault.connect(josh).mint(weth.address, oethUnits("30"), "0"); - await oethVault.connect(matt).mint(weth.address, oethUnits("50"), "0"); + await oethVault.connect(daniel).mint(oethUnits("20")); + await oethVault.connect(josh).mint(oethUnits("30")); + await oethVault.connect(matt).mint(oethUnits("50")); // Request and claim 20 + 30 + 49 = 99 WETH from Vault await oethVault.connect(daniel).requestWithdrawal(oethUnits("20")); diff --git a/contracts/test/vault/oeth-vault.mainnet.fork-test.js b/contracts/test/vault/oeth-vault.mainnet.fork-test.js index b62f977477..6048c7bfc0 100644 --- a/contracts/test/vault/oeth-vault.mainnet.fork-test.js +++ b/contracts/test/vault/oeth-vault.mainnet.fork-test.js @@ -48,13 +48,10 @@ describe("ForkTest: OETH Vault", function () { const { oethVault, weth, josh } = fixture; const amount = parseUnits("1", 18); - const minOeth = parseUnits("0.8", 18); await weth.connect(josh).approve(oethVault.address, amount); - const tx = await oethVault - .connect(josh) - .mint(weth.address, amount, minOeth); + const tx = await oethVault.connect(josh).mint(amount); await logTxDetails(tx, "mint"); @@ -67,13 +64,10 @@ describe("ForkTest: OETH Vault", function () { const { oethVault, weth, josh } = fixture; const amount = parseUnits("11", 18); - const minOeth = parseUnits("8", 18); await weth.connect(josh).approve(oethVault.address, amount); - const tx = await oethVault - .connect(josh) - .mint(weth.address, amount, minOeth); + const tx = await oethVault.connect(josh).mint(amount); await logTxDetails(tx, "mint"); @@ -86,13 +80,10 @@ describe("ForkTest: OETH Vault", function () { const { oethVault, weth, josh } = fixture; const amount = parseUnits("11", 18); - const minOeth = parseUnits("8", 18); await weth.connect(josh).approve(oethVault.address, amount); - const tx = await oethVault - .connect(josh) - .mint(weth.address, amount, minOeth); + const tx = await oethVault.connect(josh).mint(amount); await logTxDetails(tx, "mint"); @@ -219,7 +210,7 @@ describe("ForkTest: OETH Vault", function () { if (queue > claimed) { const diff = queue.sub(claimed).mul(110).div(100); await weth.connect(depositor).approve(oethVault.address, diff); - return await oethVault.connect(depositor).mint(weth.address, diff, 0); + return await oethVault.connect(depositor).mint(diff); } return null; } diff --git a/contracts/test/vault/oethb-vault.base.fork-test.js b/contracts/test/vault/oethb-vault.base.fork-test.js index 8232b5c937..ccca6bec32 100644 --- a/contracts/test/vault/oethb-vault.base.fork-test.js +++ b/contracts/test/vault/oethb-vault.base.fork-test.js @@ -18,7 +18,7 @@ describe("ForkTest: OETHb Vault", function () { const { weth, oethbVault } = fixture; await weth.connect(signer).deposit({ value: oethUnits("1") }); await weth.connect(signer).approve(oethbVault.address, oethUnits("1")); - await oethbVault.connect(signer).mint(weth.address, oethUnits("1"), "0"); + await oethbVault.connect(signer).mint(oethUnits("1")); } describe("Mint & Permissioned redeems", function () { @@ -61,9 +61,7 @@ describe("ForkTest: OETHb Vault", function () { await weth .connect(rafael) .approve(oethbVault.address, oethUnits("10000")); - await oethbVault - .connect(rafael) - .mint(weth.address, oethUnits("10000"), 0); + await oethbVault.connect(rafael).mint(oethUnits("10000")); const delayPeriod = await oethbVault.withdrawalClaimDelay(); diff --git a/contracts/test/vault/oethp-vault.plume.fork-test.js b/contracts/test/vault/oethp-vault.plume.fork-test.js index ddacf04732..f48c40c1fc 100644 --- a/contracts/test/vault/oethp-vault.plume.fork-test.js +++ b/contracts/test/vault/oethp-vault.plume.fork-test.js @@ -18,7 +18,7 @@ describe("ForkTest: OETHp Vault", function () { const { weth, oethpVault, _mintWETH } = fixture; await _mintWETH(signer, amount); await weth.connect(signer).approve(oethpVault.address, amount); - await oethpVault.connect(signer).mint(weth.address, amount, "0"); + await oethpVault.connect(signer).mint(amount); } describe("Mint & Permissioned redeems", function () { @@ -28,9 +28,9 @@ describe("ForkTest: OETHp Vault", function () { }); it("Should not allow anyone else to mint", async () => { - const { nick, weth, oethpVault } = fixture; + const { nick, oethpVault } = fixture; await expect( - oethpVault.connect(nick).mint(weth.address, oethUnits("1"), "0") + oethpVault.connect(nick).mint(oethUnits("1")) ).to.be.revertedWith("Caller is not the Strategist or Governor"); }); diff --git a/contracts/test/vault/os-vault.sonic.js b/contracts/test/vault/os-vault.sonic.js index 3214c3c7b8..e67c14b2ed 100644 --- a/contracts/test/vault/os-vault.sonic.js +++ b/contracts/test/vault/os-vault.sonic.js @@ -135,13 +135,10 @@ describe("Origin S Vault", function () { const dataBefore = await snapData(fixtureWithUser); const mintAmount = parseUnits("1", 18); - const minOS = parseUnits("0.8", 18); await wS.connect(nick).approve(oSonicVault.address, mintAmount); - const tx = await oSonicVault - .connect(nick) - .mint(wS.address, mintAmount, minOS); + const tx = await oSonicVault.connect(nick).mint(mintAmount); await expect(tx) .to.emit(oSonicVault, "Mint") @@ -171,7 +168,7 @@ describe("Origin S Vault", function () { // Mint some OSonic const mintAmount = parseUnits("100", 18); await wS.connect(nick).approve(oSonicVault.address, mintAmount); - await oSonicVault.connect(nick).mint(wS.address, mintAmount, 0); + await oSonicVault.connect(nick).mint(mintAmount); const fixtureWithUser = { ...fixture, user: nick }; const dataBefore = await snapData(fixtureWithUser); @@ -210,7 +207,7 @@ describe("Origin S Vault", function () { // Mint some OSonic const mintAmount = parseUnits("100", 18); await wS.connect(nick).approve(oSonicVault.address, mintAmount); - await oSonicVault.connect(nick).mint(wS.address, mintAmount, 0); + await oSonicVault.connect(nick).mint(mintAmount); const withdrawAmount = parseUnits("90", 18); await oSonicVault.connect(nick).requestWithdrawal(withdrawAmount); @@ -250,7 +247,7 @@ describe("Origin S Vault", function () { // Mint some OSonic const mintAmount = parseUnits("100", 18); await wS.connect(nick).approve(oSonicVault.address, mintAmount); - await oSonicVault.connect(nick).mint(wS.address, mintAmount, 0); + await oSonicVault.connect(nick).mint(mintAmount); const withdrawAmount1 = parseUnits("10", 18); const withdrawAmount2 = parseUnits("20", 18); const withdrawAmount = withdrawAmount1.add(withdrawAmount2); diff --git a/contracts/test/vault/rebase.js b/contracts/test/vault/rebase.js index d21d87d5bb..2f28f31900 100644 --- a/contracts/test/vault/rebase.js +++ b/contracts/test/vault/rebase.js @@ -124,7 +124,7 @@ describe("Vault rebase", () => { await expect(anna).has.a.balanceOf("0", ousd); await usdc.connect(anna).approve(vault.address, usdcUnits("50")); - await vault.connect(anna).mint(usdc.address, usdcUnits("50"), 0); + await vault.connect(anna).mint(usdcUnits("50")); await expect(anna).has.a.balanceOf("50", ousd); }); }); diff --git a/contracts/test/vault/redeem.js b/contracts/test/vault/redeem.js index 60cbb2647e..3700764a08 100644 --- a/contracts/test/vault/redeem.js +++ b/contracts/test/vault/redeem.js @@ -105,9 +105,9 @@ describe("OUSD Vault Withdrawals", function () { await usdc.connect(matt).approve(vault.address, usdcUnits("30")); // Mint some OUSD to three users - await vault.connect(daniel).mint(usdc.address, usdcUnits("10"), "0"); - await vault.connect(josh).mint(usdc.address, usdcUnits("20"), "0"); - await vault.connect(matt).mint(usdc.address, usdcUnits("30"), "0"); + await vault.connect(daniel).mint(usdcUnits("10")); + await vault.connect(josh).mint(usdcUnits("20")); + await vault.connect(matt).mint(usdcUnits("30")); // Set max supply diff to 3% to allow withdrawals await vault @@ -784,7 +784,7 @@ describe("OUSD Vault Withdrawals", function () { await usdc .connect(daniel) .approve(vault.address, ousdUnits("6").div(1e12)); - await vault.connect(daniel).mint(usdc.address, usdcUnits("6"), 0); + await vault.connect(daniel).mint(usdcUnits("6")); await advanceTime(delayPeriod); // Advance in time to ensure time delay between request and claim. @@ -811,9 +811,7 @@ describe("OUSD Vault Withdrawals", function () { await usdc .connect(daniel) .approve(vault.address, mintAmount.div(1e12)); - await vault - .connect(daniel) - .mint(usdc.address, mintAmount.div(1e12), 0); + await vault.connect(daniel).mint(mintAmount.div(1e12)); await assertChangedData( dataBeforeMint, @@ -880,10 +878,10 @@ describe("OUSD Vault Withdrawals", function () { await usdc.connect(domen).approve(vault.address, usdcUnits("40")); // Mint 105 OUSD to four users - await vault.connect(daniel).mint(usdc.address, usdcUnits("15"), "0"); - await vault.connect(josh).mint(usdc.address, usdcUnits("20"), "0"); - await vault.connect(matt).mint(usdc.address, usdcUnits("30"), "0"); - await vault.connect(domen).mint(usdc.address, usdcUnits("40"), "0"); + await vault.connect(daniel).mint(usdcUnits("15")); + await vault.connect(josh).mint(usdcUnits("20")); + await vault.connect(matt).mint(usdcUnits("30")); + await vault.connect(domen).mint(usdcUnits("40")); await vault .connect(await impersonateAndFund(await vault.governor())) .setMaxSupplyDiff(ousdUnits("0.03")); @@ -1006,7 +1004,7 @@ describe("OUSD Vault Withdrawals", function () { const { vault, daniel, usdc } = fixture; await usdc.mintTo(daniel.address, usdcUnits("17")); await usdc.connect(daniel).approve(vault.address, usdcUnits("17")); - await vault.connect(daniel).mint(usdc.address, usdcUnits("17"), "0"); + await vault.connect(daniel).mint(usdcUnits("17")); // Advance in time to ensure time delay between request and claim. await advanceTime(delayPeriod); @@ -1071,7 +1069,7 @@ describe("OUSD Vault Withdrawals", function () { const { vault, daniel, usdc } = fixture; await usdc.mintTo(daniel.address, usdcUnits("18")); await usdc.connect(daniel).approve(vault.address, usdcUnits("18")); - await vault.connect(daniel).mint(usdc.address, usdcUnits("18"), "0"); + await vault.connect(daniel).mint(usdcUnits("18")); }); it("Should deposit 1 USDC to a strategy which is the vault buffer", async () => { const { vault, usdc, governor } = fixture; @@ -1114,7 +1112,7 @@ describe("OUSD Vault Withdrawals", function () { const { vault, daniel, usdc } = fixture; await usdc.mintTo(daniel.address, usdcUnits("21")); await usdc.connect(daniel).approve(vault.address, usdcUnits("21")); - await vault.connect(daniel).mint(usdc.address, usdcUnits("21"), "0"); + await vault.connect(daniel).mint(usdcUnits("21")); }); it("Should deposit 4 USDC to a strategy", async () => { const { vault, usdc, governor } = fixture; @@ -1188,9 +1186,9 @@ describe("OUSD Vault Withdrawals", function () { await usdc.connect(matt).approve(vault.address, usdcUnits("10")); // Mint 60 OUSD to three users - await vault.connect(daniel).mint(usdc.address, usdcUnits("10"), "0"); - await vault.connect(josh).mint(usdc.address, usdcUnits("20"), "0"); - await vault.connect(matt).mint(usdc.address, usdcUnits("10"), "0"); + await vault.connect(daniel).mint(usdcUnits("10")); + await vault.connect(josh).mint(usdcUnits("20")); + await vault.connect(matt).mint(usdcUnits("10")); // Request and claim 10 USDC from Vault await vault.connect(daniel).requestWithdrawal(ousdUnits("10")); @@ -1279,9 +1277,9 @@ describe("OUSD Vault Withdrawals", function () { await usdc.connect(matt).approve(vault.address, usdcUnits("70")); // Mint 100 OUSD to three users - await vault.connect(daniel).mint(usdc.address, usdcUnits("10"), "0"); - await vault.connect(josh).mint(usdc.address, usdcUnits("20"), "0"); - await vault.connect(matt).mint(usdc.address, usdcUnits("70"), "0"); + await vault.connect(daniel).mint(usdcUnits("10")); + await vault.connect(josh).mint(usdcUnits("20")); + await vault.connect(matt).mint(usdcUnits("70")); // Request 40 USDC from Vault await vault.connect(matt).requestWithdrawal(ousdUnits("40")); @@ -1401,9 +1399,9 @@ describe("OUSD Vault Withdrawals", function () { await usdc.connect(matt).approve(vault.address, usdcUnits("30")); // Mint 60 OUSD to three users - await vault.connect(daniel).mint(usdc.address, usdcUnits("10"), "0"); - await vault.connect(josh).mint(usdc.address, usdcUnits("20"), "0"); - await vault.connect(matt).mint(usdc.address, usdcUnits("30"), "0"); + await vault.connect(daniel).mint(usdcUnits("10")); + await vault.connect(josh).mint(usdcUnits("20")); + await vault.connect(matt).mint(usdcUnits("30")); await vault.allocate(); // Request and claim 10 + 20 + 10 = 40 USDC from Vault @@ -1568,9 +1566,9 @@ describe("OUSD Vault Withdrawals", function () { await usdc.connect(matt).approve(vault.address, usdcUnits("50")); // Mint 100 OUSD to three users - await vault.connect(daniel).mint(usdc.address, usdcUnits("20"), "0"); - await vault.connect(josh).mint(usdc.address, usdcUnits("30"), "0"); - await vault.connect(matt).mint(usdc.address, usdcUnits("50"), "0"); + await vault.connect(daniel).mint(usdcUnits("20")); + await vault.connect(josh).mint(usdcUnits("30")); + await vault.connect(matt).mint(usdcUnits("50")); await vault.allocate(); diff --git a/contracts/test/vault/vault.mainnet.fork-test.js b/contracts/test/vault/vault.mainnet.fork-test.js index 81a6b77ca1..8e73abbff6 100644 --- a/contracts/test/vault/vault.mainnet.fork-test.js +++ b/contracts/test/vault/vault.mainnet.fork-test.js @@ -108,11 +108,11 @@ describe("ForkTest: Vault", function () { }); it("Should allow to mint w/ USDC", async () => { - const { ousd, vault, josh, usdc } = fixture; + const { ousd, vault, josh } = fixture; const balancePreMint = await ousd .connect(josh) .balanceOf(josh.getAddress()); - await vault.connect(josh).mint(usdc.address, usdcUnits("500"), 0); + await vault.connect(josh).mint(usdcUnits("500")); const balancePostMint = await ousd .connect(josh) @@ -125,9 +125,9 @@ describe("ForkTest: Vault", function () { it("should withdraw from and deposit to strategy", async () => { const { vault, josh, usdc, morphoOUSDv2Strategy } = fixture; // Mint a lot more in case there are outstanding withdrawals - await vault.connect(josh).mint(usdc.address, usdcUnits("500000"), 0); + await vault.connect(josh).mint(usdcUnits("500000")); // The next mint should all be deposited into the strategy - await vault.connect(josh).mint(usdc.address, usdcUnits("90"), 0); + await vault.connect(josh).mint(usdcUnits("90")); const strategistSigner = await impersonateAndFund( await vault.strategistAddr() ); diff --git a/contracts/test/vault/vault.sonic.fork-test.js b/contracts/test/vault/vault.sonic.fork-test.js index 526f1e1273..ed8d2c2ed1 100644 --- a/contracts/test/vault/vault.sonic.fork-test.js +++ b/contracts/test/vault/vault.sonic.fork-test.js @@ -100,11 +100,11 @@ describe("ForkTest: Sonic Vault", function () { }); it("Should allow to mint w/ Wrapped S (wS)", async () => { - const { oSonic, oSonicVault, nick, wS } = fixture; + const { oSonic, oSonicVault, nick } = fixture; const balancePreMint = await oSonic .connect(nick) .balanceOf(nick.getAddress()); - await oSonicVault.connect(nick).mint(wS.address, parseUnits("1000"), 0); + await oSonicVault.connect(nick).mint(parseUnits("1000")); const balancePostMint = await oSonic .connect(nick) @@ -115,15 +115,13 @@ describe("ForkTest: Sonic Vault", function () { }); it.skip("should automatically deposit to staking strategy", async () => { - const { oSonicVault, nick, wS, sonicStakingStrategy } = fixture; + const { oSonicVault, nick, sonicStakingStrategy } = fixture; // Clear any wS out of the Vault first await oSonicVault.allocate(); const mintAmount = parseUnits("5000000"); - const tx = await oSonicVault - .connect(nick) - .mint(wS.address, mintAmount, 0); + const tx = await oSonicVault.connect(nick).mint(mintAmount); // Check mint event await expect(tx) @@ -138,7 +136,7 @@ describe("ForkTest: Sonic Vault", function () { const { oSonicVault, nick, wS, sonicStakingStrategy } = fixture; const depositAmount = parseUnits("2000"); - await oSonicVault.connect(nick).mint(wS.address, depositAmount, 0); + await oSonicVault.connect(nick).mint(depositAmount); const strategistSigner = await impersonateAndFund( await oSonicVault.strategistAddr() ); @@ -163,10 +161,10 @@ describe("ForkTest: Sonic Vault", function () { }); it("should call withdraw all from staking strategy even if all delegated", async () => { - const { oSonicVault, nick, wS, sonicStakingStrategy } = fixture; + const { oSonicVault, nick, sonicStakingStrategy } = fixture; const depositAmount = parseUnits("2000"); - await oSonicVault.connect(nick).mint(wS.address, depositAmount, 0); + await oSonicVault.connect(nick).mint(depositAmount); const strategistSigner = await impersonateAndFund( await oSonicVault.strategistAddr() ); @@ -181,7 +179,7 @@ describe("ForkTest: Sonic Vault", function () { it("should call withdraw all from staking strategy with wrapped S in it", async () => { const { oSonicVault, nick, wS, sonicStakingStrategy } = fixture; const depositAmount = parseUnits("2000"); - await oSonicVault.connect(nick).mint(wS.address, depositAmount, 0); + await oSonicVault.connect(nick).mint(depositAmount); const strategistSigner = await impersonateAndFund( await oSonicVault.strategistAddr() ); @@ -204,7 +202,7 @@ describe("ForkTest: Sonic Vault", function () { it("should call withdraw all from staking strategy with native S in it", async () => { const { oSonicVault, nick, wS, sonicStakingStrategy } = fixture; const depositAmount = parseUnits("2000"); - await oSonicVault.connect(nick).mint(wS.address, depositAmount, 0); + await oSonicVault.connect(nick).mint(depositAmount); const strategistSigner = await impersonateAndFund( await oSonicVault.strategistAddr() ); From e1eb9c48230dc7f6f4337bfe28b32b0e2740fc27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Feb 2026 14:02:02 +0100 Subject: [PATCH 5/9] Add deployment scripts for EthereumBridgeHelperModule and BaseBridgeHelperModule Deploy scripts for the updated bridge helper modules on mainnet and Base. Both enable the module on the Safe when running on a fork. --- .../deploy/base/044_bridge_helper_module.js | 42 +++++++++++++++++ .../mainnet/178_bridge_helper_module.js | 46 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 contracts/deploy/base/044_bridge_helper_module.js create mode 100644 contracts/deploy/mainnet/178_bridge_helper_module.js diff --git a/contracts/deploy/base/044_bridge_helper_module.js b/contracts/deploy/base/044_bridge_helper_module.js new file mode 100644 index 0000000000..00e05d91d4 --- /dev/null +++ b/contracts/deploy/base/044_bridge_helper_module.js @@ -0,0 +1,42 @@ +const { deployOnBase } = require("../../utils/deploy-l2"); +const addresses = require("../../utils/addresses"); +const { isFork } = require("../../utils/hardhat-helpers"); +const { impersonateAndFund } = require("../../utils/signers"); + +module.exports = deployOnBase( + { + deployName: "044_bridge_helper_module", + }, + async ({ deployWithConfirmation, withConfirmation }) => { + const safeAddress = addresses.multichainStrategist; + + await deployWithConfirmation("BaseBridgeHelperModule", [safeAddress]); + const cBridgeHelperModule = await ethers.getContract( + "BaseBridgeHelperModule" + ); + + console.log( + `BaseBridgeHelperModule (for ${safeAddress}) deployed to`, + cBridgeHelperModule.address + ); + + if (isFork) { + const safeSigner = await impersonateAndFund(safeAddress); + + const cSafe = await ethers.getContractAt( + ["function enableModule(address module) external"], + safeAddress + ); + + await withConfirmation( + cSafe.connect(safeSigner).enableModule(cBridgeHelperModule.address) + ); + + console.log("Enabled module on fork"); + } + + return { + actions: [], + }; + } +); diff --git a/contracts/deploy/mainnet/178_bridge_helper_module.js b/contracts/deploy/mainnet/178_bridge_helper_module.js new file mode 100644 index 0000000000..928250d1c2 --- /dev/null +++ b/contracts/deploy/mainnet/178_bridge_helper_module.js @@ -0,0 +1,46 @@ +const addresses = require("../../utils/addresses"); +const { deploymentWithGovernanceProposal } = require("../../utils/deploy"); +const { isFork } = require("../../utils/hardhat-helpers"); +const { impersonateAndFund } = require("../../utils/signers"); + +module.exports = deploymentWithGovernanceProposal( + { + deployName: "178_bridge_helper_module", + forceDeploy: false, + reduceQueueTime: true, + deployerIsProposer: false, + proposalId: "", + }, + async ({ deployWithConfirmation, withConfirmation }) => { + const safeAddress = addresses.multichainStrategist; + + await deployWithConfirmation("EthereumBridgeHelperModule", [safeAddress]); + const cBridgeHelperModule = await ethers.getContract( + "EthereumBridgeHelperModule" + ); + + console.log( + `EthereumBridgeHelperModule (for ${safeAddress}) deployed to`, + cBridgeHelperModule.address + ); + + if (isFork) { + const safeSigner = await impersonateAndFund(safeAddress); + + const cSafe = await ethers.getContractAt( + ["function enableModule(address module) external"], + safeAddress + ); + + await withConfirmation( + cSafe.connect(safeSigner).enableModule(cBridgeHelperModule.address) + ); + + console.log("Enabled module on fork"); + } + + return { + actions: [], + }; + } +); From ffc516b347b13fc30e37320d8b27c777700e43d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Feb 2026 14:23:55 +0100 Subject: [PATCH 6/9] Fix Plume fork tests to use legacy mint/redeem signatures The deployed Plume vault won't be upgraded, so hardcode the old mint(address,uint256,uint256) selector in PlumeBridgeHelperModule and use a legacy ABI contract in fork tests for mint and redeem calls. --- .../automation/PlumeBridgeHelperModule.sol | 8 +++++++- contracts/test/_fixture-plume.js | 11 +++++++++++ .../test/vault/oethp-vault.plume.fork-test.js | 18 ++++++++++++------ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/contracts/contracts/automation/PlumeBridgeHelperModule.sol b/contracts/contracts/automation/PlumeBridgeHelperModule.sol index 0d8c181c5e..8257bede30 100644 --- a/contracts/contracts/automation/PlumeBridgeHelperModule.sol +++ b/contracts/contracts/automation/PlumeBridgeHelperModule.sol @@ -229,10 +229,16 @@ contract PlumeBridgeHelperModule is require(success, "Failed to approve WETH"); // Mint OETHp with WETH + // mint(address,uint256,uint256) was removed from IVault; use hardcoded selector success = safeContract.execTransactionFromModule( address(vault), 0, // Value - abi.encodeWithSelector(vault.mint.selector, wethAmount), + abi.encodeWithSelector( + bytes4(keccak256("mint(address,uint256,uint256)")), + address(weth), + wethAmount, + wethAmount + ), 0 // Call ); require(success, "Failed to mint OETHp"); diff --git a/contracts/test/_fixture-plume.js b/contracts/test/_fixture-plume.js index ece30ef133..cde954fbd9 100644 --- a/contracts/test/_fixture-plume.js +++ b/contracts/test/_fixture-plume.js @@ -80,6 +80,16 @@ const defaultFixture = async () => { oethpVaultProxy.address ); + // Plume vault uses deprecated mint/redeem signatures (won't be upgraded) + const oethpVaultLegacy = new ethers.Contract( + oethpVaultProxy.address, + [ + "function mint(address _asset, uint256 _amount, uint256 _minimumOusdAmount) external", + "function redeem(uint256 _amount, uint256 _minimumUnitAmount) external", + ], + ethers.provider + ); + // Bridged wOETH const woethProxy = await ethers.getContract("BridgedWOETHProxy"); const woeth = await ethers.getContractAt("BridgedWOETH", woethProxy.address); @@ -178,6 +188,7 @@ const defaultFixture = async () => { oethp, wOETHp, oethpVault, + oethpVaultLegacy, roosterAmoStrategy, roosterOETHpWETHpool, // Bridged wOETH diff --git a/contracts/test/vault/oethp-vault.plume.fork-test.js b/contracts/test/vault/oethp-vault.plume.fork-test.js index f48c40c1fc..42090df6ae 100644 --- a/contracts/test/vault/oethp-vault.plume.fork-test.js +++ b/contracts/test/vault/oethp-vault.plume.fork-test.js @@ -15,10 +15,10 @@ describe("ForkTest: OETHp Vault", function () { }); async function _mint(signer, amount = oethUnits("1")) { - const { weth, oethpVault, _mintWETH } = fixture; + const { weth, oethpVault, oethpVaultLegacy, _mintWETH } = fixture; await _mintWETH(signer, amount); await weth.connect(signer).approve(oethpVault.address, amount); - await oethpVault.connect(signer).mint(amount); + await oethpVaultLegacy.connect(signer).mint(weth.address, amount, amount); } describe("Mint & Permissioned redeems", function () { @@ -28,9 +28,11 @@ describe("ForkTest: OETHp Vault", function () { }); it("Should not allow anyone else to mint", async () => { - const { nick, oethpVault } = fixture; + const { nick, weth, oethpVaultLegacy } = fixture; await expect( - oethpVault.connect(nick).mint(oethUnits("1")) + oethpVaultLegacy + .connect(nick) + .mint(weth.address, oethUnits("1"), oethUnits("1")) ).to.be.revertedWith("Caller is not the Strategist or Governor"); }); @@ -79,7 +81,9 @@ describe("ForkTest: OETHp Vault", function () { const userBalanceBefore = await oethp.balanceOf(strategist.address); const totalSupplyBefore = await oethp.totalSupply(); - await oethpVault.connect(strategist).redeem(oethUnits("1"), "0"); + await fixture.oethpVaultLegacy + .connect(strategist) + .redeem(oethUnits("1"), "0"); const vaultBalanceAfter = await weth.balanceOf(oethpVault.address); const userBalanceAfter = await oethp.balanceOf(strategist.address); @@ -111,7 +115,9 @@ describe("ForkTest: OETHp Vault", function () { const userBalanceBefore = await oethp.balanceOf(governor.address); const totalSupplyBefore = await oethp.totalSupply(); - await oethpVault.connect(governor).redeem(oethUnits("1"), "0"); + await fixture.oethpVaultLegacy + .connect(governor) + .redeem(oethUnits("1"), "0"); const vaultBalanceAfter = await weth.balanceOf(oethpVault.address); const userBalanceAfter = await oethp.balanceOf(governor.address); From 1580e9f9666d8c1224d7c20c395c194243a90de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Feb 2026 14:48:12 +0100 Subject: [PATCH 7/9] Fix review issues: approve check, skipped tests, stale mock signatures - Add missing require(success) on wOETH approve in BaseBridgeHelperModule._depositWOETH - Un-skip Base bridge helper tests and rewrite for async withdrawal flow - Remove unused _asset param from MockNonRebasing.mintOusd - Point MockRebornMinter.redeem() at requestWithdrawal instead of reverting --- .../automation/BaseBridgeHelperModule.sol | 1 + contracts/contracts/mocks/MockNonRebasing.sol | 6 +- .../contracts/mocks/MockRebornMinter.sol | 5 +- .../bridge-helper.base.fork-test.js | 65 ++++++++++++------- contracts/test/token/ousd.js | 24 ++----- 5 files changed, 50 insertions(+), 51 deletions(-) diff --git a/contracts/contracts/automation/BaseBridgeHelperModule.sol b/contracts/contracts/automation/BaseBridgeHelperModule.sol index e46801423c..d2f490c32a 100644 --- a/contracts/contracts/automation/BaseBridgeHelperModule.sol +++ b/contracts/contracts/automation/BaseBridgeHelperModule.sol @@ -153,6 +153,7 @@ contract BaseBridgeHelperModule is ), 0 // Call ); + require(success, "Failed to approve wOETH"); // Deposit to bridgedWOETH strategy success = safeContract.execTransactionFromModule( diff --git a/contracts/contracts/mocks/MockNonRebasing.sol b/contracts/contracts/mocks/MockNonRebasing.sol index 405dea3b3e..807f6bfd1e 100644 --- a/contracts/contracts/mocks/MockNonRebasing.sol +++ b/contracts/contracts/mocks/MockNonRebasing.sol @@ -38,11 +38,7 @@ contract MockNonRebasing { oUSD.approve(_spender, _addedValue); } - function mintOusd( - address _vaultContract, - address _asset, - uint256 _amount - ) public { + function mintOusd(address _vaultContract, uint256 _amount) public { IVault(_vaultContract).mint(_amount); } diff --git a/contracts/contracts/mocks/MockRebornMinter.sol b/contracts/contracts/mocks/MockRebornMinter.sol index 51d2297a70..d5dad1c86f 100644 --- a/contracts/contracts/mocks/MockRebornMinter.sol +++ b/contracts/contracts/mocks/MockRebornMinter.sol @@ -103,7 +103,10 @@ contract Reborner { } function redeem() public { - revert("Redeem no longer supported"); + log("We are attempting to request withdrawal.."); + address vault = sanctum.vault(); + IVault(vault).requestWithdrawal(1e18); + log("We are now requesting withdrawal.."); } function transfer() public { diff --git a/contracts/test/safe-modules/bridge-helper.base.fork-test.js b/contracts/test/safe-modules/bridge-helper.base.fork-test.js index 6d591724da..9de8552ed1 100644 --- a/contracts/test/safe-modules/bridge-helper.base.fork-test.js +++ b/contracts/test/safe-modules/bridge-helper.base.fork-test.js @@ -1,6 +1,6 @@ const { createFixtureLoader } = require("../_fixture"); const { bridgeHelperModuleFixture } = require("../_fixture-base"); -const { oethUnits } = require("../helpers"); +const { oethUnits, advanceTime } = require("../helpers"); const { expect } = require("chai"); const baseFixture = createFixtureLoader(bridgeHelperModuleFixture); @@ -41,25 +41,32 @@ describe("ForkTest: Bridge Helper Safe Module (Base)", function () { .bridgeWETHToEthereum(oethUnits("1")); }); - it.skip("Should deposit wOETH for OETHb and redeem it for WETH", async () => { + it("Should deposit wOETH for OETHb and async withdraw for WETH", async () => { const { nick, _mintWETH, oethbVault, woeth, weth, - oethb, minter, + governor, safeSigner, woethStrategy, bridgeHelperModule, } = fixture; // Make sure Vault has some WETH - _mintWETH(nick, "10000"); + await _mintWETH(nick, "10000"); await weth.connect(nick).approve(oethbVault.address, oethUnits("10000")); await oethbVault.connect(nick).mint(oethUnits("10000")); + // Ensure withdrawal claim delay is set + let delayPeriod = await oethbVault.withdrawalClaimDelay(); + if (delayPeriod == 0) { + await oethbVault.connect(governor).setWithdrawalClaimDelay(10 * 60); + delayPeriod = 10 * 60; + } + // Update oracle price await woethStrategy.updateWOETHOraclePrice(); await oethbVault.rebase(); @@ -70,7 +77,6 @@ describe("ForkTest: Bridge Helper Safe Module (Base)", function () { // Mint 1 wOETH await woeth.connect(minter).mint(safeSigner.address, woethAmount); - const supplyBefore = await oethb.totalSupply(); const wethBalanceBefore = await weth.balanceOf(safeSigner.address); const woethBalanceBefore = await woeth.balanceOf(safeSigner.address); @@ -81,35 +87,44 @@ describe("ForkTest: Bridge Helper Safe Module (Base)", function () { weth.address ); - // Deposit 1 wOETH for OETHb and redeem it for WETH - await bridgeHelperModule.connect(safeSigner).depositWOETH(oethUnits("1")); + // Get request ID before the call + const { nextWithdrawalIndex } = await oethbVault.withdrawalQueueMetadata(); - const supplyAfter = await oethb.totalSupply(); - const wethBalanceAfter = await weth.balanceOf(safeSigner.address); - const woethBalanceAfter = await woeth.balanceOf(safeSigner.address); - const woethStrategyBalanceAfter = await woeth.balanceOf( - woethStrategy.address - ); - const woethStrategyValueAfter = await woethStrategy.checkBalance( - weth.address - ); + // Deposit 1 wOETH and request async withdrawal + await bridgeHelperModule + .connect(safeSigner) + .depositWOETHAndRequestWithdrawal(woethAmount); - expect(supplyAfter).to.approxEqualTolerance( - supplyBefore.add(oethUnits("1")) + // wOETH should be transferred to strategy + expect(await woeth.balanceOf(safeSigner.address)).to.eq( + woethBalanceBefore.sub(woethAmount) ); - expect(wethBalanceAfter).to.approxEqualTolerance( - wethBalanceBefore.add(expectedWETH) - ); - expect(woethBalanceAfter).to.eq(woethBalanceBefore.sub(woethAmount)); - expect(woethStrategyBalanceAfter).to.eq( + expect(await woeth.balanceOf(woethStrategy.address)).to.eq( woethStrategyBalanceBefore.add(woethAmount) ); - expect(woethStrategyValueAfter).to.approxEqualTolerance( + expect(await woethStrategy.checkBalance(weth.address)).to.approxEqualTolerance( woethStrategyValueBefore.add(expectedWETH) ); + + // WETH shouldn't have changed yet (withdrawal is pending) + expect(await weth.balanceOf(safeSigner.address)).to.eq(wethBalanceBefore); + + // Advance time past the claim delay + await advanceTime(delayPeriod + 1); + + // Claim the withdrawal + await bridgeHelperModule + .connect(safeSigner) + .claimWithdrawal(nextWithdrawalIndex); + + // WETH should have increased by the expected amount + const wethBalanceAfter = await weth.balanceOf(safeSigner.address); + expect(wethBalanceAfter).to.approxEqualTolerance( + wethBalanceBefore.add(expectedWETH) + ); }); - it.skip("Should mint OETHb with WETH and redeem it for wOETH", async () => { + it("Should mint OETHb with WETH and redeem it for wOETH", async () => { const { _mintWETH, oethbVault, diff --git a/contracts/test/token/ousd.js b/contracts/test/token/ousd.js index 8ac1708298..a92719c961 100644 --- a/contracts/test/token/ousd.js +++ b/contracts/test/token/ousd.js @@ -731,11 +731,7 @@ describe("Token", function () { vault.address, usdcUnits("100") ); - const tx = await mockNonRebasing.mintOusd( - vault.address, - usdc.address, - usdcUnits("50") - ); + const tx = await mockNonRebasing.mintOusd(vault.address, usdcUnits("50")); await expect(tx) .to.emit(ousd, "AccountRebasingDisabled") .withArgs(mockNonRebasing.address); @@ -771,11 +767,7 @@ describe("Token", function () { vault.address, usdcUnits("100") ); - await mockNonRebasing.mintOusd( - vault.address, - usdc.address, - usdcUnits("50") - ); + await mockNonRebasing.mintOusd(vault.address, usdcUnits("50")); expect(await ousd.totalSupply()).to.equal( totalSupplyBefore.add(ousdUnits("50")) ); @@ -791,11 +783,7 @@ describe("Token", function () { (await ousd.creditsBalanceOf(await josh.getAddress()))[1] ).to.not.equal(contractCreditsBalanceOf[1]); // Mint again - await mockNonRebasing.mintOusd( - vault.address, - usdc.address, - usdcUnits("50") - ); + await mockNonRebasing.mintOusd(vault.address, usdcUnits("50")); expect(await ousd.totalSupply()).to.equal( // Note 200 additional from simulated yield totalSupplyBefore.add(ousdUnits("100")).add(ousdUnits("200")) @@ -829,11 +817,7 @@ describe("Token", function () { vault.address, usdcUnits("100") ); - await mockNonRebasing.mintOusd( - vault.address, - usdc.address, - usdcUnits("50") - ); + await mockNonRebasing.mintOusd(vault.address, usdcUnits("50")); await expect(await ousd.totalSupply()).to.equal( totalSupplyBefore.add(ousdUnits("50")) ); From c953571b9a000c922a9c18c51be357dfff883121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Feb 2026 14:53:33 +0100 Subject: [PATCH 8/9] Fix prettier formatting in bridge-helper base fork test --- contracts/test/safe-modules/bridge-helper.base.fork-test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/test/safe-modules/bridge-helper.base.fork-test.js b/contracts/test/safe-modules/bridge-helper.base.fork-test.js index 9de8552ed1..c54bd30b27 100644 --- a/contracts/test/safe-modules/bridge-helper.base.fork-test.js +++ b/contracts/test/safe-modules/bridge-helper.base.fork-test.js @@ -102,9 +102,9 @@ describe("ForkTest: Bridge Helper Safe Module (Base)", function () { expect(await woeth.balanceOf(woethStrategy.address)).to.eq( woethStrategyBalanceBefore.add(woethAmount) ); - expect(await woethStrategy.checkBalance(weth.address)).to.approxEqualTolerance( - woethStrategyValueBefore.add(expectedWETH) - ); + expect( + await woethStrategy.checkBalance(weth.address) + ).to.approxEqualTolerance(woethStrategyValueBefore.add(expectedWETH)); // WETH shouldn't have changed yet (withdrawal is pending) expect(await weth.balanceOf(safeSigner.address)).to.eq(wethBalanceBefore); From 23d20047d02947aaf658bb5758a854ea70c05dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Feb 2026 17:14:38 +0100 Subject: [PATCH 9/9] Add requestWithdrawal boolean to BaseBridgeHelperModule.depositWOETH --- .../automation/BaseBridgeHelperModule.sol | 26 ++++++------------- .../bridge-helper.base.fork-test.js | 2 +- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/contracts/contracts/automation/BaseBridgeHelperModule.sol b/contracts/contracts/automation/BaseBridgeHelperModule.sol index d2f490c32a..424134ae83 100644 --- a/contracts/contracts/automation/BaseBridgeHelperModule.sol +++ b/contracts/contracts/automation/BaseBridgeHelperModule.sol @@ -73,30 +73,20 @@ contract BaseBridgeHelperModule is /** * @dev Deposits wOETH into the bridgedWOETH strategy. * @param woethAmount Amount of wOETH to deposit. - * @return oethbAmount Amount of OETHb received. - */ - function depositWOETH(uint256 woethAmount) - external - onlyOperator - returns (uint256) - { - return _depositWOETH(woethAmount); - } - - /** - * @dev Deposits wOETH into the bridgedWOETH strategy and requests an - * async withdrawal of the resulting OETHb from the Vault. - * @param woethAmount Amount of wOETH to deposit. - * @return requestId The withdrawal request ID. - * @return oethbAmount Amount of OETHb queued for withdrawal. + * @param requestWithdrawal Whether to request an async withdrawal of the + * resulting OETHb from the Vault. + * @return requestId The withdrawal request ID (0 if not requested). + * @return oethbAmount Amount of OETHb received or queued for withdrawal. */ - function depositWOETHAndRequestWithdrawal(uint256 woethAmount) + function depositWOETH(uint256 woethAmount, bool requestWithdrawal) external onlyOperator returns (uint256 requestId, uint256 oethbAmount) { oethbAmount = _depositWOETH(woethAmount); - requestId = _requestWithdrawal(oethbAmount); + if (requestWithdrawal) { + requestId = _requestWithdrawal(oethbAmount); + } } /** diff --git a/contracts/test/safe-modules/bridge-helper.base.fork-test.js b/contracts/test/safe-modules/bridge-helper.base.fork-test.js index c54bd30b27..9770915aef 100644 --- a/contracts/test/safe-modules/bridge-helper.base.fork-test.js +++ b/contracts/test/safe-modules/bridge-helper.base.fork-test.js @@ -93,7 +93,7 @@ describe("ForkTest: Bridge Helper Safe Module (Base)", function () { // Deposit 1 wOETH and request async withdrawal await bridgeHelperModule .connect(safeSigner) - .depositWOETHAndRequestWithdrawal(woethAmount); + .depositWOETH(woethAmount, true); // wOETH should be transferred to strategy expect(await woeth.balanceOf(safeSigner.address)).to.eq(