Adding/Removing Liquidity
add_liquidity<CURRENCY>(...)
Purpose: Add NFTs and tokens to an existing pool to deepen liquidity and earn more LP tokens.
Process:
Check that the pool is active and the caller has sufficient
UserBalance
.Calculate how many LP tokens to mint based on the proportional share of liquidity added.
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:
Ensure the user has enough LP tokens to redeem.
Calculate the share of NFTs and tokens to return.
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