# Remove liquidity

## 1. Remove liquidity

You can directly remove liquidity through the remove liquidity method in the Cetus DLMM pool module.

```rust
/// Removes liquidity from a position and returns the underlying tokens.
///
/// This function removes liquidity from the specified bins of a position
/// and returns the corresponding token amounts. It handles bin cleanup if empty.
///
/// ## 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
/// - `bins`: Vector of bin IDs for liquidity removal
/// - `liquidity_shares`: Vector of liquidity shares to remove from each bin
/// - `config`: Global configuration
/// - `versioned`: Versioned object for compatibility check
/// - `clk`: Clock for timestamp tracking
/// - `ctx`: Transaction context
///
/// ## Returns
/// - `(Balance<CoinTypeA>, Balance<CoinTypeB>)`: Token balances returned
///
/// ## Events Emitted
/// - `RemoveLiquidityEvent`: Contains position and liquidity delta information
public fun remove_liquidity<CoinTypeA, CoinTypeB>(
    pool: &mut Pool<CoinTypeA, CoinTypeB>,
    position: &mut Position,
    bins: vector<u32>,
    liquidity_shares: vector<u128>,
    config: &GlobalConfig,
    versioned: &Versioned,
    clk: &Clock,
    ctx: &TxContext,
): (Balance<CoinTypeA>, Balance<CoinTypeB>) {
    abort 1
}
```

## 2. Remove full range liquidity by percent

```rust
/// Removes full range liquidity from a position specified by numerator and denominator.
///
/// ## 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
/// - `numerator`: Numerator of the percentage
/// - `denominator`: Denominator of the percentage
/// - `config`: Global configuration
/// - `versioned`: Versioned object for compatibility check
/// - `clk`: Clock for timestamp tracking
/// - `ctx`: Transaction context
///
/// ## Returns
/// - `(Balance<CoinTypeA>, Balance<CoinTypeB>)`: Token balances returned
///
/// ## Events Emitted
/// - `RemoveLiquidityEvent`: Contains position and liquidity delta information
public fun remove_full_range_liquidity_by_percent<CoinTypeA, CoinTypeB>(
    pool: &mut Pool<CoinTypeA, CoinTypeB>,
    position: &mut Position,
    numerator: u128,
    denominator: u128,
    config: &GlobalConfig,
    versioned: &Versioned,
    clk: &Clock,
    ctx: &TxContext,
): (Balance<CoinTypeA>, Balance<CoinTypeB>){
    abort 1
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cetus-1.gitbook.io/cetus-developer-docs/developer/via-dlmm-contract/features-available/remove-liquidity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
