What is the Bonding Phase?

The bonding phase is the initial trading period where tokens are bought and sold directly from a smart contract using an algorithmic pricing curve. Think of it as a decentralized pre-sale with automatic market making.

mermaid
stateDiagram-v2 [*] --> Created: Token Deployed Created --> Bonding: Automatic Bonding --> Bonding: Buy/Sell Trades Bonding --> MigrationReady: Target Reached MigrationReady --> DEX: migrateToDex() DEX --> [*]: Fully Decentralized note right of Bonding Direct contract trading Algorithmic pricing 5% trading fee Accumulates liquidity end note note right of DEX Uniswap v4 trading Market-driven price Standard LP fees No admin control end note

How Bonding Works

The Bonding Curve Mechanism

During bonding, the contract acts as the sole market maker:

  1. No Order Book: Prices determined algorithmically
  2. Instant Liquidity: Always able to buy or sell
  3. Path Independence: Price depends only on supply, not history
  4. Automatic Pricing: No manual price setting needed

Trading Operations

Buying Tokens

Process Flow:

  1. User sends trading token (B3/ETH) to contract
  2. Contract calculates tokens based on curve
  3. 5% fee deducted and sent to recipient
  4. Tokens minted and sent to buyer
  5. Curve state updated

Code Example:

typescript
// Get a quote firstconst quote = await token.getAmountOfTokensToBuy( parseEther("100") // 100 trading tokens);console.log(`Will receive: ${formatEther(quote)} tokens`);// Execute purchase with slippage protectionconst minTokens = quote * 0.95n; // 5% slippageawait token.buy(parseEther("100"), minTokens);

Selling Tokens

Process Flow:

  1. User approves token spending
  2. User calls sell with token amount
  3. Contract calculates trading token amount based on curve
  4. 5% fee deducted from proceeds
  5. Trading token sent to seller, tokens burned
  6. Curve state updated (price decreases)

Code Example:

typescript
// Check balance and get quoteconst balance = await token.balanceOf(userAddress);const sellAmount = balance / 2n; // Sell halfconst quote = await token.getAmountOfTradingTokensToSell( sellAmount);console.log(`Will receive: ${formatEther(quote)} trading tokens`);// Execute sale with slippage protectionconst minTradingTokenOut = quote * 0.95n; // 5% slippageawait token.sell(sellAmount, minTradingTokenOut);

Fee Structure

How Fees Work

mermaid
graph LR A[User Trade] -->|100%| B[Contract] B -->|95%| C[Curve/User] B -->|5%| D[Fee Recipient] style A fill:#e1f5fe style D fill:#c8e6c9

On a 1 trading token purchase:

  • 0.95 trading tokens go to bonding curve
  • 0.05 trading tokens go to fee recipient
  • Tokens calculated on 0.95 trading token value

Example:

typescript
// User sends 1 trading token// Fee: 0.05 trading token// Curve receives: 0.95 trading token// Tokens minted based on 0.95 trading token

On selling for 1 trading token value:

  • User receives 0.95 trading tokens
  • 0.05 trading tokens go to fee recipient
  • Curve reduced by full 1 trading token

Example:

typescript
// Tokens worth 1 trading token on curve// Fee: 0.05 trading token// User receives: 0.95 trading tokens// Curve drops by 1 trading token

Where fees go:

  • 100% to designated feeRecipient address
  • Can be project treasury, developer, or DAO
  • Set at token creation, cannot be changed

Claiming fees:

  • Automatic - no claiming needed
  • Sent directly on each trade
  • No accumulation in contract

Fee Economics

Daily VolumeFee IncomeMonthly Income
10 trading tokens0.5 trading tokens~15 trading tokens
50 trading tokens2.5 trading tokens~75 trading tokens
100 trading tokens5 trading tokens~150 trading tokens
500 trading tokens25 trading tokens~750 trading tokens

Target Mechanics

Understanding the Target

The target is the amount of trading token that must be accumulated before migration:

Info

