Position Module
Manages user liquidity positions and fee tracking
Structs
LBPosition
struct LBPosition has key, store {
id: UID,
pair_id: ID,
coin_type_a: TypeName,
coin_type_b: TypeName,
lock_until: u64,
}
Purpose: NFT representing liquidity position
LBPositionManager
struct LBPositionManager has store {
positions: Table<ID, LBPositionInfo>,
}
Purpose: Manages all position data
LBPositionInfo
struct LBPositionInfo has store {
position_id: ID,
bins: Table<u32, LBBinPosition>,
fee_reward_info: FeeRewardInfo,
}
Purpose: Detailed position data
LBBinPosition
struct LBBinPosition has copy, drop, store {
amount: u128,
fee_growth_inside_last_x: u128,
fee_growth_inside_last_y: u128,
}
Purpose: Position data for specific price bin
FeeRewardInfo
struct FeeRewardInfo has store {
total_fees_generated: u128,
reward_per_fee_snapshot: vector<u128>,
}
Purpose: Fee generation and reward tracking
Core Functions
Position Lifecycle
open_position
: Create new position NFTclose_position
: Destroy empty positionlock_position
: Apply time lockis_position_locked
: Check lock status
Liquidity Operations
increase_liquidity
: Add liquidity to positiondecrease_liquidity
: Remove liquidity (respects locks)
Fee Management
collect_fees
: Harvest accumulated feesget_pending_fees
: View unclaimed feesupdate_fee_info
: Update fee tracking (internal)
Position Queries
position_token_amount
: Liquidity in specific binget_tokens_in_position
: All position liquidityhas_tokens_in_bins
: Check if position has liquidity
Last updated