Data Structure

1. Pool

/// Main pool structure managing liquidity and operations for a token pair.
///
/// This struct represents a liquidity pool for two token types. It manages
/// liquidity across multiple bins, handles swaps, and tracks positions and rewards.
///
/// ## Type Parameters
/// - `CoinTypeA`: First token type in the pool
/// - `CoinTypeB`: Second token type in the pool
///
/// ## Fields
/// - `id`: Unique identifier for the pool
/// - `index`: Pool index for identification
/// - `v_parameters`: Variable parameters for dynamic fee calculation
/// - `active_id`: Current active bin ID representing market price
/// - `base_fee_rate`: Base fee rate for swaps
/// - `balance_a`: Balance of token A in the pool
/// - `balance_b`: Balance of token B in the pool
/// - `protocol_fee_a`: Accumulated protocol fees for token A
/// - `protocol_fee_b`: Accumulated protocol fees for token B
/// - `reward_manager`: Manager for reward distribution
/// - `bin_manager`: Manager for liquidity bins
/// - `position_manager`: Manager for liquidity positions
/// - `url`: Pool metadata URL
/// - `permissions`: Pool operation permissions
/// - `active_open_positions`: Number of open position operation, forbid swap when open position is not 0
public struct Pool<phantom CoinTypeA, phantom CoinTypeB> has key, store {
    id: UID,
    index: u64,
    v_parameters: VariableParameters,
    active_id: I32,
    base_fee_rate: u64,
    balance_a: Balance<CoinTypeA>,
    balance_b: Balance<CoinTypeB>,
    protocol_fee_a: u64,
    protocol_fee_b: u64,
    reward_manager: RewardManager,
    bin_manager: BinManager,
    position_manager: PositionManager,
    url: String,
    permissions: Permissions,
    active_open_positions: u64,
}

2. Position

3. Bin

4. Partner

Last updated