Architecture Overview

Product Flow in Detail

1

Phase 1: Token Creation

What happens:
  • User calls deployBondkitToken() on the Factory contract
  • Factory clones the Implementation contract using minimal proxy pattern
  • New token is initialized with custom parameters
  • Token enters bonding phase automatically
Gas cost: ~200,000 gas (90% cheaper than full deployment) Time: ~15 seconds
2

Phase 2: Bonding Curve Trading

What happens:
  • Users buy/sell tokens directly from the contract
  • Price follows algorithmic bonding curve: S = S_final × (R/R_target)^exponent
  • 5% fee on all trades goes to fee recipient
  • Contract accumulates quote assets (ETH/B3) toward target
  • Backend indexes all transactions for analytics
Trading mechanics:
  • Buy: Send ETH/B3, receive tokens at current curve price
  • Sell: Send tokens, receive ETH/B3 minus fees
  • Automatic refunds if purchase would exceed target
Duration: Until target is reached (hours to weeks)
3

Phase 3: DEX Migration

What happens:
  • Admin calls migrateToDex() when target is reached
  • Contract calculates fair market price as sqrtPriceX96
  • Creates and initializes Uniswap v4 pool
  • Transfers accumulated liquidity to pool
  • Renounces ownership to zero address
  • Token becomes standard ERC20 with DEX trading
Post-migration:
  • Bonding curve permanently disabled
  • All trading via Uniswap v4
  • No admin controls remain
  • Full decentralization achieved
Gas cost: ~500,000 gas Time: ~30 seconds

System Components

Smart Contracts

Backend Services

User Roles

RoleResponsibilitiesPermissions
CreatorDeploy token, set parameters, initiate migrationFull control until migration
TradersBuy/sell during bonding, trade on DEXStandard trading rights
Fee RecipientReceive trading feesPassive income only
Migration AdminExecute migration when readyOne-time migration right
LP Providers(Post-migration) Add liquidity to UniswapStandard LP rights

Technical Deep Dive

Bonding Curve Mathematics

The bonding curve determines token price based on supply:
Price Formula:
S = S_final × (R / R_target)^exponent

Where:
- S = Current token supply
- S_final = Final token supply
- R = Raised amount (ETH/B3)
- R_target = Target amount
- exponent = 1 / (1 + aggressivenessFactor/100)
Example Calculations:
AggressivenessExponentPrice Behavior
01.00Linear (constant price)
250.80Gentle curve
500.67Moderate curve
750.57Steep curve
1000.50Very steep (square root)

Migration Price Calculation

When migrating to Uniswap v4, the contract:
  1. Calculates exit price from bonding curve
  2. Converts to sqrtPriceX96 format:
    sqrtPriceX96 = sqrt(price) × 2^96
    
  3. Initializes pool with this price
  4. Adds liquidity using accumulated funds

Gas Optimization Techniques

Minimal Proxy Pattern (EIP-1167)Instead of deploying full contract code for each token:
  • Deploy one implementation contract (600KB)
  • Deploy tiny proxy contracts (45 bytes each)
  • Proxies delegate all calls to implementation
  • Result: 90% gas savings per deployment

Configuration Parameters

Token Creation Parameters

ParameterTypeRange/FormatImpact
namestring1-50 charsToken display name
symbolstring2-10 charsTrading symbol
finalTokenSupplyuint256> 0Total mintable tokens
aggressivenessFactoruint80-100Curve steepness
targetEthuint256> 0Migration threshold
feeRecipientaddressValid addressReceives fees
lpSplitRatioFeeRecipientBpsuint2560-10000LP fee share (basis points)
migrationAdminAddressaddressValid addressCan trigger migration

Runtime Parameters

ActionParametersValidation
BuyminTokensOut, ethAmountSlippage protection
SelltokenAmount, minEthOutBalance check, slippage
MigrateNoneTarget reached, admin only

System Constants

ConstantValueDescription
Trading Fee5%Applied to all trades
Decimals18Standard ERC20 decimals
Min Target0.1 ETHMinimum viable target
Max Aggressiveness100Maximum curve factor

Security Considerations

Important Security Features:
  1. Ownership Renouncement: Automatic after migration
  2. No Mint Function: Supply fixed at creation
  3. Immutable Parameters: Cannot be changed post-deployment
  4. Audited Contracts: Professionally reviewed code
  5. No Admin Backdoors: True decentralization
  6. Slippage Protection: Built into buy/sell functions
  7. Overflow Protection: Safe math throughout

Failure Scenarios & Handling

ScenarioSystem Response
Buy exceeds targetPartial fill, refund excess
Insufficient liquidity for sellTransaction reverts
Migration before targetTransaction reverts
Non-admin attempts migrationTransaction reverts
Double migration attemptTransaction reverts
Zero address operationsTransaction reverts

Next Steps