@@ -20,6 +20,8 @@ contract V3UtilsIntegrationTest is IntegrationTestBase {
20
20
address (0 ),
21
21
0 ,
22
22
0 ,
23
+ 0 ,
24
+ 0 ,
23
25
"" ,
24
26
0 ,
25
27
0 ,
@@ -83,6 +85,54 @@ contract V3UtilsIntegrationTest is IntegrationTestBase {
83
85
address (USDC),
84
86
1000000000000000001 ,
85
87
400000 ,
88
+ 1000000000000000001 ,
89
+ 400000 ,
90
+ _get05DAIToUSDCSwapData (),
91
+ 0 ,
92
+ 0 ,
93
+ "" ,
94
+ type (uint128 ).max, // take all fees
95
+ type (uint128 ).max, // take all fees
96
+ 100 , // change fee as well
97
+ MIN_TICK_100,
98
+ - MIN_TICK_100,
99
+ liquidityBefore, // take all liquidity
100
+ 0 ,
101
+ 0 ,
102
+ block .timestamp ,
103
+ TEST_NFT_ACCOUNT,
104
+ TEST_NFT_ACCOUNT,
105
+ false ,
106
+ "" ,
107
+ ""
108
+ );
109
+
110
+ vm.prank (TEST_NFT_ACCOUNT);
111
+ vm.expectRevert ("Price slippage check " );
112
+ NPM.safeTransferFrom (
113
+ TEST_NFT_ACCOUNT,
114
+ address (v3utils),
115
+ TEST_NFT,
116
+ abi.encode (inst)
117
+ );
118
+ }
119
+
120
+ function testTransferAmountError () external {
121
+ // add liquidity to existing (empty) position (add 1 DAI / 0 USDC)
122
+ _increaseLiquidity ();
123
+
124
+ (, , , , , , , uint128 liquidityBefore , , , , ) = NPM.positions (
125
+ TEST_NFT
126
+ );
127
+
128
+ // swap a bit more dai than available - fails with slippage error because not enough liquidity + fees is collected
129
+ V3Utils.Instructions memory inst = V3Utils.Instructions (
130
+ V3Utils.WhatToDo.CHANGE_RANGE,
131
+ address (USDC),
132
+ 0 ,
133
+ 0 ,
134
+ 1000000000000000001 ,
135
+ 400000 ,
86
136
_get05DAIToUSDCSwapData (),
87
137
0 ,
88
138
0 ,
@@ -127,6 +177,8 @@ contract V3UtilsIntegrationTest is IntegrationTestBase {
127
177
V3Utils.Instructions memory inst = V3Utils.Instructions (
128
178
V3Utils.WhatToDo.CHANGE_RANGE,
129
179
address (USDC),
180
+ 0 ,
181
+ 0 ,
130
182
500000000000000000 ,
131
183
400000 ,
132
184
_get05DAIToUSDCSwapData (),
@@ -172,6 +224,8 @@ contract V3UtilsIntegrationTest is IntegrationTestBase {
172
224
address (0 ),
173
225
0 ,
174
226
0 ,
227
+ 0 ,
228
+ 0 ,
175
229
"" ,
176
230
0 ,
177
231
0 ,
@@ -225,6 +279,8 @@ contract V3UtilsIntegrationTest is IntegrationTestBase {
225
279
V3Utils.Instructions memory inst = V3Utils.Instructions (
226
280
V3Utils.WhatToDo.COMPOUND_FEES,
227
281
address (USDC),
282
+ 0 ,
283
+ 0 ,
228
284
500000000000000000 ,
229
285
400000 ,
230
286
_get05DAIToUSDCSwapData (),
@@ -286,6 +342,8 @@ contract V3UtilsIntegrationTest is IntegrationTestBase {
286
342
V3Utils.Instructions memory inst = V3Utils.Instructions (
287
343
V3Utils.WhatToDo.WITHDRAW_AND_COLLECT_AND_SWAP,
288
344
address (USDC),
345
+ 0 ,
346
+ 0 ,
289
347
990099009900989844 , // uniswap returns 1 less when getting liquidity - this must be traded
290
348
900000 ,
291
349
_get1DAIToUSDSwapData (),
@@ -347,6 +405,8 @@ contract V3UtilsIntegrationTest is IntegrationTestBase {
347
405
V3Utils.Instructions memory inst = V3Utils.Instructions (
348
406
V3Utils.WhatToDo.WITHDRAW_AND_COLLECT_AND_SWAP,
349
407
address (USDC),
408
+ 0 ,
409
+ 0 ,
350
410
990099009900989844 , // uniswap returns 1 less when getting liquidity - this must be traded
351
411
900000 ,
352
412
_get1DAIToUSDSwapData (),
0 commit comments