Component: cetus_clmm/position.move
Description
The position module manages liquidity positions within concentrated-liquidity pools. It implements dual-structure design with position NFTs representing ownership and PositionInfo containing computational data. The module provides to create, modify, close positions, and collect accumulated fees and rewards. Each position defines specific price ranges using lower- and upper-tick indexes within which the liquidity is concentrated. The position NFT can transfer between users, and it maintains its state data in the PositionManager.
Invariants
Position tick ranges must be valid —
lower < upper, both aligned totick_spacing, and within min/max tick boundaries.A position can be closed when it has no liquidity, unclaimed fees, or unclaimed rewards.
Fee and reward-accumulation calculation must remain accurate across all price movements.
Position liquidity must be tracked and synchronized with the corresponding ticks.
The growth calculation for fee and reward must use fixed-point math with 64-bit precision to ensure accuracy without overflow.
Access to critical functions is restricted through the
friendmodifier to ensure only the pool module can call them.
Test coverage
Cases covered
Position creation with various tick ranges
Liquidity addition and removal operations
Fee accumulation and collection mechanisms
Reward distribution and claiming functionality
Position-closure conditions
Tick-range validation
Growth-calculation precision for fee and reward
Position-state queries and updates
NFT metadata management for positions