@@ -47,6 +47,8 @@ contract LiquidityController_TestInit is CommonTest {
4747
4848 /// @notice Helper function to authorize a minter.
4949 function _authorizeMinter (address _minter ) internal {
50+ assumeNotForgeAddress (_minter);
51+ assumeNotZeroAddress (_minter);
5052 // Authorize the minter
5153 stdstore.target (address (liquidityController)).sig (liquidityController.minters.selector ).with_key (_minter)
5254 .checked_write (true );
@@ -114,13 +116,10 @@ contract LiquidityController_AuthorizeMinter_Test is LiquidityController_TestIni
114116/// @title LiquidityController_DeauthorizeMinter_Test
115117/// @notice Tests the `deauthorizeMinter` function of the `LiquidityController` contract.
116118contract LiquidityController_DeauthorizeMinter_Test is LiquidityController_TestInit {
117- using stdStorage for StdStorage;
118-
119119 /// @notice Tests that the deauthorizeMinter function can be called by the owner.
120120 function testFuzz_deauthorizeMinter_fromOwner_succeeds (address _minter ) public {
121121 // Set minter to authorized
122- stdstore.target (address (liquidityController)).sig (liquidityController.minters.selector ).with_key (_minter)
123- .checked_write (true );
122+ _authorizeMinter (_minter);
124123
125124 // Expect emit MinterDeauthorized event
126125 vm.expectEmit (address (liquidityController));
@@ -138,8 +137,7 @@ contract LiquidityController_DeauthorizeMinter_Test is LiquidityController_TestI
138137 vm.assume (_caller != IProxyAdmin (Predeploys.PROXY_ADMIN).owner ());
139138
140139 // Set minter to authorized
141- stdstore.target (address (liquidityController)).sig (liquidityController.minters.selector ).with_key (_minter)
142- .checked_write (true );
140+ _authorizeMinter (_minter);
143141
144142 // Call the deauthorizeMinter function with non-owner as the caller
145143 vm.prank (_caller);
@@ -154,11 +152,9 @@ contract LiquidityController_DeauthorizeMinter_Test is LiquidityController_TestI
154152/// @title LiquidityController_Mint_Test
155153/// @notice Tests the `mint` function of the `LiquidityController` contract.
156154contract LiquidityController_Mint_Test is LiquidityController_TestInit {
157- address authorizedMinter = makeAddr ("authorizedMinter " );
158-
159155 /// @notice Tests that the mint function can be called by an authorized minter.
160- function testFuzz_mint_fromAuthorizedMinter_succeeds (address _to , uint256 _amount ) public {
161- _authorizeMinter (authorizedMinter );
156+ function testFuzz_mint_fromAuthorizedMinter_succeeds (address _to , uint256 _amount , address _minter ) public {
157+ _authorizeMinter (_minter );
162158 vm.assume (_to != address (nativeAssetLiquidity));
163159 _amount = bound (_amount, 1 , address (nativeAssetLiquidity).balance);
164160
@@ -171,8 +167,8 @@ contract LiquidityController_Mint_Test is LiquidityController_TestInit {
171167 emit LiquidityWithdrawn (address (liquidityController), _amount);
172168 // Expect emit LiquidityMinted event
173169 vm.expectEmit (address (liquidityController));
174- emit LiquidityMinted (authorizedMinter , _to, _amount);
175- vm.prank (authorizedMinter );
170+ emit LiquidityMinted (_minter , _to, _amount);
171+ vm.prank (_minter );
176172 liquidityController.mint (_to, _amount);
177173
178174 // Assert recipient and NativeAssetLiquidity balances are updated correctly
@@ -198,15 +194,15 @@ contract LiquidityController_Mint_Test is LiquidityController_TestInit {
198194 }
199195
200196 /// @notice Tests that the mint function reverts when contract has insufficient balance.
201- function test_mint_insufficientBalance_fails () public {
202- _authorizeMinter (authorizedMinter );
197+ function test_mint_insufficientBalance_fails (address _minter ) public {
198+ _authorizeMinter (_minter );
203199 // Try to mint more than available balance
204200 uint256 contractBalance = address (nativeAssetLiquidity).balance;
205201 uint256 amount = bound (contractBalance, contractBalance + 1 , type (uint256 ).max);
206202 address to = makeAddr ("recipient " );
207203
208204 // Call the mint function with insufficient balance
209- vm.prank (authorizedMinter );
205+ vm.prank (_minter );
210206 // Should revert due to insufficient balance in NativeAssetLiquidity
211207 vm.expectRevert (NativeAssetLiquidity.NativeAssetLiquidity_InsufficientBalance.selector );
212208
@@ -221,36 +217,34 @@ contract LiquidityController_Mint_Test is LiquidityController_TestInit {
221217/// @title LiquidityController_Burn_Test
222218/// @notice Tests the `burn` function of the `LiquidityController` contract.
223219contract LiquidityController_Burn_Test is LiquidityController_TestInit {
224- address authorizedMinter = makeAddr ("authorizedMinter " );
225-
226220 /// @notice Tests that the burn function can be called by an authorized minter.
227- function testFuzz_burn_fromAuthorizedMinter_succeeds (uint256 _amount ) public {
228- _authorizeMinter (authorizedMinter );
221+ function testFuzz_burn_fromAuthorizedMinter_succeeds (uint256 _amount , address _minter ) public {
222+ _authorizeMinter (_minter );
229223 _amount = bound (_amount, 0 , address (nativeAssetLiquidity).balance);
230224
231225 // Deal the authorized minter with the amount to burn
232- vm.deal (authorizedMinter , _amount);
226+ vm.deal (_minter , _amount);
233227 uint256 nativeAssetBalanceBefore = address (nativeAssetLiquidity).balance;
234- uint256 minterBalanceBefore = authorizedMinter .balance;
228+ uint256 minterBalanceBefore = _minter .balance;
235229
236230 // Expect emit LiquidityDeposited event and call the burn function
237231 vm.expectEmit (address (nativeAssetLiquidity));
238232 emit LiquidityDeposited (address (liquidityController), _amount);
239233 // Expect emit LiquidityBurned event
240234 vm.expectEmit (address (liquidityController));
241- emit LiquidityBurned (authorizedMinter , _amount);
242- vm.prank (authorizedMinter );
235+ emit LiquidityBurned (_minter , _amount);
236+ vm.prank (_minter );
243237 liquidityController.burn { value: _amount }();
244238
245239 // Assert minter and NativeAssetLiquidity balances are updated correctly
246- assertEq (authorizedMinter .balance, minterBalanceBefore - _amount);
240+ assertEq (_minter .balance, minterBalanceBefore - _amount);
247241 assertEq (address (nativeAssetLiquidity).balance, nativeAssetBalanceBefore + _amount);
248242 }
249243
250244 /// @notice Tests that the burn function reverts when called by unauthorized address.
251- function testFuzz_burn_fromUnauthorizedCaller_fails (address _caller , uint256 _amount ) public {
252- _authorizeMinter (authorizedMinter );
253- vm.assume (_caller != authorizedMinter );
245+ function testFuzz_burn_fromUnauthorizedCaller_fails (address _caller , uint256 _amount , address _minter ) public {
246+ _authorizeMinter (_minter );
247+ vm.assume (_caller != _minter );
254248 _amount = bound (_amount, 0 , address (nativeAssetLiquidity).balance);
255249
256250 // Deal the unauthorized caller with the amount to burn
0 commit comments