@@ -177,60 +177,3 @@ contract OrdersTest is Test {
177
177
target.sweep (recipient, token);
178
178
}
179
179
}
180
-
181
- contract OrdersFuzzTest is Test {
182
- RollupOrders public target;
183
- mapping (address => bool ) isToken;
184
-
185
- uint256 deadline = block .timestamp + 100 ;
186
-
187
- event OutputFilled (uint256 indexed originChainId , address indexed recipient , address indexed token , uint256 amount );
188
-
189
- event Order (uint256 deadline , Input[] inputs , Output[] outputs );
190
-
191
- event Sweep (address indexed recipient , address indexed token , uint256 amount );
192
-
193
- function setUp () public {
194
- target = new RollupOrders ();
195
-
196
- // deploy ERC20 tokens
197
- for (uint256 i; i < 15 ; i++ ) {
198
- address token = address (new TestERC20 ("hi " , "HI " ));
199
- isToken[token] = true ;
200
- }
201
- }
202
-
203
- function testFuzz_initiate (Input[] memory fuzzInputs , Output[] memory fuzzOutputs ) public {
204
- // can only use vm.assume 256 * 256 times, and we do 256 fuzz runs
205
- vm.assume (fuzzInputs.length < 256 );
206
- // setup the fuzz test by ensuring ETH and ERC20 amounts are available
207
- uint256 totalETH;
208
- for (uint256 i; i < fuzzInputs.length ; i++ ) {
209
- if (fuzzInputs[i].token == address (0 )) {
210
- // tally up total ETH amount in the inputs
211
- totalETH += fuzzInputs[i].amount;
212
- continue ;
213
- }
214
-
215
- // ERC20 inputs must be one of the tokens we've deployed
216
- vm.assume (isToken[fuzzInputs[i].token]);
217
- // mint the token amount to ensure the address has it
218
- TestERC20 (fuzzInputs[i].token).mint (address (this ), fuzzInputs[i].amount);
219
- // approve the target to spend the total token amount
220
- TestERC20 (fuzzInputs[i].token).approve (address (target), type (uint256 ).max);
221
- // expect the token amount to be transferred
222
- vm.expectCall (
223
- fuzzInputs[i].token,
224
- abi.encodeWithSelector (
225
- ERC20 .transferFrom.selector , address (this ), address (target), fuzzInputs[i].amount
226
- )
227
- );
228
- }
229
- // deal the total ETH amount to ensure the address has it
230
- vm.deal (address (this ), address (this ).balance + totalETH);
231
-
232
- vm.expectEmit ();
233
- emit Order (deadline, fuzzInputs, fuzzOutputs);
234
- target.initiate {value: totalETH}(deadline, fuzzInputs, fuzzOutputs);
235
- }
236
- }
0 commit comments