2
2
pragma solidity ^ 0.8.24 ;
3
3
4
4
import {Test, console2} from "forge-std/Test.sol " ;
5
- import {RollupOrders, Input, Output, OrderOrigin} from "../src/Orders.sol " ;
5
+ import {RollupOrders, Input, Output, OrderOrigin, Permit } from "../src/Orders.sol " ;
6
6
import {TestERC20} from "./Helpers.t.sol " ;
7
7
import {ERC20 } from "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol " ;
8
8
@@ -50,7 +50,7 @@ contract OrdersTest is Test {
50
50
vm.expectCall (
51
51
token, abi.encodeWithSelector (ERC20 .transferFrom.selector , address (this ), address (target), amount)
52
52
);
53
- target.initiate (deadline, inputs, outputs);
53
+ target.initiate (deadline, inputs, outputs, new Permit []( 0 ) );
54
54
}
55
55
56
56
// input ETH
@@ -61,7 +61,7 @@ contract OrdersTest is Test {
61
61
// expect Order event is initiated
62
62
vm.expectEmit ();
63
63
emit Order (deadline, inputs, outputs);
64
- target.initiate {value: amount}(deadline, inputs, outputs);
64
+ target.initiate {value: amount}(deadline, inputs, outputs, new Permit []( 0 ) );
65
65
66
66
// ETH is held in target contract
67
67
assertEq (address (target).balance, amount);
@@ -78,7 +78,7 @@ contract OrdersTest is Test {
78
78
vm.expectCall (
79
79
token, abi.encodeWithSelector (ERC20 .transferFrom.selector , address (this ), address (target), amount)
80
80
);
81
- target.initiate {value: amount}(deadline, inputs, outputs);
81
+ target.initiate {value: amount}(deadline, inputs, outputs, new Permit []( 0 ) );
82
82
83
83
// ETH is held in target contract
84
84
assertEq (address (target).balance, amount);
@@ -103,7 +103,7 @@ contract OrdersTest is Test {
103
103
vm.expectCall (
104
104
token2, abi.encodeWithSelector (ERC20 .transferFrom.selector , address (this ), address (target), amount * 2 )
105
105
);
106
- target.initiate (deadline, inputs, outputs);
106
+ target.initiate (deadline, inputs, outputs, new Permit []( 0 ) );
107
107
}
108
108
109
109
// input multiple ETH inputs
@@ -116,7 +116,7 @@ contract OrdersTest is Test {
116
116
// expect Order event is initiated
117
117
vm.expectEmit ();
118
118
emit Order (deadline, inputs, outputs);
119
- target.initiate {value: amount * 3 }(deadline, inputs, outputs);
119
+ target.initiate {value: amount * 3 }(deadline, inputs, outputs, new Permit []( 0 ) );
120
120
121
121
// ETH is held in target contract
122
122
assertEq (address (target).balance, amount * 3 );
@@ -130,14 +130,14 @@ contract OrdersTest is Test {
130
130
131
131
// total ETH inputs should be amount + 1; function should underflow only sending amount
132
132
vm.expectRevert ();
133
- target.initiate {value: amount}(deadline, inputs, outputs);
133
+ target.initiate {value: amount}(deadline, inputs, outputs, new Permit []( 0 ) );
134
134
}
135
135
136
136
function test_orderExpired () public {
137
137
vm.warp (block .timestamp + 1 );
138
138
139
139
vm.expectRevert (OrderOrigin.OrderExpired.selector );
140
- target.initiate (deadline, inputs, outputs);
140
+ target.initiate (deadline, inputs, outputs, new Permit []( 0 ) );
141
141
}
142
142
143
143
function test_sweepETH () public {
@@ -146,7 +146,7 @@ contract OrdersTest is Test {
146
146
147
147
// initiate an ETH order
148
148
inputs[0 ].token = address (0 );
149
- target.initiate {value: amount}(deadline, inputs, outputs);
149
+ target.initiate {value: amount}(deadline, inputs, outputs, new Permit []( 0 ) );
150
150
151
151
assertEq (address (target).balance, amount);
152
152
@@ -182,7 +182,7 @@ contract OrdersTest is Test {
182
182
183
183
vm.expectEmit ();
184
184
emit Filled (outputs);
185
- target.fill {value: amount}(outputs);
185
+ target.fill {value: amount}(outputs, new Permit []( 0 ) );
186
186
187
187
// ETH is transferred to recipient
188
188
assertEq (recipient.balance, amount);
@@ -192,7 +192,7 @@ contract OrdersTest is Test {
192
192
vm.expectEmit ();
193
193
emit Filled (outputs);
194
194
vm.expectCall (token, abi.encodeWithSelector (ERC20 .transferFrom.selector , address (this ), recipient, amount));
195
- target.fill (outputs);
195
+ target.fill (outputs, new Permit []( 0 ) );
196
196
}
197
197
198
198
function test_fill_both () public {
@@ -203,7 +203,7 @@ contract OrdersTest is Test {
203
203
vm.expectEmit ();
204
204
emit Filled (outputs);
205
205
vm.expectCall (token, abi.encodeWithSelector (ERC20 .transferFrom.selector , address (this ), recipient, amount));
206
- target.fill {value: amount * 2 }(outputs);
206
+ target.fill {value: amount * 2 }(outputs, new Permit []( 0 ) );
207
207
208
208
// ETH is transferred to recipient
209
209
assertEq (recipient.balance, amount * 2 );
@@ -219,7 +219,7 @@ contract OrdersTest is Test {
219
219
// expect Order event is initiated
220
220
vm.expectEmit ();
221
221
emit Filled (outputs);
222
- target.fill {value: amount * 3 }(outputs);
222
+ target.fill {value: amount * 3 }(outputs, new Permit []( 0 ) );
223
223
224
224
// ETH is transferred to recipient
225
225
assertEq (recipient.balance, amount * 3 );
@@ -233,6 +233,6 @@ contract OrdersTest is Test {
233
233
234
234
// total ETH outputs should be `amount` + 1; function should underflow only sending `amount`
235
235
vm.expectRevert ();
236
- target.fill {value: amount}(outputs);
236
+ target.fill {value: amount}(outputs, new Permit []( 0 ) );
237
237
}
238
238
}
0 commit comments