Collect Fee
You can directly collect position fee through the collect_position_fee method in the Cetus DLMM pool module.
/// Collects accumulated fees from a position.
///
/// This function extracts the accumulated fees from a position and returns
/// them as token balances. The fees are taken from the pool's balance.
///
/// ## Type Parameters
/// - `CoinTypeA`: First token type in the pool
/// - `CoinTypeB`: Second token type in the pool
///
/// ## Parameters
/// - `pool`: Mutable reference to the pool
/// - `position`: Mutable reference to the position
/// - `config`: Global configuration
/// - `versioned`: Versioned object for compatibility check
/// - `ctx`: Transaction context
///
/// ## Returns
/// - `(Balance<CoinTypeA>, Balance<CoinTypeB>)`: Collected fee balances
///
/// ## Events Emitted
/// - `CollectFeeEvent`: Contains position and fee amounts
///
/// ## Errors
/// - `EPositionPoolNotMatch`: If position doesn't belong to this pool
public fun collect_position_fee<CoinTypeA, CoinTypeB>(
pool: &mut Pool<CoinTypeA, CoinTypeB>,
position: &mut Position,
config: &GlobalConfig,
versioned: &Versioned,
ctx: &TxContext,
): (Balance<CoinTypeA>, Balance<CoinTypeB>) {
abort 1
}
Last updated