Original

Essential for On-Chain Market Makers: Two Practical Methods for Creating Cetus Stablecoin Liquidity Pools

This article is machine translated
Show original

introduction

The Sui blockchain is a high-performance Layer 1 blockchain, renowned for its parallel execution and low latency. Cetus Protocol is a decentralized liquidity protocol within the Sui ecosystem, similar to Uniswap or Curve, focusing on an efficient AMM (Automated Market Maker) mechanism. Stable Pools are liquidity pool types in Cetus specifically designed for stablecoins. They use a constant sum function or hybrid model to minimize impermanent loss, making them suitable for trading stable assets such as USDC and USDT.

This tutorial will guide you through creating a custom Cetus stablecoin pool on the Sui mainnet. Two methods are presented: one requires some Sui development knowledge and basic Move programming language skills; the other uses the GTokenTool one-click token issuance platform , which does not require specialized knowledge. Note: Blockchain operations involve risks. Please ensure you back up your wallet and practice on the testnet. Creating a pool may incur gas fees, and liquidity provision should be carefully evaluated.

Prerequisites

Before you begin, make sure you have the following:

1. Sui Wallet: Install the Sui Wallet (such as the Sui Wallet browser extension) or use the Sui CLI. Ensure your wallet has enough SUI tokens (at least 10–20 SUI for gas fees).

2. Sui CLI tool: Install Sui CLI (version 1.0+). Install using the following command:

curl -fLJO https://github.com/MystenLabs/sui/releases/download/mainnet-v1.0.0/sui-mainnet-v1.0.0-ubuntu-x86_64.tgztar -xzf sui-mainnet-v1.0.0-ubuntu-x86_64.tgzsudo mv sui /usr/local/bin

Verify installation: sui — version.

3. Node.js and npm (optional, if using script automation): for auxiliary tools.

4. Cetus SDK: Clone the Cetus repository or install the Cetus SDK via npm.

npm install @cetusprotocol/cetus-sui-clmm-sdk

5. Stablecoin assets: Prepare the stablecoins (such as USDC on Sui) to be added to the pool and ensure sufficient liquidity (at least 1,000 USD equivalent).

6. Development environment: VS Code with Move plugin, familiar with Sui Move language.

7. Network: This tutorial is for the Sui mainnet; switch to Testnet for testing.

Warning: After creating a pool, check the security of the Cetus contract before providing liquidity.

Method 1

Step 1: Set up Sui CLI and Wallet

1. Initialize Sui CLI:

sui client new-env --alias mainnetsui client switch --env mainnetsui client active-address # Display current address

2. Import or create a wallet:

  • If using CLI: sui keytool import … (import from mnemonic phrase).
  • Ensure your wallet is connected to the Sui Wallet extension and grant CLI access.

3. Verify balance:

sui client gas

If SUI is insufficient, transfer it through an exchange.

Step 2: Understanding the Cetus Stabilization Pool Structure

Cetus stable pools use a variant of CLMM (Concentrated Liquidity Market Maker) and support multi-asset stable pools (2–4 tokens). Key parameters include:

  • Tick ​​Spacing: Controls the price range (the stability pool is typically 1–10).
  • Initial price: based on the pegged asset (e.g., 1 USDC = 1 USDT).
  • Cost ratio: 0.01%-0.05% is recommended for the stabilization pool.

Step 3: Prepare the Move contract (if custom).

Cetus provides a ready-made SDK, but if you need a custom pool, you need to write a Move module:

1. Create a new Sui Move project:

sui move new my_stable_poolcd my_stable_pool

2. Create stable_pool.move in the sources/ directory:

