Back to Integration
Integration Recipes
Production Code Examples
Reference implementations for automated launchpad bonding curve graduation, DAO multi-sig treasury pools, and modern client-side React dApps.
Recipe 1
Automated Launchpad Bonding Curve Graduation & LP Burn
When tokens reach graduation (e.g. 10,000 SUI deposited into the bonding curve), automatically deploy the DEX pool and burn 98% of LP tokens permanently by sending them to @0x0:
launchpad_graduation.move
Sui Move// Example 1: Automated Launchpad Graduation & 98% LP Burn
module my_launchpad::graduation_router {
use sui::coin::{Self, Coin};
use sui::sui::SUI;
use sui::clock::Clock;
use suilab_factory::factory::{Self, Factory};
/// Triggered when bonding curve reaches 10,000 SUI target
public entry fun graduate_to_dex_pool<T>(
curve_vault: &mut CurveVault<T>,
factory: &mut Factory,
fee_payment: Coin<SUI>, // 0.8 SUI pool creation fee
clock: &Clock,
ctx: &mut TxContext
) {
// 1. Verify graduation threshold reached
assert!(curve_vault.collected_sui >= 10_000_000_000_000, E_TARGET_NOT_REACHED);
// 2. Extract liquidity reserves from bonding curve vault
let sui_reserve = extract_sui_liquidity(curve_vault, ctx);
let token_reserve = extract_token_liquidity(curve_vault, ctx);
// 3. Deploy AMM pool atomically via PumpSui Factory
let (pool_id, mut lp_tokens) = factory::create_pool_from_contract<T, SUI>(
factory,
fee_payment,
token_reserve,
sui_reserve,
clock,
ctx
);
// 4. Burn 98% of LP tokens permanently for rug-proof liquidity
let lp_total = coin::value(&lp_tokens);
let lp_to_burn = (lp_total * 98) / 100;
let burn_coin = coin::split(&mut lp_tokens, lp_to_burn, ctx);
transfer::public_transfer(burn_coin, @0x0);
// 5. Transfer remaining 2% LP tokens to community staking vault
transfer::public_transfer(lp_tokens, curve_vault.community_vault);
}
}Recipe 2
DAO Governance Multi-Sig Liquidity Injection
Execute approved governance proposals that seed liquidity pairs with treasury capital and deposit LP tokens into multi-sig timelocks:
dao_liquidity_executor.move
Sui Move// Example 2: DAO Treasury Governance Pool Creation
module my_dao::treasury_executor {
use sui::coin::{Self, Coin};
use sui::sui::SUI;
use sui::clock::Clock;
use suilab_factory::factory::{Self, Factory};
public entry fun execute_dao_pool_proposal<GOV>(
proposal: &ProposalRecord,
factory: &mut Factory,
gov_coins: Coin<GOV>,
sui_coins: Coin<SUI>,
creation_fee: Coin<SUI>, // 0.8 SUI
clock: &Clock,
ctx: &mut TxContext
) {
// Assert governance vote passed and proposal is active
assert!(proposal.is_passed && !proposal.is_executed, E_INVALID_PROPOSAL);
// Deploy verified DAO liquidity pool
let (pool_id, lp_tokens) = factory::create_pool_from_contract<GOV, SUI>(
factory,
creation_fee,
gov_coins,
sui_coins,
clock,
ctx
);
// Lock LP tokens directly into DAO multi-sig timelock
transfer::public_transfer(lp_tokens, proposal.timelock_address);
}
}Recipe 3
Client-Side React Component with @mysten/dapp-kit
Plug-and-play UI button for decentralized web applications requesting user wallet signatures to initialize a pool:
CreatePoolAction.tsx
React 19 / TSX// Example 3: Client-Side React Component with @mysten/dapp-kit
import { useSignAndExecuteTransaction, useCurrentAccount } from '@mysten/dapp-kit';
import { SuiClient } from '@mysten/sui/client';
import { PumpSuiFactorySDK, parseSUI } from '@pumpsui/token-creator-sdk';
import { useState } from 'react';
export function CreatePoolAction({ tokenType }: { tokenType: string }) {
const currentAccount = useCurrentAccount();
const { mutate: signAndExecute } = useSignAndExecuteTransaction();
const [loading, setLoading] = useState(false);
const handleCreatePool = async () => {
if (!currentAccount) return alert('Connect wallet first');
setLoading(true);
try {
const client = new SuiClient({ url: 'https://fullnode.mainnet.sui.io:443' });
const sdk = new PumpSuiFactorySDK(client, 'MAINNET');
// 1. Build atomic PTB
const txb = await sdk.createPoolTransaction({
tokenAType: '0x2::sui::SUI',
tokenBType: tokenType,
tokenAAmount: parseSUI(250), // 250 SUI seed liquidity
tokenBAmount: 50_000_000_000_000n, // 50,000,000 tokens
senderAddress: currentAccount.address,
});
// 2. Sign and broadcast
signAndExecute(
{ transaction: txb },
{
onSuccess: (tx) => {
console.log('Pool successfully deployed! Digest:', tx.digest);
setLoading(false);
},
onError: (err) => {
console.error('Failed to create pool:', err);
setLoading(false);
}
}
);
} catch (e) {
console.error(e);
setLoading(false);
}
};
return (
<button
onClick={handleCreatePool}
disabled={loading || !currentAccount}
className="px-6 py-3 rounded-xl bg-gradient-to-r from-cyan-400 to-blue-500 font-bold text-slate-950 font-mono text-xs uppercase hover:opacity-90 transition-all shadow-[0_0_20px_rgba(18,181,245,0.3)] disabled:opacity-50"
>
{loading ? 'Creating On-Chain Pool...' : 'Deploy Liquidity Pool (0.8 SUI)'}
</button>
);
}