Adding/Removing Liquidity

add_liquidity<CURRENCY>(...) Purpose: Add NFTs and tokens to an existing pool to deepen liquidity and earn more LP tokens. Process:

  1. Check that the pool is active and the caller has sufficient UserBalance.

  2. Calculate how many LP tokens to mint based on the proportional share of liquidity added.

  3. Emit a LiquidityAdded event.

remove_liquidity<CURRENCY>(...) Purpose: Remove some or all of a user’s liquidity from a pool, returning NFTs and tokens proportional to their share and burning their LP tokens. Process:

  1. Ensure the user has enough LP tokens to redeem.

  2. Calculate the share of NFTs and tokens to return.

  3. Emit a LiquidityRemoved event.

Use Cases:

  • Liquidity providers can enter and exit positions on their terms.

  • Encourage dynamic, market-driven liquidity rather than static listings.

Best Practices:

  • Use batch operations for large-scale liquidity additions or removals.

  • Monitor pool composition to maintain a healthy NFT-to-token ratio.

Last updated