Pangea Swap
English
English
  • Introduction
  • Protocol Overview
  • Disclaimer
    • Risk & Security
    • Terms of Use
  • Updates
  • Audit
  • concentrated liquidity
    • Weakness of V2 DEXs: Low Liquidity utilization rate
    • Solution by V3 DEXs: Concentrated Liquidity
    • Concentrated Liquidity FAQ
  • Connectivity
    • Customizable Pool
  • Governance
    • STONE
      • STONE Distribution Plan
      • Tokenomics (Before)
      • Tokenomics (After)
      • Growth Fund History
    • Contribution Point NFT
  • Guide
    • SWAP
    • Add Liquidity
      • Add liquidity (Preset)
      • Add liquidity (Custom)
    • STONE Staking
    • Revenue Sharing
    • FAQ
  • Growth Partnership
    • Swapscanner
    • ISKRA
  • event
    • Promotion
  • Developers
    • Concept Overview
      • Problem : Lazy Liquidity
      • Liquidity Concentration
      • Position & Risk
      • Price Tick
      • Position NFT
      • Fees
      • Flash Loan
    • Contracts
      • Core Contracts
        • MasterDeployer
        • ConcentratedLiquidityPoolFactory
        • ConcentratedLiquidityPool
        • ConcentratedLiquidityPoolManager
        • PoolRouter
        • PoolLogger
        • AirdropDistributor
      • Contribution Point NFT
      • Price Oracle
    • Interacting with the Protocol
      • Setting up Local Test Environment
        • Test env. commands
      • Getting Pangea Pool Info
      • Creating Pangea Pool
      • Mint Position (add liquidity)
      • Burn Position (remove liquidity)
      • Claim Fee
      • Swap
  • Community
    • Website
    • Discord
    • Telegram
    • Medium
    • Twitter
    • Opensea - Position NFT
    • Opensea - CP NFT
    • GitHub
    • Testnet
    • E-mail
Powered by GitBook
On this page
  1. Developers
  2. Interacting with the Protocol

Burn Position (remove liquidity)

This is an example of withdrawing all or part of an asset from an existing position in Pangea's pool.

import { ethers } from "ethers";
import {BigNumber} from "@ethersproject/bignumber";

/// concentrated Liquidity Pool Manager address
const poolManagerAddress = "0x000...";

/// web3 Provider (metamask provider / jsonRPC provider / ...)
const provider = ethers.getDefaultProvider();

// burn position
async function burnPosition(
    tokenId:number,  // tokenId
    amount:string,   // amount of liquidity to burn
    recipient:string // recipient address
) {
      const poolManager = await ConcentratedLiquidityPoolManager__factory.connect(positionManagerAddress, provider);
      const tx = await poolManager.burn(
            tokenId, // position ID to remove liquidity from. will burn if all liquidity is removed
            amount, // amount of liquidity to burn. You can get position liquidity size through poolManager.positions(tokenId).
            recipient,
            0, // token0 slippage limit. if removed token0 is less, revert
            0, // token1 slippage limit. if removed token1 is less, revert
            false // Unwrap? "true" if you want to get KLAY instead of wKLAY
      );
      await tx.wait();
}
PreviousMint Position (add liquidity)NextClaim Fee

Last updated 2 years ago