You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- reorder param structs statics-first (ABI change)
- inline _positionAmounts into the sweep step
- reject pools whose hook carries a returns-delta permission upfront
(UnsupportedHookPermissions) instead of documenting them only
- move the trim cap into getLiquidityToFree with a forward round-down
pre-check, making the previously documented far-edge overflow in the
inverse structurally unreachable
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
/// and are unsupported. Failures revert atomically; funds remain safe. Dynamic fee, gating, and oracle hooks are supported.
38
+
/// and are rejected upfront with `UnsupportedHookPermissions`. Dynamic fee, gating, and oracle hooks are supported.
38
39
/// - Known Limits: Fee-on-transfer and rebasing tokens are unsupported (atomic reverts or larger trim, never token loss).
39
40
/// Budgets within the pool's ~1-wei mint/burn rounding toll cannot settle and revert `InsufficientLiquidity`.
40
41
/// - HookData Reuse: The same `hookData` payload is passed to all hook callbacks in the operation; single-use
@@ -116,6 +117,9 @@ interface ISwapAndAdd is IMulticall_v4 {
116
117
/// @notice Thrown when a `routeFunding` token is one of the pool currencies (use `amount0In`/`amount1In` instead).
117
118
error InvalidFundingToken(Currency token);
118
119
120
+
/// @notice Thrown when the pool's hook carries a returns-delta permission (see the Unsupported Pools note).
121
+
error UnsupportedHookPermissions(IHooks hooks);
122
+
119
123
/// @notice Represents a non-pool token amount pulled to fund an off-chain route.
120
124
/// @param token The non-pool token address (or address(0) for native ETH).
121
125
/// @param amount The amount to pull from caller via Permit2 (or expected msg.value for native ETH). A zero amount pulls nothing but sweeps unlisted donations of that token.
@@ -130,24 +134,24 @@ interface ISwapAndAdd is IMulticall_v4 {
130
134
/// @param tickUpper Upper tick of the position range.
131
135
/// @param amount0In Amount of token0 budget to pull from caller (can be 0).
132
136
/// @param amount1In Amount of token1 budget to pull from caller (can be 0).
133
-
/// @param route Encoded Universal Router commands and inputs (empty for pure same-pool zap). Must scope input amounts explicitly (never spend entire contract balance).
134
-
/// @param routeFunding Optional non-pool tokens pulled to fund the route. Unused amounts are swept to `recipient`.
135
137
/// @param minLiquidity Minimum liquidity required for the minted position (slippage floor).
136
138
/// @param recipient Address that receives the minted position NFT and leftover dust.
137
-
/// @param hookData Arbitrary data passed to pool hooks (reused across all callbacks).
138
139
/// @param deadline Timestamp after which the transaction will revert.
140
+
/// @param route Encoded Universal Router commands and inputs (empty for pure same-pool zap). Must scope input amounts explicitly (never spend entire contract balance).
141
+
/// @param routeFunding Optional non-pool tokens pulled to fund the route. Unused amounts are swept to `recipient`.
142
+
/// @param hookData Arbitrary data passed to pool hooks (reused across all callbacks).
139
143
struct AddParams {
140
144
PoolKey poolKey;
141
145
int24 tickLower;
142
146
int24 tickUpper;
143
147
uint256 amount0In;
144
148
uint256 amount1In;
145
-
bytes route;
146
-
TokenAmount[] routeFunding;
147
149
uint256 minLiquidity;
148
150
address recipient;
149
-
bytes hookData;
150
151
uint256 deadline;
152
+
bytes route;
153
+
TokenAmount[] routeFunding;
154
+
bytes hookData;
151
155
}
152
156
153
157
/// @notice Create a new v4 position from a one- or two-sided token budget in a single transaction.
@@ -165,22 +169,22 @@ interface ISwapAndAdd is IMulticall_v4 {
165
169
/// @param tokenId Existing position ID to increase.
166
170
/// @param amount0In Amount of token0 budget to pull from caller (can be 0). Accrued fees are collected and reinvested automatically.
167
171
/// @param amount1In Amount of token1 budget to pull from caller (can be 0). Accrued fees are collected and reinvested automatically.
168
-
/// @param route Encoded Universal Router commands and inputs (can be empty).
169
-
/// @param routeFunding Optional non-pool tokens pulled to fund the route. Unused amounts are swept to `recipient`.
170
172
/// @param minLiquidityAdded Minimum liquidity that must be added to the position (slippage floor).
171
173
/// @param recipient Destination for swept dust. Forced to position owner if caller is an operator.
172
-
/// @param hookData Arbitrary data passed to pool hooks.
173
174
/// @param deadline Timestamp after which the transaction will revert.
175
+
/// @param route Encoded Universal Router commands and inputs (can be empty).
176
+
/// @param routeFunding Optional non-pool tokens pulled to fund the route. Unused amounts are swept to `recipient`.
177
+
/// @param hookData Arbitrary data passed to pool hooks.
174
178
struct IncreaseParams {
175
179
uint256 tokenId;
176
180
uint256 amount0In;
177
181
uint256 amount1In;
178
-
bytes route;
179
-
TokenAmount[] routeFunding;
180
182
uint256 minLiquidityAdded;
181
183
address recipient;
182
-
bytes hookData;
183
184
uint256 deadline;
185
+
bytes route;
186
+
TokenAmount[] routeFunding;
187
+
bytes hookData;
184
188
}
185
189
186
190
/// @notice Top up an existing position with a one- or two-sided budget and reinvest accrued fees in a single transaction.
@@ -200,24 +204,24 @@ interface ISwapAndAdd is IMulticall_v4 {
200
204
/// @param additional1 Signed delta for token1 with the same signed delta semantics.
201
205
/// @param newTickLower Lower tick of the new position range.
202
206
/// @param newTickUpper Upper tick of the new position range.
203
-
/// @param route Encoded Universal Router commands and inputs (can be empty).
204
-
/// @param routeFunding Optional non-pool tokens pulled to fund the route. Unused amounts are swept to `recipient`.
205
207
/// @param minLiquidity Minimum liquidity required for the newly minted position (slippage floor).
206
208
/// @param recipient Destination for the new position NFT, returned cash-out tokens, and dust. Forced to owner if caller is an operator.
207
-
/// @param hookData Arbitrary data passed to pool hooks.
208
209
/// @param deadline Timestamp after which the transaction will revert.
210
+
/// @param route Encoded Universal Router commands and inputs (can be empty).
211
+
/// @param routeFunding Optional non-pool tokens pulled to fund the route. Unused amounts are swept to `recipient`.
212
+
/// @param hookData Arbitrary data passed to pool hooks.
209
213
struct RebalanceParams {
210
214
uint256 tokenId;
211
215
int128 additional0;
212
216
int128 additional1;
213
217
int24 newTickLower;
214
218
int24 newTickUpper;
215
-
bytes route;
216
-
TokenAmount[] routeFunding;
217
219
uint256 minLiquidity;
218
220
address recipient;
219
-
bytes hookData;
220
221
uint256 deadline;
222
+
bytes route;
223
+
TokenAmount[] routeFunding;
224
+
bytes hookData;
221
225
}
222
226
223
227
/// @notice Withdraw an existing position entirely and redeploy it into a new tick range, optionally adding or cashing out tokens.
@@ -234,18 +238,18 @@ interface ISwapAndAdd is IMulticall_v4 {
234
238
235
239
/// @notice Parameters for `compound`.
236
240
/// @param tokenId Existing position ID whose accrued fees will be collected and reinvested.
237
-
/// @param route Encoded Universal Router commands and inputs (can be empty).
238
241
/// @param minLiquidityAdded Minimum liquidity that must be added from reinvested fees (slippage floor).
239
242
/// @param recipient Destination for swept dust. Forced to position owner if caller is an operator.
240
-
/// @param hookData Arbitrary data passed to pool hooks.
241
243
/// @param deadline Timestamp after which the transaction will revert.
244
+
/// @param route Encoded Universal Router commands and inputs (can be empty).
245
+
/// @param hookData Arbitrary data passed to pool hooks.
242
246
struct CompoundParams {
243
247
uint256 tokenId;
244
-
bytes route;
245
248
uint256 minLiquidityAdded;
246
249
address recipient;
247
-
bytes hookData;
248
250
uint256 deadline;
251
+
bytes route;
252
+
bytes hookData;
249
253
}
250
254
251
255
/// @notice Collect accrued fees on a position and reinvest them back into the same position in a single transaction.
0 commit comments