Integrating Cetus-CLMMPOOL: A Comprehensive Guide
Explore the docs »
·
Report Bug
·
Request Feature
-
Mainnet
Contract Latest published at address cetusclmm 0x75b2e9ecad34944b8d0c874e568c90db0cf9437f0d7392abfd4cb902972f3e40 lp_burn 0xf80a6bb02d98cebf90a6476e8c106a4ddf1865ef79d6067a66933eb57b9f0f7b dca 0x587614620d0d30aed66d86ffd3ba385a661a86aa573a4d579017068f561c6d8f limitorder 0x533fab9a116080e2cb1c87f1832c1bf4231ab4c32318ced041e75cc28604bba9 stable_farming 0x7dba8e74b5d512a3c3bd8a1f7ef111fe9f624ddeb935635385645ca5db1f7850 xcetus 0x9e69acc50ca03bc943c4f7c5304c2a6002d507b51c11913b247159c60422c606 dividends 0x5aa58e1623885bd93de2331d05c29bf4930e54e56beeabcab8fe5385de2d31dc vaults 0x9890eca0da01697ddfdc2cd4b34def4733f755cc3de662f689ab6f0763ca6f52 -
Testnet
Contract Latest published at address cetusclmm 0xb2a1d27337788bda89d350703b8326952413bd94b35b9b573ac8401b9803d018 lp_burn 0x9c751fccc633f3ebad2becbe7884e5f38b4e497127689be0d404b24f79d95d71 dca 0xacd0ab94883a8785c5258388618b6252f0c2e9384b23f91fc23f6c8ef44d445c limitorder 0xc65bc51d2bc2fdbce8c701f8d812da80fb37dba9cdf97ce38f60ab18c5202b17 stable_farming 0x3c4582ee27a09f7e6c091022d0d279fdc8e54c1f782916bf135a71a8e8006aa5 xcetus 0xdebaab6b851fd3414c0a62dbdf8eb752d6b0d31f5cfce5e38541bc6c6daa8966 dividends 0x20d948d640edd0c749f533d41efc5f843f212d441220324ad7959c6e1d281828 vaults 0x04df17a109336491867f04df40ca8a77277bc6e382139e88ae0d0d267ac07905
The Cetus CLMM Interface provider all core features function interface of CLMM, allowing users to easily connect with CLMM by contract. For more detailed information, please refer to the CLMM README document. CLMM README Document
The Cetus LP Burn integrate all core lp burn interface of Stable Farming, For more detailed information, please refer to the LP Burn README document. LP Burn README Document
The Cetus Stable Farming integrate all core features function interface of Stable Farming, For more detailed information, please refer to the Stable Farming README document. Stable Farming README Document
The Cetus Token Interface integrates cetus, xcetus, dividends. For more detailed information, please refer to the Token README document. Token README Document
The Cetus Limit Order seamlessly integrates all core functionalities of the Limit Order interface. For more detailed information, please refer to the Limit Order README document. Limit Order README Document
The Cetus DCA integrates all core functionalities of the DCA interface. For more detailed information, please refer to the DCA README document. DCA README Document
The Cetus vaults integrates all core functionalities of the vaults interface. For more detailed information, please refer to the Vaults README document. Vaults README Document
Cetus has already updated to the new CLMM contract and will disable the old version of the CLMM contract. The following contracts will need to be updated simultaneously: integrate, stable farming, vault, aggregator, lp burn.
This update introduces new methods for pool creation, with the primary change being mandatory liquidity provision for new pools. To create a new pool, you can use either:
- pool_creator.create_pool_v2 on the cetus_clmm contract
- pool_creator_v2.create_pool_v2 on the integrate contract
Note: The previous creation method factory.create_pool
is permissioned, and factory.create_pool_with_liquidity
is deprecated in this update. The pool_creator.create_pool_v2_by_creation_cap
method is deprecated, please use pool_creator.create_pool_v2_with_creation_cap
.
// cetus_clmm.pool_creator.create_pool_v2
public fun create_pool_v2<CoinTypeA, CoinTypeB>(
config: &GlobalConfig,
pools: &mut Pools,
tick_spacing: u32,
initialize_price: u128,
url: String,
tick_lower_idx: u32,
tick_upper_idx: u32,
coin_a: Coin<CoinTypeA>,
coin_b: Coin<CoinTypeB>,
metadata_a: &CoinMetadata<CoinTypeA>,
metadata_b: &CoinMetadata<CoinTypeB>,
fix_amount_a: bool,
clock: &Clock,
ctx: &mut TxContext
): (Position, Coin<CoinTypeA>, Coin<CoinTypeB>)
// integrate.pool_creator_v2.create_pool_v2
public entry fun create_pool_v2<CoinTypeA, CoinTypeB>(
config: &GlobalConfig,
pools: &mut Pools,
tick_spacing: u32,
initialize_price: u128,
url: String,
tick_lower_idx: u32,
tick_upper_idx: u32,
coin_a: &mut Coin<CoinTypeA>,
coin_b: &mut Coin<CoinTypeB>,
metadata_a: &CoinMetadata<CoinTypeA>,
metadata_b: &CoinMetadata<CoinTypeB>,
fix_amount_a: bool,
clock: &Clock,
ctx: &mut TxContext
)
In these two methods, you can use the fix_amount_a parameter to control which coin amount remains fixed:
If fix_amount_a
is true: The amount of coin_a will be fixed. You should provide the exact amount of coin_a you want to deposit, and the required amount of coin_b will be calculated automatically.
If fix_amount_a
is false: The amount of coin_b will be fixed. You should provide the exact amount of coin_b you want to deposit, and the required amount of coin_a will be calculated automatically.
In some situations, coin issuers may want to reclaim the capability to create pools, so 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'sTreasuryCap
-
Register a pool by specifying: Quote coin and Tick spacing.
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.
let pool_creator_cap = factory::mint_pool_creation_cap<T>(
clmm_global_config,
clmm_pools,
&mut treasury_cap,
ctx
);
factory::register_permission_pair<T, SUI>(
clmm_global_config,
clmm_pools,
200,
&pool_creator_cap,
ctx
);
let (lp_position, return_coin_a, return_coin_b) = pool_creator::create_pool_v2_with_creation_cap<T, SUI>(
clmm_global_config,
clmm_pools,
pool_creator_cap,
200,
current_sqrt_price,
string::utf8(b""),
coin_a,
coin_b,
metadata_a,
metadata_b,
is_fix_a,
clk,
ctx
);
Additionally, a new event CollectRewardV2Event
has been added to the pool module.
Important Notice: Mandatory Contract Upgrade The Cetus CLMM core contract will undergo a mandatory upgrade in the near future. Upon completion, previous versions of the contract will be deprecated and no longer accessible All dependent protocols will require updates, including:
- Vaults
- StableFarming
- LPBurn
- Aggregator
- Integrate
Please ensure all necessary preparations are made before the upgrade takes effect.
Use the following links to learn more about Cetus:
Learn more about working with Cetus in the Cetus Documentation.
Join the Cetus community on Cetus Discord.