Skip to content

Commit 9f9c42e

Browse files
committed
refactor: streamline test cases in TrailsRouterTest for getSender() calls
- Consolidated multiple instances of the getSender() call setup in the TrailsRouterTest contract to improve readability and maintainability. - Adjusted formatting for consistency across test cases while preserving functionality.
1 parent 7a09716 commit 9f9c42e

File tree

1 file changed

+17
-68
lines changed

1 file changed

+17
-68
lines changed

test/TrailsRouter.t.sol

Lines changed: 17 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,7 @@ contract TrailsRouterTest is Test {
230230

231231
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
232232
calls[0] = IMulticall3.Call3Value({
233-
target: address(getter),
234-
allowFailure: false,
235-
value: 0,
236-
callData: abi.encodeWithSignature("getSender()")
233+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
237234
});
238235

239236
vm.prank(eoa);
@@ -244,10 +241,7 @@ contract TrailsRouterTest is Test {
244241
function test_Execute_FromContract_ShouldPreserveContractAsSender() public {
245242
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
246243
calls[0] = IMulticall3.Call3Value({
247-
target: address(getter),
248-
allowFailure: false,
249-
value: 0,
250-
callData: abi.encodeWithSignature("getSender()")
244+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
251245
});
252246

253247
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -257,16 +251,10 @@ contract TrailsRouterTest is Test {
257251
function test_Execute_WithMultipleCalls() public {
258252
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](2);
259253
calls[0] = IMulticall3.Call3Value({
260-
target: address(getter),
261-
allowFailure: false,
262-
value: 0,
263-
callData: abi.encodeWithSignature("getSender()")
254+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
264255
});
265256
calls[1] = IMulticall3.Call3Value({
266-
target: address(getter),
267-
allowFailure: false,
268-
value: 0,
269-
callData: abi.encodeWithSignature("getSender()")
257+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
270258
});
271259

272260
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -281,10 +269,7 @@ contract TrailsRouterTest is Test {
281269

282270
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
283271
calls[0] = IMulticall3.Call3Value({
284-
target: address(getter),
285-
allowFailure: false,
286-
value: 0,
287-
callData: abi.encodeWithSignature("getSender()")
272+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
288273
});
289274

290275
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -301,10 +286,7 @@ contract TrailsRouterTest is Test {
301286

302287
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
303288
calls[0] = IMulticall3.Call3Value({
304-
target: address(getter),
305-
allowFailure: false,
306-
value: 0,
307-
callData: abi.encodeWithSignature("getSender()")
289+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
308290
});
309291

310292
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -324,10 +306,7 @@ contract TrailsRouterTest is Test {
324306

325307
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
326308
calls[0] = IMulticall3.Call3Value({
327-
target: address(getter),
328-
allowFailure: false,
329-
value: 0,
330-
callData: abi.encodeWithSignature("getSender()")
309+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
331310
});
332311

333312
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -344,10 +323,7 @@ contract TrailsRouterTest is Test {
344323

345324
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
346325
calls[0] = IMulticall3.Call3Value({
347-
target: address(getter),
348-
allowFailure: false,
349-
value: 0,
350-
callData: abi.encodeWithSignature("getSender()")
326+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
351327
});
352328

353329
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -673,10 +649,7 @@ contract TrailsRouterTest is Test {
673649
// Use a valid aggregate3Value call so selector validation passes and we hit NoTokensToPull
674650
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
675651
calls[0] = IMulticall3.Call3Value({
676-
target: address(getter),
677-
allowFailure: false,
678-
value: 0,
679-
callData: abi.encodeWithSignature("getSender()")
652+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
680653
});
681654
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
682655

@@ -741,10 +714,7 @@ contract TrailsRouterTest is Test {
741714

742715
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
743716
calls[0] = IMulticall3.Call3Value({
744-
target: address(getter),
745-
allowFailure: false,
746-
value: 0,
747-
callData: abi.encodeWithSignature("getSender()")
717+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
748718
});
749719

750720
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -759,10 +729,7 @@ contract TrailsRouterTest is Test {
759729
function test_pullAndExecute_WithETH_NoEthSent() public {
760730
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
761731
calls[0] = IMulticall3.Call3Value({
762-
target: address(getter),
763-
allowFailure: false,
764-
value: 0,
765-
callData: abi.encodeWithSignature("getSender()")
732+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
766733
});
767734

768735
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -778,10 +745,7 @@ contract TrailsRouterTest is Test {
778745

779746
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
780747
calls[0] = IMulticall3.Call3Value({
781-
target: address(getter),
782-
allowFailure: false,
783-
value: 0,
784-
callData: abi.encodeWithSignature("getSender()")
748+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
785749
});
786750

787751
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -799,10 +763,7 @@ contract TrailsRouterTest is Test {
799763

800764
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
801765
calls[0] = IMulticall3.Call3Value({
802-
target: address(getter),
803-
allowFailure: false,
804-
value: 0,
805-
callData: abi.encodeWithSignature("getSender()")
766+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
806767
});
807768

808769
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -820,10 +781,7 @@ contract TrailsRouterTest is Test {
820781

821782
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
822783
calls[0] = IMulticall3.Call3Value({
823-
target: address(getter),
824-
allowFailure: false,
825-
value: 0,
826-
callData: abi.encodeWithSignature("getSender()")
784+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
827785
});
828786

829787
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -852,10 +810,7 @@ contract TrailsRouterTest is Test {
852810

853811
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
854812
calls[0] = IMulticall3.Call3Value({
855-
target: address(getter),
856-
allowFailure: false,
857-
value: 0,
858-
callData: abi.encodeWithSignature("getSender()")
813+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
859814
});
860815

861816
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -887,10 +842,7 @@ contract TrailsRouterTest is Test {
887842

888843
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
889844
calls[0] = IMulticall3.Call3Value({
890-
target: address(getter),
891-
allowFailure: false,
892-
value: 0,
893-
callData: abi.encodeWithSignature("getSender()")
845+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
894846
});
895847

896848
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);
@@ -1210,10 +1162,7 @@ contract TrailsRouterTest is Test {
12101162

12111163
IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](1);
12121164
calls[0] = IMulticall3.Call3Value({
1213-
target: address(getter),
1214-
allowFailure: false,
1215-
value: 0,
1216-
callData: abi.encodeWithSignature("getSender()")
1165+
target: address(getter), allowFailure: false, value: 0, callData: abi.encodeWithSignature("getSender()")
12171166
});
12181167

12191168
bytes memory callData = abi.encodeWithSignature("aggregate3Value((address,bool,uint256,bytes)[])", calls);

0 commit comments

Comments
 (0)