Close position

Complete closing position process

When closing a position, if the position is not empty and still contains liquidity, fees, or rewards, an error code 0 will be thrown by the position module. To successfully close the position, follow these steps:

  1. Collect rewards (if applicable).

  2. Close the position.

Function

clmmpool/sources/pool.move

/// Close a position by burning the corresponding NFT.
///
/// # Arguments
///
/// _ config - A reference to the GlobalConfig object.
/// _ pool - A mutable reference to the Pool object.
/// _ position_nft - The Position NFT to burn and close the corresponding position.
///
/// # Generic Type Parameters
///
/// _ CoinTypeA - The type of the first coin in the pool.
/// \* CoinTypeB - The type of the second coin in the pool.
///
/// # Returns
///
/// This function does not return a value.

public fun close_position<CoinTypeA, CoinTypeB>(
    config: &GlobalConfig,
    pool: &mut Pool<CoinTypeA, CoinTypeB>,
    position_nft: Position,
) {}

Example

Last updated