Create clmm pool
Last updated
Last updated
Everyone can create cetus clmm pools directly. There are following ways to create clmmpool.
Just create one clmmpool, without adding any initial liquidity.
Create one clmmpool and add some initial liquidity simultaneously. (Recommended)
create pools in batch
Please refer to the original function for specific parameter types.
tickSpacing
: tick spacing will affect price precision. Now mainnet exist some different type tick_spacing, they correspond to different fee rates.
tick spacing | fee rate |
---|---|
initializeSqrtPrice
: 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()
.
uri
: the icon of pool, it's allows null.
coinTypeA
: the coin type address about coinA.
coinTypeB
: the coin type address about coinB.
How to determine coinTypeA and coinTypeB ?
Complete the Coin Type: Before comparing, ensure that the coin type is complete.
Character-by-Character Comparison: Start from the first character and compare the characters of the two coins' coinType addresses one by one.
ASCII Value Comparison: When encountering differing characters, compare their ASCII values. The coin corresponding to the character with the larger ASCII value is considered "coin a".
Example 1:
coinTypeA:0x6864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS
coinTypeB:0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI
Example 2:
coinTypeA:0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC
coinTypeB:0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN
Please refer to the original function for specific parameter types.
tickSpacing
: tick spacing will affect price precision. Now mainnet exist some different type tick_spacing, they correspond to different fee rates.
initializeSqrtPrice
: 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()
.
uri
: the icon of pool, it's allows null.
coinTypeA
: the coin type address about coinA.
coinTypeB
: the coin type address about coinB.
Notice: The lexicographical order of coinTypeA
must be greater than that of coinTypeB
.
amountA
: the amount about coin A, which used to add liquidity.
amountB
: the amount about coin B, which used to add liquidity.
Notice: amount a and b was calculated by ClmmPoolUtil.estLiquidityAndcoinAmountFromOneAmounts()
, it will affected by selected tick interval、amount about one fixed coin(coinA or coinB)、current sqrt price of pool and allowed price slippage. You can see the usage in the next example.
fixAmountA
: true
means fixed coinA amount, false
means fixed coinB amount.
tickLower
: Represents the index of the lower tick boundary.
tickUpper
: 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
< tickUpperIndex
< 443636, 443636 is a constant, derived from the maximum range representable by the Q32.62 fixed-point number format.
Please refer to the original function for specific parameter types.
Each subsequent parameter is identical to the parameters used when creating a pool. However, you can use an array of CreatePoolParams.
tickSpacing
: tick spacing will affect price precision. Now mainnet exist some different type tick_spacing, they correspond to different fee rates.
initializeSqrtPrice
: 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()
.
uri
: the icon of pool, it's allows null.
coinTypeA
: the coin type address about coinA.
coinTypeB
: the coin type address about coinB.
Notice: The lexicographical order of coinTypeA
must be greater than that of coinTypeB
.
tick spacing | fee rate |
---|---|
tick spacing | fee rate |
---|---|
2
0.0001 (100)
10
0.0005 (500)
60
0.0025 (2500)
200
0.01 (10000)
2
0.0001
10
0.0005
60
0.0025
200
0.01
2
0.0001
10
0.0005
60
0.0025
200
0.01