current location:Home >> Blockchain knowledge >> Two Methods for Creating Cetus Stable Pools on the Sui Blockchain

Two Methods for Creating Cetus Stable Pools on the Sui Blockchain

admin Blockchain knowledge 374

Introduction

The Sui blockchain is a high-performance Layer 1 blockchain known 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 efficient AMM (Automated Market Maker) mechanisms. Stable Pools in Cetus are liquidity pool types specifically designed for stablecoins. They use a constant sum function or hybrid model to minimize impermanent loss, making them suitable for trading stable assets like USDC and USDT.


This tutorial will guide you through creating a custom Cetus Stable Pool on the Sui Mainnet. We’ll cover two methods: the first requires some Sui development knowledge and Move language basics; the second uses the GTokenTool one-click token platform and requires no specialized expertise. Note: Blockchain operations involve risks—always back up your wallet and practice on the Testnet first. Creating a pool may incur Gas fees, and providing liquidity should be carefully evaluated.

Prerequisites

Before starting, ensure you have the following:

  1. Sui Wallet: Install a Sui wallet (like the Sui Wallet browser extension) or use the Sui CLI. Make sure your wallet has enough SUI tokens (at least 10-20 SUI for Gas fees).

  2. Sui CLI Tool: Install Sui CLI (version 1.0+). Use the following command:

    bash
    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): For automation scripts.

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

    bash
    npm install @cetusprotocol/cetus-sui-clmm-sdk
  5. Stablecoin Assets: Prepare the stablecoins you want to add to the pool (e.g., USDC on Sui) and ensure sufficient liquidity (at least $1,000 equivalent).

  6. Development Environment: VS Code with the Move plugin and familiarity with Sui Move language.

  7. Network: This tutorial targets the Sui Mainnet; switch to the Testnet for testing.

Warning: Before providing liquidity, verify the security of Cetus contracts.


Method 1: Manual Creation with Sui CLI and Cetus SDK

Step 1: Set Up Sui CLI and Wallet

  1. Initialize Sui CLI:

    bash
    sui client new-env --alias mainnet
    sui client switch --env mainnet
    sui client active-address  # Display current address
  2. Import or create a wallet:
    If using CLI: sui keytool import ... (import from seed phrase).
    Ensure your wallet is connected to the Sui Wallet extension and grants CLI access.

  3. Check your balance:

    bash
    sui client gas

    If SUI is insufficient, transfer from an exchange.

Step 2: Understand Cetus Stable Pool Structure
Cetus Stable Pools use a CLMM (Concentrated Liquidity Market Maker) variant supporting multi-asset stable pools (2–4 tokens). Key parameters include:

  • Tick Spacing: Controls price ranges (typically 1–10 for stable pools).

  • Initial Price: Based on pegged assets (e.g., 1 USDC = 1 USDT).

  • Fee Rate: Recommended 0.01%–0.05% for stable pools.

Step 3: Prepare Move Contract (If Customizing)
Cetus provides a ready-to-use SDK, but if customization is needed, write a Move module:

  1. Create a new Sui Move project:

    bash
    sui move new my_stable_poolcd my_stable_pool
  2. Create stable_pool.move in the sources/ directory:

    move
    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;  // Assume 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 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 parameters
        }
    }

    Note: This is a simplified example. Use Cetus SDK’s createPool function in practice. Compile and test: sui move build.

Step 4: Create Pool Using Cetus SDK

  1. Install dependencies and configure the SDK:

    javascript
    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 a creation script createPool.js:

    javascript
    async function createStablePool() {
        // Asset types: e.g., USDC and USDT Object IDs
        const coinTypeA = '0x...::usdc::USDC';  // Replace with actual type
        const coinTypeB = '0x...::usdt::USDT';
    
        // Parameters
        const tickSpacing = 1;  // Tight spacing for stable pools
        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:

    bash
    node createPool.js

    This creates the pool and returns the Pool ID.

Step 5: Add Initial Liquidity
Activate the pool by providing liquidity:

  1. Use the SDK’s addLiquidity function:

    javascript
    // Continuing from the previous exampleconst poolId = '0x...';  // Obtain from the resultconst amountA = 1000 * 1e6;  // 1000 USDC (6 decimals)const amountB = 1000 * 1e6;  // 1000 USDTconst liquidityTx = await sdk.Position.addLiquidityTransaction({
        poolID: poolId,
        amountA,
        amountB,
        lowerTick: -100,  // Price range
        upperTick: 100,});// Sign and execute as above
  2. Approve tokens: Ensure your wallet approves the Cetus contract to spend your stablecoins.

  3. Verify: Check the pool status on Sui Explorer (https://suiexplorer.com).

Step 6: Testing and Deployment

  1. Testnet Testing: Switch to the Testnet and repeat the steps. Get Testnet SUI from the faucet.

  2. Mainnet Deployment: Execute on Mainnet after confirming all parameters.

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


Method 2: One-Click Creation via GTokenTool

  1. Connect Wallet
    Go to the liquidity creation page: https://sui.gtokentool.com/LiquidityManagement/createPool
    Select the Main network in the top-right corner and connect your wallet (Suiet wallet is recommended).

  2. Select Base Token
    Choose the base token, and its balance will be displayed below.

  3. Select Quote Token
    Choose the quote token, and its balance will be shown.

  4. Set Initial Price
    Configure the initial price for the pool.

  5. Enter Quote Token Amount for Pool
    Enter the quote token amount for the pool—the base token amount will be calculated automatically.

  6. Click "Create"
    A wallet pop-up will appear; click confirm. After the transaction succeeds, the transaction hash will be displayed below. Click the hash to view the transaction on the blockchain explorer.

Two Methods for Creating Cetus Stable Pools on the Sui Blockchain


Troubleshooting Common Issues

  • Insufficient Gas: Increase SUI balance or optimize the transaction.

  • Contract Errors: Check Move compilation logs. Common issues: type mismatches or tick out-of-bounds.

  • Unbalanced Liquidity: Stable pools require an initial ratio close to 1:1.

  • SDK Version: Ensure it matches the latest Cetus version (npm update).

  • If Failed: Check transaction logs via result.effects.


Conclusion

Congratulations! You’ve successfully created a Cetus Stable Pool on Sui. This provides an opportunity for passive income through trading fee shares. Continue exploring Cetus incentive programs (e.g., farms).

If you have any questions or uncertainties, please join the official Telegram group: https://t.me/GToken_EN

GTokenTool

GTokenTool is the most comprehensive one click coin issuance tool, supporting multiple public chains such as TON, SOL, BSC, etc. Function: Create tokensmarket value managementbatch airdropstoken pre-sales IDO、 Lockpledge mining, etc. Provide a visual interface that allows users to quickly create, deploy, and manage their own cryptocurrencies without writing code.

Similar recommendations