Non-fungible Position Manager
The Non-fungible Position Manager (NFPM) is an ERC-721 contract that represents liquidity positions as NFTs. It provides a user-friendly interface for creating, managing, and interacting with concentrated liquidity positions.Overview
Each liquidity position is represented as a unique NFT with metadata including token pair, fee tier, tick range, and liquidity amount.
Core Functions
mint
increaseLiquidity
decreaseLiquidity
collect
burn
Position Information
positions
Router Contract
The Router contract provides simplified interfaces for common operations like swaps and liquidity management.Swap Functions
exactInputSingle
exactInput
exactOutputSingle
exactOutput
Liquidity Management Functions
mint
increaseLiquidity
decreaseLiquidity
collect
Interfaces
INonfungiblePositionManager
ISwapRouter
Usage Examples
Creating a Position
Executing a Swap
Managing Positions
Best Practices
1
Always check position ownership
Verify you own the position before performing operations.
Use
positions(tokenId).operator to check ownership.2
Set appropriate deadlines
Use reasonable deadlines to prevent transaction failures.
3
Handle slippage properly
Set minimum amounts to protect against price movements.
Use the SDK to calculate expected amounts and set appropriate minimums.
4
Collect fees regularly
Collect accumulated fees to maximize returns.
Error Handling
Position Errors
Position Errors
NOT_AUTHORIZED: Caller is not authorized to manage the positionPOSITION_NOT_FOUND: Position does not existINSUFFICIENT_LIQUIDITY: Not enough liquidity to removeINVALID_TICK_RANGE: Tick range is invalid
Swap Errors
Swap Errors
EXCESSIVE_INPUT_AMOUNT: Input amount exceeds maximumINSUFFICIENT_OUTPUT_AMOUNT: Output amount below minimumEXPIRED: Transaction deadline has passedPRICE_LIMIT_EXCEEDED: Price limit exceeded during swap
Approval Errors
Approval Errors
INSUFFICIENT_ALLOWANCE: Token approval insufficientTRANSFER_FAILED: Token transfer failedINSUFFICIENT_BALANCE: Insufficient token balance