From e7a32108fe0d764363aacbed203da006060f4dc3 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Tue, 4 Feb 2025 15:08:25 -0500 Subject: [PATCH] comment in addCallParameters to specify UR calling calldata vs. user calling calldata --- sdks/v4-sdk/src/PositionManager.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sdks/v4-sdk/src/PositionManager.ts b/sdks/v4-sdk/src/PositionManager.ts index 869fe305..255ba92e 100644 --- a/sdks/v4-sdk/src/PositionManager.ts +++ b/sdks/v4-sdk/src/PositionManager.ts @@ -227,8 +227,13 @@ export abstract class V4PositionManager { * Cases: * - if pool does not exist yet, encode initializePool * then, - * - if is mint, encode MINT_POSITION. If migrating, encode a SETTLE and SWEEP for both currencies. Else, encode a SETTLE_PAIR. If on a NATIVE pool, encode a SWEEP. + * - if is mint, encode MINT_POSITION. + * - If migrating into a native pool, encode an UNWRAP, SETTLE on the unwrapped currency and other currency, and a SWEEP on both currencies. + * - If migrating into a non-native pool, encode a SETTLE on both currencies and a SWEEP on both currencies. + * - when migrating, the recipient of the SWEEP is the recipient of the minted NFT. It is not the caller since that is the universal router. + * - If not migrating, encode a SETTLE_PAIR. If it is on a NATIVE pool, encode a SWEEP. * - else, encode INCREASE_LIQUIDITY and SETTLE_PAIR. If it is on a NATIVE pool, encode a SWEEP. + * - when not migrating, the recipient of the SWEEP is the caller of the transaction */ invariant(JSBI.greaterThan(position.liquidity, ZERO), ZERO_LIQUIDITY) @@ -293,14 +298,14 @@ export abstract class V4PositionManager { planner.addSettle(position.pool.currency0, false) planner.addSettle(position.pool.currency1, false) // sweep any leftover wrapped native that was not unwrapped - // recipient will be same as the v4 lp token recipient + // recipient will be same as the v4 lp token recipient since the msg.sender is the universal router planner.addSweep(position.pool.currency0.wrapped, options.recipient) planner.addSweep(position.pool.currency1, options.recipient) } else { // payer is v4 position manager planner.addSettle(position.pool.currency0, false) planner.addSettle(position.pool.currency1, false) - // recipient will be same as the v4 lp token recipient + // recipient will be same as the v4 lp token recipient since the msg.sender is the universal router planner.addSweep(position.pool.currency0, options.recipient) planner.addSweep(position.pool.currency1, options.recipient) }