Page cover

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.

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.

Last updated