Create Pool
Last updated
Last updated
For general pool creation, use the create_pool_v2
function in the pool_creator
module.
Note that the coin amount must be exactly what you want to deposit. For example, if fix_amount_a
is true, the amount of coin A must match the exact amount you want to add.
config
: the reference of clmm globalconfig object. you can see details at
pools
: The indexer of all pools.
mainnet
0xf699e7f2276f5c9a75944b37a0c5b5d9ddfd2471bf6242483b03ab2887d198d0
testnet
0x50eb61dd5928cec5ea04711a2e9b72e5237e79e9fbcd2ce3d5469dc8708e0ee2
tickSpacing
: tick spacing will affect price precision. Now mainnet exist some different type tick_spacing, they correspond to different fee rates.
2
0.0001 (100)
10
0.0005 (500)
20
0.001 (1000)
60
0.0025 (2500)
200
0.01 (10000)
220
0.02 (20000)
initialize_price
: for computational convenience, we use fixed-point numbers to represent square root prices. Use the provided by the SDK transformation price
to sqrtPrice
: TickMath.priceToSqrtPriceX64()
in ts SDK.
uri
: the icon of pool, it's allows null.
tick_lower_idx
: I32 type, it's represents the index of the lower tick boundary.
tick_upper_idx
: I32 type, it's represents the index of the upper tick boundary.
The tick index must be an integer multiple of tickSpacing
. If the provided parameter is not a multiple of tickSpacing
, the contract will throw an error.
-443636 < tickLowerIndex
< currentTickIndex<tickUpperIndex
< 443636, 443636 is a constant, derived from the maximum range representable by the Q32.62 fixed-point number format.
Currently, creating a pool requires adding bidirectional liquidity.
coin_a
: The coin A object to add liquidity.
coin_b
: The coin B object to add liquidity.
metadata_a
: The metadata object of coin a.
metadata_b
: The metadata object of coin b.
fix_amount_a
: When adding liquidity, you can select which coin amount to use as the fixed amount. If it's true, use coin a amount, others use coin b amount.
clock
:clock: the sui clock object.
coinTypeA
: the coin type address about coinA.
coinTypeB
: the coin type address about coinB.
In certain situations, coin issuers may wish to reclaim the ability to create pools. To accommodate this, the protocol implements a PoolCreationCap
mechanism for coin issuers. Here's how it works:
Prerequisites:
You must hold the TreasuryCap
of the coin
The TreasuryCap
must not be frozen
Only one PoolCreationCap
can be minted per coin
Steps to create a restricted pool:
Mint a PoolCreationCap
using your coin's TreasuryCap
Register a pool by specifying: Quote coin and Tick spacing.
Create a pool by PoolCreationCap
.
The protocol controls which quote coins and tick_spacing values are permitted for pool registration. Currently, only pools with the SUI-200 can be registered.