prepare_uniswap_v3_rebalance
Automatically close a Uniswap V3 LP position and reopen it at a new tick range in a single multicall, with independent slippage tolerance for close and deposit phases.
Instructions
Build an unsigned Uniswap V3 LP rebalance transaction — moves a position from its current tick range to a new one in a single multicall. Composes (in order): decreaseLiquidity(100%) + collect + (optional) burn + mint(new range). The position's (token0, token1, fee) carry over; only the tick range changes. Slippage is independently applied to the close + re-deposit phases — the effective tolerance against the spot price is roughly 2× the input bps. The description block calls this out explicitly. v1 amount-source: the new mint's amount0Desired/amount1Desired are estimated from the position's expected burn amounts at current price; on-chain the actual mint pulls bounded by what was actually collected, with surplus refunded to the wallet by the NPM. Up to two ERC-20 approvals are chained ahead of the multicall (the mint phase still needs them — collect routes the tokens back to the wallet, then mint pulls them again via transferFrom). Hard-refuses on owner mismatch, mis-aligned new ticks, identical new range, or zero-liquidity position.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wallet | Yes | ||
| chain | No | ethereum | |
| tokenId | Yes | ERC-721 tokenId of the LP NFT to rebalance. Must be owned by `wallet`. Its (token0, token1, fee) are reused for the new mint — only the tick range changes. | |
| newTickLower | Yes | Lower tick of the NEW range. Must align to the position's fee-tier tickSpacing (100→1, 500→10, 3000→60, 10000→200) and be < newTickUpper. | |
| newTickUpper | Yes | ||
| burnOld | No | Whether to also burn the old NFT in the same multicall. Default true — the old position has zero liquidity after the close phase and a stub NFT serves no purpose. Set to false to keep the old tokenId alive (e.g. for off-chain bookkeeping). | |
| slippageBps | No | Slippage tolerance in bps applied INDEPENDENTLY to the close phase (decreaseLiquidity floor) and the re-deposit phase (mint floor). The effective tolerance against the spot price is roughly 2× this value. Default 50 bps; soft cap 100 bps requires acknowledgeHighSlippage. | |
| acknowledgeHighSlippage | No | ||
| deadlineSec | No | ||
| approvalCap | No | Cap on the ERC-20 approval preceding this action. Omit for "unlimited" (standard DeFi UX — fewer follow-up approvals). Pass "exact" to approve only what this action pulls. Pass a decimal string (e.g. "500") for a specific ceiling in the asset's human units; must be ≥ the action amount, otherwise the transaction would revert. |