Skip to content

Commit 5990f58

Browse files
Merge pull request #18 from CetusProtocol/mainnet-v1.24.0
Mainnet v1.24.0
2 parents ac9b178 + 6fe594d commit 5990f58

61 files changed

Lines changed: 2064 additions & 1014 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
sui/clmmpool/build
1+
sui/cetus_clmm/build
2+
sui/cetus_clmm/.idea/
3+
sui/lp_burn/build
4+
sui/stable_farming/build
5+
sui/.idea/

README.md

Lines changed: 158 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,45 @@
2323

2424
## Projects
2525

26-
### CLMM Interface
26+
### Latest Published At Table
2727

28-
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](./sui/clmmpool/README.md)
28+
- **Mainnet**
29+
30+
| Contract | Latest published at address |
31+
| -------------- | ------------------------------------------------------------------ |
32+
| cetus_clmm | 0x157468379cfe5616c063ae39a889dd184ad48350d3e08f8d9b4ade22b8e3fb61 |
33+
| lp_burn | 0xb92ae17938cde6d856ee39c686d4cfb968c94155e59e24520fbf60de38ebcd21 |
34+
| dca | 0x587614620d0d30aed66d86ffd3ba385a661a86aa573a4d579017068f561c6d8f |
35+
| limitorder | 0x533fab9a116080e2cb1c87f1832c1bf4231ab4c32318ced041e75cc28604bba9 |
36+
| stable_farming | 0x585381670c3d7c1f78caeb6c803f449442659743f4047a01b942da08bbfa19f6 |
37+
| xcetus | 0x9e69acc50ca03bc943c4f7c5304c2a6002d507b51c11913b247159c60422c606 |
38+
| dividends | 0xcec352932edc6663a118e8d64ed54da6b8107e8719603bf728f80717592cd9e8 |
39+
| vaults | 0x1ed1fef522ccea98a4fbd954543d5019238ec89282fbdea9a753e0a17e96fc28 |
40+
41+
- **Testnet**
42+
43+
| Contract | Latest published at address |
44+
| -------------- | ------------------------------------------------------------------ |
45+
| cetus_clmm | 0xf3f49b91b82441ad017addff46d6d9a5867a755a86fb2374067fec19d6cc82c2 |
46+
| lp_burn | 0x63f7b16b3d828d8cc34ab49bb9b7da0432b06c925701fa07360388aef2dce83b |
47+
| dca | 0xacd0ab94883a8785c5258388618b6252f0c2e9384b23f91fc23f6c8ef44d445c |
48+
| limitorder | 0xc65bc51d2bc2fdbce8c701f8d812da80fb37dba9cdf97ce38f60ab18c5202b17 |
49+
| stable_farming | 0xcc38686ca84d1dca949b6966dcdb66b698b58a4bba247d8db4d6a3a1dbeca26e |
50+
| xcetus | 0xdebaab6b851fd3414c0a62dbdf8eb752d6b0d31f5cfce5e38541bc6c6daa8966 |
51+
| dividends | 0x20d948d640edd0c749f533d41efc5f843f212d441220324ad7959c6e1d281828 |
52+
| vaults | 0x325b7d67276ff809df6b3fa17a2a6fbff6aaa20e467c3cf74d1a1d09b8890bbd |
53+
54+
### Cetus CLMM
55+
56+
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](./sui/cetus_clmm/README.md)
57+
58+
### LP Burn
59+
60+
The Cetus LP Burn integrate all core lp burn interface of Stable Farming, For more detailed information, please refer to the Stable Farming README document. [Stable Farming README Document](./sui/lp_burn/README.md)
2961

3062
### Stable Farming
3163

32-
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](./sui/stable-farming/README.md)
64+
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](./sui/stable_farming/README.md)
3365

3466
### Token
3567

@@ -43,6 +75,129 @@ The Cetus Limit Order seamlessly integrates all core functionalities of the Limi
4375

