@@ -9,10 +9,8 @@ import "src/test/utils/EigenLayerUnitTestSetup.sol";
99import "../../contracts/permissions/PauserRegistry.sol " ;
1010
1111/**
12- * @notice Unit testing of the AVSDirectory contract. An AVSs' service manager contract will
13- * call this to register an operator with the AVS.
14- * Contracts tested: AVSDirectory
15- * Contracts not mocked: DelegationManager
12+ * @notice Unit testing of the StrategyFactory contract.
13+ * Contracts tested: StrategyFactory
1614 */
1715contract StrategyFactoryUnitTests is EigenLayerUnitTestSetup {
1816 // Contract under test
@@ -141,23 +139,14 @@ contract StrategyFactoryUnitTests is EigenLayerUnitTestSetup {
141139 }
142140
143141 function test_whitelistStrategies () public {
144- StrategyBase strategy = StrategyBase (
145- address (
146- new TransparentUpgradeableProxy (
147- address (strategyImplementation),
148- address (eigenLayerProxyAdmin),
149- abi.encodeWithSelector (StrategyBase.initialize.selector , underlyingToken, pauserRegistry)
150- )
151- )
152- );
153-
154-
142+ StrategyBase strategy = _deployStrategy ();
155143 IStrategy[] memory strategiesToWhitelist = new IStrategy [](1 );
156144 bool [] memory thirdPartyTransfersForbiddenValues = new bool [](1 );
157145 strategiesToWhitelist[0 ] = strategy;
158146 thirdPartyTransfersForbiddenValues[0 ] = true ;
159147 strategyFactory.whitelistStrategies (strategiesToWhitelist, thirdPartyTransfersForbiddenValues);
160148
149+ assertTrue (strategyManagerMock.strategyIsWhitelistedForDeposit (strategy), "Strategy not whitelisted " );
161150 require (strategyManagerMock.thirdPartyTransfersForbidden (strategy), "3rd party transfers forbidden not set correctly " );
162151 }
163152
@@ -169,4 +158,49 @@ contract StrategyFactoryUnitTests is EigenLayerUnitTestSetup {
169158 cheats.prank (notOwner);
170159 strategyFactory.whitelistStrategies (strategiesToWhitelist, thirdPartyTransfersForbiddenValues);
171160 }
161+
162+ function test_setThirdPartyTransfersForbidden_revert_notOwner () public {
163+ IStrategy strategy;
164+
165+ cheats.expectRevert ("Ownable: caller is not the owner " );
166+ cheats.prank (notOwner);
167+ strategyFactory.setThirdPartyTransfersForbidden (strategy, true );
168+ }
169+
170+ function test_setThirdPartyTransfersFrobidden () public {
171+ StrategyBase strategy = _deployStrategy ();
172+ bool thirdPartyTransfersForbidden = true ;
173+
174+ strategyFactory.setThirdPartyTransfersForbidden (strategy, thirdPartyTransfersForbidden);
175+ assertTrue (strategyManagerMock.thirdPartyTransfersForbidden (strategy), "3rd party transfers forbidden not set " );
176+ }
177+
178+ function test_removeStrategiesFromWhitelist_revert_notOwner () public {
179+ IStrategy[] memory strategiesToRemove = new IStrategy [](1 );
180+
181+ cheats.expectRevert ("Ownable: caller is not the owner " );
182+ cheats.prank (notOwner);
183+ strategyFactory.removeStrategiesFromWhitelist (strategiesToRemove);
184+ }
185+
186+ function test_removeStrategiesFromWhitelist () public {
187+ IStrategy[] memory strategiesToRemove = new IStrategy [](1 );
188+ strategiesToRemove[0 ] = IStrategy (_deployStrategy ());
189+
190+ strategyFactory.removeStrategiesFromWhitelist (strategiesToRemove);
191+ assertFalse (strategyManagerMock.strategyIsWhitelistedForDeposit (strategiesToRemove[0 ]), "Strategy not removed from whitelist " );
192+ }
193+
194+
195+ function _deployStrategy () internal returns (StrategyBase) {
196+ return StrategyBase (
197+ address (
198+ new TransparentUpgradeableProxy (
199+ address (strategyImplementation),
200+ address (eigenLayerProxyAdmin),
201+ abi.encodeWithSelector (StrategyBase.initialize.selector , underlyingToken, pauserRegistry)
202+ )
203+ )
204+ );
205+ }
172206}
0 commit comments