API Reference

Close Position

This method allows the caller to close their position. Any liquidity of fee accrued in the position will be withdrawn and sent to the destination address. The user must claim all pending rewards before the position is closed, otherwise the method will revert. The following interfaces can be used to call the method, with the arguments described below:

Interfaces


  public entry fun close_position<CoinTypeA, CoinTypeB>(
        clock: &Clock,
        protocol_config: &GlobalConfig, 
        pool: &mut Pool<CoinTypeA, CoinTypeB>, 
        position: Position,
        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 to pool on which the position is being closed
    /// - position           : The position to be closed
    /// - destination        : The address to which the withdrawn liquidity and fee of coin A & B are to be sent
    /// - ctx                : Murable reference to caller's transaction context
    /// 
    /// Events Emitted       : PositionClosed | LiquidityRemoved | UserFeeCollected