Target Purpose:

  • Ensures sufficient liquidity for Uniswap v4
  • Creates a clear goal for the community
  • Prevents premature migration
  • Builds momentum during bonding

Approaching the Target

typescript
// Monitor progress toward targetasync function trackProgress(token: BondkitToken) { const progress = await token.getBondingProgress(); if (progress.progress < 0.5) { console.log("🌱 Early stage - best prices available"); } else if (progress.progress < 0.8) { console.log("🚀 Momentum building - consider buying"); } else if (progress.progress < 1.0) { console.log("🔥 Almost there - migration imminent"); } else { console.log("✅ Target reached - ready to migrate!"); } const remaining = progress.threshold - progress.raised; console.log(`Need ${formatEther(remaining)} more trading token`);}

Overflow Handling

When a purchase would exceed the target:

  1. Partial Fill: Only the amount needed is accepted
  2. Automatic Refund: Excess returned in same transaction
  3. Fair Completion: No one can overpay at the end

Example Scenario:

text
Target: 100 trading tokensCurrent: 99.5 trading tokensUser sends: 2 trading tokensResult:- 0.5 trading tokens accepted (reaches exactly 100)- 1.5 trading tokens refunded- User gets tokens for 0.5 trading tokens- Migration now available

Events & Monitoring

Contract Events

solidity
event BondingCurveBuy( address indexed payer, address indexed recipient, uint256 tradingTokenIn, uint256 tokensOut, uint256 fee, uint256 totalRaisedBonding);

Listening in SDK:

typescript
token.onBuy((event) => { console.log({ buyer: event.payer, ethSpent: formatEther(event.tradingTokenIn), tokensReceived: formatEther(event.tokensOut), feePaid: formatEther(event.fee), totalRaised: formatEther(event.totalRaisedBonding) });});

Real-Time Monitoring

typescript
// Complete monitoring setupclass BondingMonitor { constructor(private token: BondkitToken) {} async start() { // Initial state const progress = await this.token.getBondingProgress(); console.log(`Starting at ${(progress.progress * 100).toFixed(2)}%`); // Monitor buys this.token.onBuy(async (event) => { const newProgress = await this.token.getBondingProgress(); console.log(`BUY: ${formatEther(event.tokensOut)} tokens`); console.log(`Progress: ${(newProgress.progress * 100).toFixed(2)}%`); if (newProgress.progress >= 1.0) { console.log("🎆 TARGET REACHED! Migration available."); } }); // Monitor sells this.token.onSell(async (event) => { const newProgress = await this.token.getBondingProgress(); console.log(`SELL: ${formatEther(event.tokensIn)} tokens`); console.log(`Progress: ${(newProgress.progress * 100).toFixed(2)}%`); }); }}// Usageconst monitor = new BondingMonitor(token);await monitor.start();

Bonding Phase Strategies

For Token Creators

Build Momentum
  • Start with lower aggressiveness (30-50)
  • Set achievable targets
  • Engage community early
  • Provide clear roadmap
Maximize Success
  • Seed initial liquidity yourself
  • Create buying incentives
  • Time announcements well
  • Plan for post-migration

For Traders

Entry Strategy
  • Buy early for best prices
  • Use DCA for large amounts
  • Monitor aggressiveness factor
  • Check target progress
Risk Management
  • Always use slippage protection
  • Understand price impact
  • Don't FOMO near target
  • Plan exit strategy

Post-Bonding Transition

Warning

Critical: After Migration

Once migrateToDex() is called:

  • ❌ Bonding curve trading permanently disabled
  • ❌ No more buy() or sell() functions
  • ✅ All trading moves to Uniswap v4
  • ✅ Standard AMM mechanics apply
  • ✅ Anyone can provide liquidity
  • ✅ Fully decentralized trading

Next Steps

Pricing Guide

Understand price mechanics

Learn More
Target Setting

Choose the right target

Learn More
Token Lifecycle

Learn about DEX transition

Learn More
Ask a question... ⌘I