@@ -99,16 +99,6 @@ contract MasterVault is Initializable, ERC4626Upgradeable, AccessControlUpgradea
9999 /// @param _subVault The subvault to set. Must be an ERC4626 vault with the same asset as this MasterVault.
100100 /// @param minSubVaultExchRateWad Minimum acceptable ratio (times 1e18) of new subvault shares to outstanding MasterVault shares after deposit.
101101 function setSubVault (IERC4626 _subVault , uint256 minSubVaultExchRateWad ) external onlyRole (VAULT_MANAGER_ROLE) {
102- _setSubVault (_subVault, minSubVaultExchRateWad);
103- }
104-
105- /// @notice Revokes the current subvault, moving all assets back to MasterVault
106- /// @param minAssetExchRateWad Minimum acceptable ratio (times 1e18) of assets received from subvault to outstanding MasterVault shares
107- function revokeSubVault (uint256 minAssetExchRateWad ) external onlyRole (VAULT_MANAGER_ROLE) {
108- _revokeSubVault (minAssetExchRateWad);
109- }
110-
111- function _setSubVault (IERC4626 _subVault , uint256 minSubVaultExchRateWad ) internal {
112102 IERC20 underlyingAsset = IERC20 (asset ());
113103 if (address (subVault) != address (0 )) revert SubVaultAlreadySet ();
114104 if (address (_subVault.asset ()) != address (underlyingAsset)) revert SubVaultAssetMismatch ();
@@ -124,7 +114,9 @@ contract MasterVault is Initializable, ERC4626Upgradeable, AccessControlUpgradea
124114 emit SubvaultChanged (address (0 ), address (_subVault));
125115 }
126116
127- function _revokeSubVault (uint256 minAssetExchRateWad ) internal {
117+ /// @notice Revokes the current subvault, moving all assets back to MasterVault
118+ /// @param minAssetExchRateWad Minimum acceptable ratio (times 1e18) of assets received from subvault to outstanding MasterVault shares
119+ function revokeSubVault (uint256 minAssetExchRateWad ) external onlyRole (VAULT_MANAGER_ROLE) {
128120 IERC4626 oldSubVault = subVault;
129121 if (address (oldSubVault) == address (0 )) revert NoExistingSubVault ();
130122
@@ -139,18 +131,6 @@ contract MasterVault is Initializable, ERC4626Upgradeable, AccessControlUpgradea
139131 emit SubvaultChanged (address (oldSubVault), address (0 ));
140132 }
141133
142- /// @notice Switches to a new subvault or revokes current subvault if newSubVault is zero address
143- /// @param newSubVault The new subvault to switch to, or zero address to revoke current subvault
144- /// @param minAssetExchRateWad Minimum acceptable ratio (times 1e18) of assets received from old subvault to outstanding MasterVault shares
145- /// @param minNewSubVaultExchRateWad Minimum acceptable ratio (times 1e18) of new subvault shares to outstanding MasterVault shares after deposit
146- function switchSubVault (IERC4626 newSubVault , uint256 minAssetExchRateWad , uint256 minNewSubVaultExchRateWad ) external onlyRole (VAULT_MANAGER_ROLE) {
147- _revokeSubVault (minAssetExchRateWad);
148-
149- if (address (newSubVault) != address (0 )) {
150- _setSubVault (newSubVault, minNewSubVaultExchRateWad);
151- }
152- }
153-
154134 function masterSharesToSubShares (uint256 masterShares , MathUpgradeable.Rounding rounding ) public view returns (uint256 ) {
155135 // masterShares * totalSubVaultShares / totalMasterShares
156136 return masterShares.mulDiv (subVault.balanceOf (address (this )), totalSupply (), rounding);
0 commit comments