LogoLogo
  • Pangolin Overview
    • Introduction to Pangolin
      • Pangolin V3
        • Concentrated Liquidity
        • Dynamic Fee Mechanism
        • Multiple Fee Tiers
        • Unrestricted Liquidity Provision
        • Non-Fungible Liquidity Positions
        • In-Range Farming
        • Superpools with Dual Rewards
        • Optimized for Avalanche and Beyond
    • Audits
      • Pangolin V2
      • Pangolin V3
    • Tokens & Governance
      • PNG Tokenomics & Metrics
      • PBAR Tokenomics & Metrics
      • PFL Tokenomics & Metrics
      • PSB Tokenomics & Metrics
    • Official Links & Communities
    • Become a Partner
    • Support
    • Roadmap
  • Guides
    • Swapping Tokens
      • Understanding Slippage and Price Impact
    • Providing Liquidity
    • Managing Liquidity Positions
    • Withdrawing Liquidity
    • Earning Rewards
      • Strategies for Maximizing Rewards
    • Understanding SAR
      • Staking SAR
  • Developers
    • V3 Contracts & Integration Reference
      • Avalanche (V2)
      • Hedera
      • Flare
      • Songbird
    • APIs
      • PNG and DEX Values on Avalanche
      • PBAR and DEX Values on Hedera
    • Bug Bounty
    • Token Listing
    • Create A Multisig
    • Honeycomb
Powered by GitBook
LogoLogo

Follow Us

  • Twitter 🔺
  • Twitter ☀️
  • Twitter Ħ
  • Twitter ⋈

Community

  • Discord
  • Telegram
  • Reddit
  • Support

Resources

  • GitHub
  • Medium
  • YouTube
  • Linktree

Policies

Pangolin Exchange © 2023

On this page
  • Smart Contract Architecture
  • Contract Addresses
  • Interface and ABI
  • Example Integration - Swapping via Router
  • Example Integration - Adding Liquidity
  1. Developers

V3 Contracts & Integration Reference

Developer And Integration Reference

By leveraging Pangolin V3’s contracts, developers can build novel DeFi applications: custom trading bots that place range orders, portfolio managers that automate LP range adjustments, or integrate Pangolin liquidity into aggregators. The experience is very similar to working with Uniswap V3, so existing knowledge carries over, with the added benefit that Pangolin’s innovation (dynamic fees, etc.) can offer even better outcomes in certain conditions. All code is open source on Pangolin’s GitHub and detailed in the official docs for reference.

Pangolin V3’s concentrated liquidity and dynamic fee system come with a robust set of smart contracts. If you are a developer or project looking to integrate or build on Pangolin V3, here are important details:

Smart Contract Architecture

Pangolin V3’s core contracts are derived from Uniswap V3, with modifications for dynamic fees and other Pangolin enhancements. Liquidity pools are created through a factory contract, and each pool is a unique contract instance for a token pair. Liquidity positions are represented by NFTs (ERC-721), and there is a periphery set of contracts (like routers) to facilitate easy swapping and liquidity management. The dynamic fee logic means that the fee for a pool might be stored in the pool’s state and can be updated by authorized roles or algorithms.

For on-chain integration, you can treat Pangolin V3 pools similarly to Uniswap V3 pools: use the factory to find pool addresses and call the pool functions for swaps or queries. Keep in mind that functions like getPool(tokenA, tokenB, fee) might not guarantee the fee is current (since Pangolin can alter fees) – instead, you may need to query the pool’s current fee via a pool state call.

Contract Addresses

These addresses allow you to instantiate contract instances in your applications. The factory is used to create/query pools, the router can be used to perform multi-hop swaps or liquidity additions in one transaction, etc.

Pangolin’s router is compatible with Uniswap V3’s routing functions, with added support for dynamic fee logic.

Title
Contract Address

PangolinV3Factory

0x1128F23D0bc0A8396E9FBC3c0c68f5EA228B8256

NFTDescriptor

0xB87a8aD1c1217EC587474b348b848dF564D505aa

NonfungibleTokenPositionDescriptor

0x7528B8Ae60084577B0774A4e225BC4C3DeA7E315

NonfungiblePositionManager

0xf40937279F38D0c1f97aFA5919F1cB3cB7f06A7F

SwapRouter

0x5485A0751a249225D3bA2f6f296551507e22547f

PangolinV3Migrator

0x27eCB0391ad611Bbd9dd5e7e8A19db3fCAe41ab8

PangolinV3InterfaceMulticall

0x7d115C1fb6152C5Aed1750183Ae59107160694a2

PangolinV3Quoter

0xA86522CCc412dBC4FA10991900FE46De95983822

TickLens

0x5DFe6DB0F904A27a52f543Afd6B690784a44CaC1

Interface and ABI

Pangolin’s contracts adhere closely to Uniswap V3 interfaces. The pool contract implements the standard Uniswap V3 pool interface (IUniswapV3Pool style), with methods like swap, mint (for adding liquidity), burn (for removing), and collect (for fees). The positions NFT is typically managed by a NonfungiblePositionManager-like contract that bundles mint/burn/collect operations for convenience.

Example Integration - Swapping via Router

Suppose you want to execute a swap in Pangolin V3 from within a smart contract (or via web3). You can call the swapExactTokensForTokens function on the Pangolin V3 router, specifying the route (which includes the pool fee tier or just the token path if using auto route) and amount parameters. The router will handle finding the pool and executing the swap for you, applying the current fee. Because of dynamic fees, make sure to allow some slippage tolerance – the fee might change slightly by the time the swap executes, but usually this is minor and within normal slippage settings.

Example Integration - Adding Liquidity

To add liquidity programmatically, you might use the NonfungiblePositionManager contract. You would call something like mint(positionParams) providing the token addresses, fee tier, desired price range (as lower and upper tick bounds), and token amounts. The contract will transfer your tokens and mint you an NFT representing the position. The returned token ID corresponds to your position NFT. You can then manage this NFT (e.g., transfer or stake it) as needed. When you want to remove liquidity, you’d call decreaseLiquidity and then collect on the position manager for that token ID.


By leveraging Pangolin V3’s contracts, developers can build novel DeFi applications: custom trading bots that place range orders, portfolio managers that automate LP range adjustments, or integrate Pangolin liquidity into aggregators. The experience is very similar to working with Uniswap V3, so existing knowledge carries over, with the added benefit that Pangolin’s innovation (dynamic fees, etc.) can offer even better outcomes in certain conditions. All code is open source on Pangolin’s GitHub and detailed in the official docs for reference.

PreviousStaking SARNextAvalanche (V2)

Last updated 1 day ago

Page cover image