module my_stable_pool::stable_pool { use sui::coin::{Self, Coin}; use sui::tx_context::TxContext; use cetus_clmm::pool::{Self, Pool}; use cetus_clmm::stable_pool; // Assuming the Cetus stable pool module
const EInsufficientLiquidity: u64 = 0; public entry fun create_stable_pool<T1, T2>( coin1: Coin<T1>, coin2: Coin<T2>, tick_spacing: u64, fee_rate: u64, initial_price: u128, ctx: &mut TxContext ) { // Initialize the pool let pool = stable_pool::create<T1, T2>( coin1, coin2, tick_spacing, fee_rate, initial_price, ctx ); // Add initial liquidity assert!(coin::value(&coin1) > 0 && coin::value(&coin2) > 0, EInsufficientLiquidity); pool::add_liquidity(&mut pool, ...); // Refer to Cetus SDK for detailed parameters }}

Note: This is a simplified example. The actual example uses the `createPool` function from the Cetus SDK. Compilation test: `sui move build`.

Step 4: Create a pool using the Cetus SDK

1. Install dependencies and configure the SDK:

// In the Node.js script, const { JsonRpcProvider, getFullnodeUrl, Ed25519Keypair } = require('@mysten/sui.js'); const { initCetusSDK } = require('@cetusprotocol/cetus-sui-clmm-sdk');
const provider = new JsonRpcProvider(getFullnodeUrl('mainnet')); const keypair = Ed25519Keypair.fromSecretKey(/* your private key */); const sdk = initCetusSDK(provider);

2. Write the creation script createPool.js:

async function createStablePool() { // Asset type: Object IDs for USDC and USDT const coinTypeA = '0x...::usdc::USDC'; // Replace with the actual type const coinTypeB = '0x...::usdt::USDT';
// Parameters const tickSpacing = 1; // Stable pool compact spacing const feeRate = 100; // 0.01% = 100 basis points const initialSqrtPrice = Math.sqrt(1.0001); // Approximate 1:1 price // Transaction block const tx = await sdk.Pool.createPoolTransaction({ coinTypeA, coinTypeB, tickSpacing, feeRate, sqrtPrice: initialSqrtPrice * 2**96, // Q64.64 format }); // Sign and execute const result = await provider.signAndExecuteTransactionBlock({ signer: keypair, transactionBlock: tx, }); console.log('Pool created:', result.digest);}createStablePool();

3. Run the script:

node createPool.js

This will create a pool and return a Pool ID.

Step 5: Add initial liquidity

After creating the pool, provide liquidity to activate it:

1. Use the SDK's addLiquidity function:

// Continuing the previous example const poolId = '0x...'; // Retrieve from the result const amountA = 1000 * 1e6; // 1000 USDC (6 decimals) const amountB = 1000 * 1e6; // 1000 USDT
const liquidityTx = await sdk.Position.addLiquidityTransaction({ poolID: poolId, amountA, amountB, lowerTick: -100, // Price range upperTick: 100,}); // Signature execution is similar to the previous step

2. Approve Tokens: Ensure your wallet approves the Cetus contract to spend your stablecoins.

3. Verification: Use Sui Explorer (https://suiexplorer.com) to check the pool status.

Step 6: Testing and Deployment

1. Testnet Testing: Switch to Testnet and repeat the steps. Obtain the Testnet SUI from the tap.

2. Mainnet Deployment: After confirming all parameters, execute on the mainnet.

3. Monitoring: Use the Cetus dashboard (https://app.cetus.zone) to track pool APR and trading volume.

Method 2

1. Connect your wallet

Create liquidity: https://sui.gtokentool.com/zh-CN/LiquidityManagement/createPool

On the Create Liquidity page, select Main Network in the upper right corner and connect your wallet. Suiet wallet is recommended.

2. Select the base token

After selecting the base token, the balance of the base token will be displayed below.

3. Select the quote token

After selecting the quote token, the balance of the quote token will be displayed below.

4. Set the initial price

5. Enter the number of quoted tokens to be added to the pool.

After you fill in the number of quoted tokens to add to the pool, the number of base tokens will be automatically calculated.

6. Click "Create"

After your wallet pops up, click "Confirm." The transaction hash will be displayed below the successful transaction; clicking the hash will take you to a blockchain explorer to view the transaction.

in conclusion

Congratulations! You have created a Cetus stable pool on Sui. This will provide you with passive income opportunities through transaction fee sharing. Continue to explore Cetus' incentive programs (such as Farms).

Disclaimer: The content above is only the author's opinion which does not represent any position of Followin, and is not intended as, and shall not be understood or construed as, investment advice from Followin.
Like
Add to Favorites
Comments