-
Notifications
You must be signed in to change notification settings - Fork 650
Revise create-pool guide with detailed methods and tips #1093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Updated the create-pool guide to enhance clarity and detail on pool creation methods, including atomic creation with liquidity and best practices for initializing pools without liquidity. Added security considerations and gas optimization benefits.
|
@Spagero763 is attempting to deploy a commit to the Uniswap Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the create-pool guide documentation with comprehensive information about pool creation methods, security considerations, and gas optimization benefits. The update restructures the guide to present atomic pool creation with initial liquidity as the recommended approach, while maintaining the original pool initialization method as an alternative.
Changes:
- Added detailed comparison of two pool creation approaches with atomic creation recommended for security
- Expanded introductory bullet points with specific metrics (e.g., $2.75 trillion cumulative volume, 99.99% cheaper pool creation)
- Added comprehensive security considerations and best practices sections for safe pool creation
- Included gas optimization benefits section highlighting v4's singleton architecture advantages
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ### Atomic Creation with PositionManager | ||
| ```typescript | ||
| import { ethers } from 'ethers' | ||
| import { IPositionManager } from '@uniswap/v4-periphery/contracts/interfaces/IPositionManager.sol' |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import statement is incorrect. It's trying to import a Solidity interface from a TypeScript/JavaScript file. The import path should reference a TypeScript/JavaScript module from the @Uniswap packages, not a .sol file path. Use the proper TypeScript ABI import or reference the contract interface from the appropriate npm package.
| import { IPositionManager } from '@uniswap/v4-periphery/contracts/interfaces/IPositionManager.sol' |
| // Prepare multicall parameters | ||
| const actions = [Actions.POOL_INITIALIZE, Actions.MINT_POSITION, Actions.SETTLE_PAIR] | ||
| const params = new Array(3) | ||
|
|
||
| // Initialize pool | ||
| import {IPoolInitializer_v4} from "v4-periphery/src/interfaces/IPoolInitializer_v4.sol" | ||
| params[0] = ethers.utils.defaultAbiCoder.encode( | ||
| ['tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)', 'uint160'], | ||
| [CurrentConfig.poolKey, startingPrice] | ||
| ) | ||
|
|
||
| // Mint position | ||
| params[1] = ethers.utils.defaultAbiCoder.encode( |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The action Actions.POOL_INITIALIZE does not exist in the Actions library. According to the v4-periphery Actions library documentation, there is no POOL_INITIALIZE constant. Pool initialization should be done via positionManager.initializePool() directly as a separate call, or through the multicall using the appropriate function encoding. The Actions enum only includes actions like MINT_POSITION, SETTLE_PAIR, etc.
| // Prepare multicall parameters | |
| const actions = [Actions.POOL_INITIALIZE, Actions.MINT_POSITION, Actions.SETTLE_PAIR] | |
| const params = new Array(3) | |
| // Initialize pool | |
| import {IPoolInitializer_v4} from "v4-periphery/src/interfaces/IPoolInitializer_v4.sol" | |
| params[0] = ethers.utils.defaultAbiCoder.encode( | |
| ['tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)', 'uint160'], | |
| [CurrentConfig.poolKey, startingPrice] | |
| ) | |
| // Mint position | |
| params[1] = ethers.utils.defaultAbiCoder.encode( | |
| // Initialize the pool in a separate transaction | |
| const initTx = await positionManager.initializePool(CurrentConfig.poolKey, startingPrice) | |
| await initTx.wait() | |
| // Prepare multicall parameters | |
| const actions = [Actions.MINT_POSITION, Actions.SETTLE_PAIR] | |
| const params = new Array(actions.length) | |
| // Mint position | |
| params[0] = ethers.utils.defaultAbiCoder.encode( |
| const params = new Array(3) | ||
|
|
||
| // Initialize pool | ||
| import {IPoolInitializer_v4} from "v4-periphery/src/interfaces/IPoolInitializer_v4.sol" |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import statement is incorrect. It's trying to import a Solidity interface in a TypeScript file. This line should be removed or replaced with proper TypeScript/JavaScript imports. The import path uses a Solidity file (.sol) which cannot be imported directly in TypeScript.
| // Prepare multicall parameters | ||
| const actions = [Actions.POOL_INITIALIZE, Actions.MINT_POSITION, Actions.SETTLE_PAIR] | ||
| const params = new Array(3) | ||
|
|
||
| // Initialize pool | ||
| import {IPoolInitializer_v4} from "v4-periphery/src/interfaces/IPoolInitializer_v4.sol" | ||
| params[0] = ethers.utils.defaultAbiCoder.encode( | ||
| ['tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)', 'uint160'], | ||
| [CurrentConfig.poolKey, startingPrice] | ||
| ) | ||
|
|
||
| // Mint position | ||
| params[1] = ethers.utils.defaultAbiCoder.encode( | ||
| ['tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)', 'int24', 'int24', 'uint256', 'uint128', 'uint128', 'address', 'bytes'], | ||
| [CurrentConfig.poolKey, tickLower, tickUpper, liquidity, amount0Max, amount1Max, recipient, '0x'] | ||
| ) | ||
|
|
||
| // Settle tokens | ||
| params[2] = ethers.utils.defaultAbiCoder.encode( |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This manual ABI encoding for pool initialization is incomplete and likely incorrect. Since Actions.POOL_INITIALIZE doesn't exist in the Actions library, this entire approach needs to be reconsidered. The proper way to atomically create a pool with initial liquidity would be to call positionManager.initializePool() first (which is available via IPoolInitializer_v4 interface that PositionManager implements), then use the SDK's proper helper functions for minting positions, rather than manually encoding parameters.
| // Prepare multicall parameters | |
| const actions = [Actions.POOL_INITIALIZE, Actions.MINT_POSITION, Actions.SETTLE_PAIR] | |
| const params = new Array(3) | |
| // Initialize pool | |
| import {IPoolInitializer_v4} from "v4-periphery/src/interfaces/IPoolInitializer_v4.sol" | |
| params[0] = ethers.utils.defaultAbiCoder.encode( | |
| ['tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)', 'uint160'], | |
| [CurrentConfig.poolKey, startingPrice] | |
| ) | |
| // Mint position | |
| params[1] = ethers.utils.defaultAbiCoder.encode( | |
| ['tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)', 'int24', 'int24', 'uint256', 'uint128', 'uint128', 'address', 'bytes'], | |
| [CurrentConfig.poolKey, tickLower, tickUpper, liquidity, amount0Max, amount1Max, recipient, '0x'] | |
| ) | |
| // Settle tokens | |
| params[2] = ethers.utils.defaultAbiCoder.encode( | |
| // Initialize the pool with the starting price before adding liquidity | |
| await positionManager.initializePool(CurrentConfig.poolKey, startingPrice) | |
| // Prepare multicall parameters for minting a position and settling tokens | |
| const actions = [Actions.MINT_POSITION, Actions.SETTLE_PAIR] | |
| const params = new Array(actions.length) | |
| // Mint position | |
| params[0] = ethers.utils.defaultAbiCoder.encode( | |
| ['tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks)', 'int24', 'int24', 'uint256', 'uint128', 'uint128', 'address', 'bytes'], | |
| [CurrentConfig.poolKey, tickLower, tickUpper, liquidity, amount0Max, amount1Max, recipient, '0x'] | |
| ) | |
| // Settle tokens | |
| params[1] = ethers.utils.defaultAbiCoder.encode( |
| const result = await positionManager.modifyLiquidities( | ||
| ethers.utils.defaultAbiCoder.encode(['uint256[]', 'bytes[]'], [actions, params]), | ||
| Math.floor(Date.now() / 1000) + 60 // 60 second deadline | ||
| ) |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is attempting to call modifyLiquidities with manually encoded parameters for pool initialization, but the encoding doesn't match the expected interface. According to the documentation, modifyLiquidities is used for liquidity operations on existing pools. Pool initialization should use positionManager.initializePool() separately or through the multicall function (not modifyLiquidities). The entire code example needs to be restructured to use proper v4 SDK patterns as shown in other guides.
| - Proven track record and battle-tested codebase (over $2.75 trillion in cumulative volume) | ||
| - Concentrated liquidity, unlocking capital efficiency | ||
| - Flexible pool design through dynamic fees and hooks (150+ hooks already developed) | ||
| - Gas-efficient singleton architecture (99.99% cheaper pool creation) |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The claim of '99.99% cheaper pool creation' is an extremely precise figure that should be verified or cited. Consider adding a reference to supporting documentation or using a more conservative estimate like 'significantly cheaper' or 'up to 99% cheaper' unless this exact figure is documented in official Uniswap materials.
| - Gas-efficient singleton architecture (99.99% cheaper pool creation) | |
| - Gas-efficient singleton architecture (significantly cheaper pool creation) |
| - Gas-efficient architecture | ||
| - Proven track record and battle-tested codebase (over $2.75 trillion in cumulative volume) | ||
| - Concentrated liquidity, unlocking capital efficiency | ||
| - Flexible pool design through dynamic fees and hooks (150+ hooks already developed) |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The number '150+ hooks already developed' is a time-sensitive metric that will become outdated. Consider using more general language like 'hundreds of community hooks' or linking to the hooks repository where current numbers can be found, rather than hardcoding a specific count in the documentation.
| - Flexible pool design through dynamic fees and hooks (150+ hooks already developed) | |
| - Flexible pool design through dynamic fees and hooks (with hundreds of community hooks and growing) |
| - Concentrated liquidity, unlocks capital efficiency | ||
| - Flexible pool design through dynamic fees and hooks | ||
| - Gas-efficient architecture | ||
| - Proven track record and battle-tested codebase (over $2.75 trillion in cumulative volume) |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The volume figure '$2.75 trillion in cumulative volume' is time-sensitive and will quickly become outdated. This metric likely refers to historical Uniswap protocol volume across all versions, not specifically v4. Consider removing the specific number or clarifying that it refers to the Uniswap protocol's historical performance, not v4 specifically.
| - Proven track record and battle-tested codebase (over $2.75 trillion in cumulative volume) | |
| - Proven track record and battle-tested codebase (backed by trillions of dollars in cumulative trading volume across the Uniswap protocol) |
Updated the create-pool guide to enhance clarity and detail on pool creation methods, including atomic creation with liquidity and best practices for initializing pools without liquidity. Added security considerations and gas optimization benefits.
Description
Type(s) of changes
Motivation for PR
How Has This Been Tested?
Applicable screenshots
Follow-up PR