Skip to main content
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.
See New liquidity position for creating a new liquidity position.
When working with HBAR, use the Wrapped HBAR token ID and include the HBAR amount in the setPayableAmount() method for the ContractExecuteTransaction call.

Function name: increaseLiquidity โ›ฝ Recommended gas: 330,000 gwei (~ $0.028 USD)

Code Overview

The following code demonstrates how to add more liquidity to an existing position.
See Fetch pool token ratio for an example how to retrieve the latest data 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 uses 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.
Hederaโ€™s EVM chain ID can be retrieved from https://chainlist.org.
The following code is intended for guidance purposes and does not include checks and safeguards.
Resources:
typescript