4476
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](./sui/dca/README.md)
4577

78+
### Vaults
79+
80+
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](./sui/vaults/README.md)
81+
82+
## How to migrate to the latest version?
83+
84+
### Why need to migrate?
85+
86+
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:
87+
integrate, stable farming, vault, aggregator, lp burn.
88+
89+
### Clmm contract update details
90+
91+
This update introduces new methods for pool creation, with the primary change being mandatory full-range liquidity provision for new pools. To create a new pool, you can use either:
92+
93+
- **pool_creator.create_pool_v2** on the cetus_clmm contract
94+
- **pool_creator.create_pool_v2** on the integrate contract
95+
96+
**Note**: The previous creation method factory.create_pool is permissioned, and factory.create_pool_with_liquidity is deprecated in this update.
97+
98+
```rust
99+
public fun create_pool_v2<CoinTypeA, CoinTypeB>(
100+
config: &GlobalConfig,
101+
pools: &mut Pools,
102+
tick_spacing: u32,
103+
initialize_price: u128,
104+
url: String,
105+
tick_lower_idx: u32,
106+
tick_upper_idx: u32,
107+
coin_a: Coin<CoinTypeA>,
108+
coin_b: Coin<CoinTypeB>,
109+
metadata_a: &CoinMetadata<CoinTypeA>,
110+
metadata_b: &CoinMetadata<CoinTypeB>,
111+
fix_amount_a: bool,
112+
clock: &Clock,
113+
ctx: &mut TxContext
114+
): (Position, Coin<CoinTypeA>, Coin<CoinTypeB>)
115+
116+
public entry fun create_pool_v2<CoinTypeA, CoinTypeB>(
117+
config: &GlobalConfig,
118+
pools: &mut Pools,
119+
tick_spacing: u32,
120+
initialize_price: u128,
121+
url: String,
122+
coin_a: &mut Coin<CoinTypeA>,
123+
coin_b: &mut Coin<CoinTypeB>,
124+
metadata_a: &CoinMetadata<CoinTypeA>,
125+
metadata_b: &CoinMetadata<CoinTypeB>,
126+
fix_amount_a: bool,
127+
clock: &Clock,
128+
ctx: &mut TxContext
129+
)
130+
```
131+
132+
In these two methods, you can use the fix_amount_a parameter to control which coin amount remains fixed:
133+
134+
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.
135+
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.
136+
137+
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:
138+
Prerequisites:
139+
140+
- You must hold the `TreasuryCap` of the coin
141+
- The `TreasuryCap` must not be frozen
142+
- Only one `PoolCreationCap` can be minted per coin
143+
144+
Steps to create a restricted pool:
145+
146+
1. Mint a `PoolCreationCap` using your coin's `TreasuryCap`
147+
148+
2. Register a pool by specifying: **Quote coin** and **Tick spacing**.
149+
150+
The protocol controls which quote coins and tick_spacing values are permitted for pool registration.
151+
Currently, only pools with the SUI-200 can be registered.
152+
153+
```rust
154+
let pool_creator_cap = factory::mint_pool_creation_cap<T>(
155+
clmm_global_config,
156+
clmm_pools,
157+
&mut treasury_cap,
158+
ctx
159+
);
160+
161+
factory::register_permission_pair<T, SUI>(
162+
clmm_global_config,
163+
clmm_pools,
164+
CETUS_CLMMPOOL_TICKSPACING,
165+
&pool_creator_cap,
166+
ctx
167+
);
168+
169+
170+
let (lp_position, return_coin_a, return_coin_b) = pool_creator::create_pool_v2_by_creation_cap<T, SUI>(
171+
clmm_global_config,
172+
clmm_pools,
173+
pool_creator_cap,
174+
200,
175+
current_sqrt_price,
176+
string::utf8(b""),
177+
coin_a,
178+
coin_b,
179+
metadata_a,
180+
metadata_b,
181+
is_fix_a,
182+
clk,
183+
ctx
184+
);
185+
```
186+
187+
**Important Notice**: Mandatory Contract Upgrade
188+
The Cetus CLMM core contract will undergo a mandatory upgrade in the near future. Upon completion:
189+
190+
Previous versions of the contract will be deprecated and no longer accessible
191+
All dependent protocols will require updates, including:
192+
193+
- [Vaults](sui/vaults/)
194+
- [StableFarming](sui/stable_farming/)
195+
- [LPBurn](sui/lp_burn/)
196+
- Aggregator
197+
- Integrate
198+
199+
Please ensure all necessary preparations are made before the upgrade takes effect.
200+
46201
# More About Cetus
47202

