Third-Party Integration Guide
Complete documentation for integrating SUI Lab Factory pool creation into your smart contracts and applications.
Overview
SUI Lab Factory allows third-party developers to programmatically create liquidity pools from their smart contracts or applications. Our infrastructure is battle-tested and handles all the complexity of pool management.
No DEX Development
Use our proven infrastructure
Instant Liquidity
Pools ready in one transaction
Competitive Fees
1.5% swap fee (1% LP + 0.5% protocol)
Free Operations
No fees for add/remove liquidity
📋 Prerequisites
Before integration, youll need:
- 1.Factory Object ID (shared object)
- 2.3 SUI for pool creation fee
- 3.Tokens for initial liquidity (Token A + Token B)
- 4.Clock Object (0x6 - standard SUI Clock)
Method 1: From Move Smart Contract
Best for: Automated protocols, launchpads, DAOs
module my_protocol::pool_creator {
use sui::coin::{Self, Coin};
use sui::sui::SUI;
use sui::clock::Clock;
// Import SUI Lab Factory
use suilab_factory::factory::{Self, Factory};
use suilab_factory::lp_coin::LP;
/// Create a liquidity pool from your protocol
public entry fun create_pool_for_token<TokenA, TokenB>(
factory: &mut Factory,
token_a: Coin<TokenA>,
token_b: Coin<TokenB>,
payment: Coin<SUI>, // Must be >= 3 SUI
clock: &Clock,
ctx: &mut TxContext
) {
// Create the pool using Factory's public function
let (pool_id, lp_tokens) = factory::create_pool_from_contract<TokenA, TokenB>(
factory,
payment, // 3 SUI creation fee
token_a, // Your token
token_b, // Paired token (often SUI)
clock,
ctx
);
// Transfer LP tokens to caller
transfer::public_transfer(lp_tokens, tx_context::sender(ctx));
// Or burn for permanent liquidity:
// transfer::public_transfer(lp_tokens, @0x0);
}
}Method 2: From TypeScript/JavaScript
Best for: Web apps, backend services, trading bots
import { Transaction } from '@mysten/sui/transactions';
import { SuiClient } from '@mysten/sui/client';
const FACTORY_ID = "0x7fde6f522facdf8708aca3152edc5725f5c00ee5e3341b8baac28cb17962cb3e"; // Mainnet
async function createPoolFromDApp(
client: SuiClient,
tokenAType: string,
tokenBType: string,
tokenACoinId: string,
tokenBCoinId: string,
suiPaymentCoinId: string
) {
const txb = new Transaction();
const [poolId, lpCoin] = txb.moveCall({
target: `${FACTORY_ID}::factory::create_pool_from_contract`,
typeArguments: [tokenAType, tokenBType],
arguments: [
txb.object(FACTORY_ID),
txb.object(suiPaymentCoinId),
txb.object(tokenACoinId),
txb.object(tokenBCoinId),
txb.object('0x6'), // Clock
],
});
txb.transferObjects([lpCoin], txb.pure.address(senderAddress));
const result = await client.signAndExecuteTransaction({
transaction: txb,
signer: keypair,
});
return result;
}🔧 Configuration
Object IDs
| Network | Factory ID |
|---|---|
| Mainnet | 0x7fde6f522facdf8708aca3152edc5725f5c00ee5e3341b8baac28cb17962cb3e |
| Testnet | Coming soon |
Fee Structure
| Operation | Fee |
|---|---|
| Create Pool | 3 SUI (one-time) |
| Add Liquidity | FREE ✅ |
| Remove Liquidity | FREE ✅ |
| Swap | 1.5% (1% to LPs + 0.5% protocol) |
⚠️ Important Notes
Token Order Matters
The factory sorts tokens alphabetically by type name. Make sure to use the correct order to avoid failures.
Minimum Liquidity
For security, the first 1000 LP tokens are locked forever (anti-rug mechanism).