Contract ID: SaucerSwapV2NonfungiblePositionManager
See Liquidity position fee for an example of how to obtain the current fee, payable in HBAR, for minting a new liquidity position or adding more liquidity to an existing one.
Ensure the recipient has associated the SaucerSwapV2 LP NFT ID representing the liquidity positions before minting a new position.
Function name:
mint
Recommended gas limit: 900,000
Code overview
The following code demonstrates how to create a new liquidity position with a price range being +/- 5% from the current token price, and receive an NFT representing the position.See Fetch pool token ratio for an example of how to retrieve the latest data and construct the Pool object using the Uniswap SDK library.
See Fetch all pools to retrieve the pool address, token pairs, fee tier, token IDs and decimal places for the target pool of interest.
The
refundETH function operates in HBAR, but its name is derived from Uniswap on Ethereum. The name was retained to simplify integration for developers familiar with Uniswap tools. It is used to refund any excess HBAR when setting up a new liquidity position.- JavaScript SDK
Next steps
Increasing liquidity (V2)
Add more liquidity to the position later.
Fetch pool token ratio (V2)
Size both token amounts from the current price.
Liquidity position fee (V2)
Fetch the HBAR mint fee before calling mint.