Skip to main content

Decrease Liquidity

Function name: decreaseLiquidity Recommended gas: 300,000 gwei (~ $0.026 USD)

Code Overview

The following code demonstrates how to remove all liquidity from an existing position, collect the swap fees, and return the deposit amounts.
When removing liquidity from a pool that involves HBAR, include unwrapWHBAR in your call to convert the Wrapped HBAR (WHBAR) output token back into the native HBAR cryptocurrency.
Call the collect function after removing the liquidity to withdraw the amounts to the recipient address. It will also collect any swap fees earned in the position.
To burn the NFT after completely exiting the position, include burn in the multi-call. See Burning the NFT.
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

Burning the NFT

After completely exiting a position, you may burn the NFT position if it is no longer needed. The following code demonstrates how to set a spender allowance for the NFT and include the burn function in the multicall.
A Note allowance for the NFT Manager contract must be approved by the token holder to enable the contract to retrieve the NFT to burn it.
Resources:
Typescript