48203
Use the following links to learn more about Cetus:

sui/cetus_clmm/Move.lock

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# @generated by Move, please check-in and do not edit manually.
2+
3+
[move]
4+
version = 3
5+
manifest_digest = "544498052596BBCA9828650E295F50648B89974FE6C215459342B033111102B5"
6+
deps_digest = "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3"
7+
dependencies = [
8+
{ id = "IntegerMate", name = "IntegerMate" },
9+
{ id = "MoveSTL", name = "MoveSTL" },
10+
{ id = "Sui", name = "Sui" },
11+
]
12+
13+
[[move.package]]
14+
id = "IntegerMate"
15+
source = { git = "https://github.com/CetusProtocol/integer-mate.git", rev = "mainnet-v1.23.1", subdir = "sui" }
16+
17+
dependencies = [
18+
{ id = "Sui", name = "Sui" },
19+
]
20+
21+
[[move.package]]
22+
id = "MoveSTL"
23+
source = { git = "https://github.com/CetusProtocol/move-stl.git", rev = "mainnet-v1.23.1", subdir = "sui" }
24+
25+
dependencies = [
26+
{ id = "Sui", name = "Sui" },
27+
]
28+
29+
[[move.package]]
30+
id = "MoveStdlib"
31+
source = { git = "https://github.com/MystenLabs/sui.git", rev = "mainnet-v1.35.1", subdir = "crates/sui-framework/packages/move-stdlib" }
32+
33+
[[move.package]]
34+
id = "Sui"
35+
source = { git = "https://github.com/MystenLabs/sui.git", rev = "mainnet-v1.35.1", subdir = "crates/sui-framework/packages/sui-framework" }
36+
37+
dependencies = [
38+
{ id = "MoveStdlib", name = "MoveStdlib" },
39+
]
40+
41+
[move.toolchain-version]
42+
compiler-version = "1.37.3"
43+
edition = "2024.beta"
44+
flavor = "sui"
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
# mainnet
2-
# --------------------------
31
[package]
42
name = "CetusClmm"
5-
version = "mainnet-v1.23.1"
6-
published-at = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a"
3+
version = "0.0.1"
4+
published-at = "0x157468379cfe5616c063ae39a889dd184ad48350d3e08f8d9b4ade22b8e3fb61"
75

86
[dependencies]
9-
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.23.1" }
10-
MoveSTL = { git = "https://github.com/CetusProtocol/move-stl.git", subdir = "sui", rev = "mainnet-v1.23.1" }
11-
IntegerMate = { git = "https://github.com/CetusProtocol/integer-mate.git", subdir = "sui", rev = "mainnet-v1.23.1" }
7+
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.35.1", override = true }
8+
MoveSTL = { git = "https://github.com/CetusProtocol/move-stl.git", subdir = "sui", rev = "mainnet-v1.23.1", override = true }
9+
IntegerMate = { git = "https://github.com/CetusProtocol/integer-mate.git", subdir = "sui", rev = "mainnet-v1.23.1", override = true }
1210

1311
[addresses]
1412
cetus_clmm = "0x1eabed72c53feb3805120a081dc15963c204dc8d091542592abaf7a35689b2fb"

0 commit comments

Comments
 (0)