@@ -80,10 +80,9 @@ contract VestingTest is Test {
8080
8181 function test_deploy_emitVestingAndBeneficiariesInitialized () external {
8282 Vesting vestingImpl = new Vesting ();
83- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
8483 (Beneficiary[] memory beneficiaries , Schedule memory schedule ) = _getBeneficiariesAndSchedule ();
8584
86- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt );
85+ address vestingAddress = Clones.clone (address (vestingImpl));
8786
8887 vm.expectEmit (true , true , true , true );
8988 emit IERC20 .Transfer (distributor, vestingAddress, VESTING_TOTAL_AMOUNT);
@@ -97,7 +96,6 @@ contract VestingTest is Test {
9796 vm.expectEmit (true , true , true , true );
9897 emit IVesting.BeneficiariesInitialized (beneficiaries);
9998
100- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
10199 Vesting (vestingAddress).initialize (META, schedule, beneficiaries);
102100 }
103101
@@ -126,14 +124,11 @@ contract VestingTest is Test {
126124 schedule.startTime = invalidBlockTimestamp;
127125
128126 Vesting vestingImpl = new Vesting ();
129- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
130- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt);
127+ address vestingAddress = Clones.clone (address (vestingImpl));
131128
132129 vm.prank (distributor);
133130 META.transfer (vestingAddress, VESTING_TOTAL_AMOUNT);
134131
135- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
136-
137132 vm.warp (blockTimestamp);
138133 vm.expectRevert (IVesting.InvalidStartTime.selector );
139134
@@ -145,14 +140,11 @@ contract VestingTest is Test {
145140 IERC20 invalidBaseToken = IERC20 (address (0 ));
146141
147142 Vesting vestingImpl = new Vesting ();
148- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
149- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt);
143+ address vestingAddress = Clones.clone (address (vestingImpl));
150144
151145 vm.prank (distributor);
152146 META.transfer (vestingAddress, VESTING_TOTAL_AMOUNT);
153147
154- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
155-
156148 vm.expectRevert (IVesting.ZeroAddress.selector );
157149
158150 Vesting (vestingAddress).initialize (invalidBaseToken, schedule, beneficiaries);
@@ -164,14 +156,11 @@ contract VestingTest is Test {
164156 schedule.periods[0 ].portion = invalidPortion;
165157
166158 Vesting vestingImpl = new Vesting ();
167- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
168- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt);
159+ address vestingAddress = Clones.clone (address (vestingImpl));
169160
170161 vm.prank (distributor);
171162 META.transfer (vestingAddress, VESTING_TOTAL_AMOUNT);
172163
173- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
174-
175164 vm.expectRevert (IVesting.InvalidPortion.selector );
176165
177166 Vesting (vestingAddress).initialize (META, schedule, beneficiaries);
@@ -184,14 +173,11 @@ contract VestingTest is Test {
184173 schedule.periods[3 ].endTime = invalidPeriodTime;
185174
186175 Vesting vestingImpl = new Vesting ();
187- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
188- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt);
176+ address vestingAddress = Clones.clone (address (vestingImpl));
189177
190178 vm.prank (distributor);
191179 META.transfer (vestingAddress, VESTING_TOTAL_AMOUNT);
192180
193- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
194-
195181 vm.expectRevert (IVesting.IncorrectPeriodTime.selector );
196182
197183 Vesting (vestingAddress).initialize (META, schedule, beneficiaries);
@@ -203,14 +189,11 @@ contract VestingTest is Test {
203189 schedule.periods[3 ].portion = BASIS_POINTS;
204190
205191 Vesting vestingImpl = new Vesting ();
206- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
207- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt);
192+ address vestingAddress = Clones.clone (address (vestingImpl));
208193
209194 vm.prank (distributor);
210195 META.transfer (vestingAddress, VESTING_TOTAL_AMOUNT);
211196
212- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
213-
214197 vm.expectRevert (IVesting.IncorrectTotalPeriodPortions.selector );
215198
216199 Vesting (vestingAddress).initialize (META, schedule, beneficiaries);
@@ -220,14 +203,11 @@ contract VestingTest is Test {
220203 (, Schedule memory schedule ) = _getBeneficiariesAndSchedule ();
221204
222205 Vesting vestingImpl = new Vesting ();
223- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
224- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt);
206+ address vestingAddress = Clones.clone (address (vestingImpl));
225207
226208 vm.prank (distributor);
227209 META.transfer (vestingAddress, VESTING_TOTAL_AMOUNT);
228210
229- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
230-
231211 vm.expectRevert (IVesting.ZeroBeneficiaries.selector );
232212
233213 Vesting (vestingAddress).initialize (META, schedule, new Beneficiary [](0 ));
@@ -239,14 +219,11 @@ contract VestingTest is Test {
239219 beneficiaries[0 ].account = address (0 );
240220
241221 Vesting vestingImpl = new Vesting ();
242- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
243- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt);
222+ address vestingAddress = Clones.clone (address (vestingImpl));
244223
245224 vm.prank (distributor);
246225 META.transfer (vestingAddress, VESTING_TOTAL_AMOUNT);
247226
248- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
249-
250227 vm.expectRevert (IVesting.ZeroAddress.selector );
251228
252229 Vesting (vestingAddress).initialize (META, schedule, beneficiaries);
@@ -258,14 +235,11 @@ contract VestingTest is Test {
258235 beneficiaries[0 ].amount = 0 ;
259236
260237 Vesting vestingImpl = new Vesting ();
261- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
262- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt);
238+ address vestingAddress = Clones.clone (address (vestingImpl));
263239
264240 vm.prank (distributor);
265241 META.transfer (vestingAddress, VESTING_TOTAL_AMOUNT);
266242
267- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
268-
269243 vm.expectRevert (IVesting.ZeroAmount.selector );
270244
271245 Vesting (vestingAddress).initialize (META, schedule, beneficiaries);
@@ -277,14 +251,11 @@ contract VestingTest is Test {
277251 beneficiaries[0 ].account = beneficiaries[1 ].account;
278252
279253 Vesting vestingImpl = new Vesting ();
280- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
281- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt);
254+ address vestingAddress = Clones.clone (address (vestingImpl));
282255
283256 vm.prank (distributor);
284257 META.transfer (vestingAddress, VESTING_TOTAL_AMOUNT);
285258
286- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
287-
288259 vm.expectRevert (abi.encodeWithSelector (IVesting.DuplicateBeneficiary.selector , beneficiaries[0 ].account));
289260
290261 Vesting (vestingAddress).initialize (META, schedule, beneficiaries);
@@ -301,14 +272,11 @@ contract VestingTest is Test {
301272 vm.assume (invalidVestingAmount != VESTING_TOTAL_AMOUNT);
302273
303274 Vesting vestingImpl = new Vesting ();
304- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
305- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt);
275+ address vestingAddress = Clones.clone (address (vestingImpl));
306276
307277 vm.prank (distributor);
308278 META.transfer (vestingAddress, invalidVestingAmount);
309279
310- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
311-
312280 vm.expectRevert (IVesting.IncorrectAmountOfBeneficiaries.selector );
313281
314282 Vesting (vestingAddress).initialize (META, schedule, beneficiaries);
@@ -434,14 +402,12 @@ contract VestingTest is Test {
434402
435403 function _deployVesting (IERC20 baseToken , Beneficiary[] memory beneficiaries , Schedule memory schedule ) private returns (Vesting) {
436404 Vesting vestingImpl = new Vesting ();
437- bytes32 salt = keccak256 (abi.encodePacked (VestingType.TEAM, block .timestamp ));
438405
439- address vestingAddress = Clones.predictDeterministicAddress (address (vestingImpl), salt );
406+ address vestingAddress = Clones.clone (address (vestingImpl));
440407
441408 vm.prank (distributor);
442409 baseToken.transfer (vestingAddress, VESTING_TOTAL_AMOUNT);
443410
444- vestingAddress = Clones.cloneDeterministic (address (vestingImpl), salt);
445411 Vesting (vestingAddress).initialize (baseToken, schedule, beneficiaries);
446412
447413 return Vesting (vestingAddress);
0 commit comments