API Reference

Remove Liquidity

This method allows the caller to remove liquidity from a given position in a pool. The input is the amount of liquidity that the user wants to remove, while the coin A and coin B amounts are calculated by the core protocol and sent to the destination address. The following interfaces can be used to call the method, with the arguments described below:

Interfaces


 public entry fun remove_liquidity<CoinTypeA, CoinTypeB>(
        clock: &Clock,
        protocol_config: &GlobalConfig, 
        pool: &mut Pool<CoinTypeA, CoinTypeB>, 
        position: &mut Position,
        liquidity: u128, 
        min_coins_a: u64,
        min_coins_b: u64,
        destination: address,
        ctx: &mut TxContext) {
        abort 0
    }

    /// Parameters:
    /// - clock              : Sui clock object
    /// - protocol_config    : The `config::GlobalConfig` object used for version verification
    /// - pool               : Mutable reference to the pool on which the position exist
    /// - position           : The position from which the liquidity is to be removed
    /// - liquidity          : The amount of liquidity to remove
    /// - min_coins_a        : The minimum amount of Coin A, the user wants to receive (Used for slippage check)
    /// - min_coins_b        : The minimum amount of Coin B, the user wants to receive (Used for slippage check)
    /// - destination        : The address to which the withdrawn amounts of coin A & B are to be sent
    /// - ctx                : Murable reference to caller's transaction context
    /// 
    /// Events Emitted       : LiquidityRemoved