NFT Position Manager

Wraps WarpX V3 liquidity positions in ERC721 NFTs, enabling transferable and composable LP positions.

Creating a New Position

struct MintParams {    address token0;    address token1;    uint24 fee;    int24 tickLower;    int24 tickUpper;    uint256 amount0Desired;    uint256 amount1Desired;    uint256 amount0Min;    uint256 amount1Min;    address recipient;    uint256 deadline;}function mint(MintParams calldata params) external payable returns (    uint256 tokenId,    uint128 liquidity,    uint256 amount0,    uint256 amount1)

Creates a new liquidity position as an NFT. The pool must already exist and be initialized.

Parameters:

Field
Description

token0

First token address

token1

Second token address

fee

Fee tier (100, 500, 3000, or 10000)

tickLower

Lower tick boundary

tickUpper

Upper tick boundary

amount0Desired

Desired amount of token0 to add

amount1Desired

Desired amount of token1 to add

amount0Min

Minimum token0 (slippage protection)

amount1Min

Minimum token1 (slippage protection)

recipient

NFT recipient address

deadline

Transaction expiry timestamp

Returns: tokenId, liquidity, actual amount0 and amount1 deposited

Example:

INonfungiblePositionManager.MintParams memory params = INonfungiblePositionManager.MintParams({    token0: USDC,    token1: WETH,    fee: 3000,    tickLower: -887220,    tickUpper: 887220,    amount0Desired: 1000e6,    // 1000 USDC    amount1Desired: 0.5e18,    // 0.5 WETH    amount0Min: 950e6,    amount1Min: 0.475e18,    recipient: msg.sender,    deadline: block.timestamp + 300});(uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1) = positionManager.mint(params);

Increasing Liquidity

Adds more liquidity to an existing position. Only the position owner can call this.

Example:


Decreasing Liquidity

Removes liquidity from a position. Withdrawn tokens are credited to the position and must be collected separately.

Example:


Collecting Fees & Tokens

Collects accumulated fees and tokens from decreased liquidity.

Example:


Burning a Position

Burns an NFT position. The position must have:

  • Zero liquidity remaining

  • All tokens and fees collected

Example:


Creating & Initializing Pools

Creates a new pool if it doesn't exist, and initializes it if needed. Useful for bundling with mint().

Example:


Querying Positions

Returns full details about a position NFT.

Example:


Events

IncreaseLiquidity

Emitted when liquidity is added to a position (including initial minting).

DecreaseLiquidity

Emitted when liquidity is removed from a position.

Collect

Emitted when fees or tokens are collected from a position.


ERC721 Compatibility

The Position Manager is a full ERC721 NFT contract, supporting:

  • transferFrom() - Transfer positions between addresses

  • approve() / setApprovalForAll() - Authorize operators

  • ownerOf() - Query position owner

  • tokenURI() - Get on-chain SVG metadata

Position NFTs can be traded, used as collateral, or integrated with NFT marketplaces.

Last updated