Overview
The RektHubFactory is the central hub of the RektHub protocol. It’s your single entry point for creating creator tokens, trading, and managing the entire token lifecycle. Think of it as the conductor of an orchestra, coordinating token creation, routing trades, and managing graduations across the creator economy.For Integrators: Always use the Factory as your primary interface. It
ensures consistency, proper fee distribution, and seamless cross-contract
interactions.
Purpose & Architecture
What It Does
- Token Creation: Deploys new creator tokens with bonding curves
- Trade Routing: Routes buy/sell orders to the correct bonding curve
- Fee Management: Collects platform fees
- Graduation Control: Manages token migration to DEX (owner-only)
- Address Discovery: Maps tokens to their bonding curves
Why It Matters
The Factory pattern provides:- Gas Efficiency: Uses minimal proxies (EIP-1167) to clone implementations
- Isolation: Each token gets its own bonding curve with isolated state
- Upgradeability: New features can be added without affecting existing tokens (not an upgradeable contract though)
- Single Source of Truth: All critical operations go through one audited contract
Key Functions
Token Creation
createToken
string
required
Token name (e.g., “Creator Coin”)
string
required
Token symbol (e.g., “CRTR”)
string
required
URI pointing to token metadata JSON
tokenAddress: Address of the deployed tokencurveAddress: Address of the bonding curve
TokenCreated
createTokenDeterministic
Create a token with a vanity address using CREATE2.
string
required
Token name
string
required
Token symbol
string
required
Metadata URI
bytes32
required
CREATE2 salt (pre-mined for vanity address)
tokenAddress: Deterministic token addresscurveAddress: Deterministic curve address
TokenCreated
predictAddresses
Preview the addresses that will be created with a given salt.
bytes32
required
CREATE2 salt
predictedToken: Token address that will be createdpredictedCurve: Curve address that will be created
Trading Functions
buy
Purchase creator tokens from any deployed curve.
address
required
Address of the token to buy
uint256
required
Minimum tokens expected (slippage protection)
tokensReceived: Actual amount of tokens received
TokenPurchased
sell
Sell creator tokens back to the bonding curve.
address
required
Address of the token to sell
uint256
required
Amount of tokens to sell
uint256
required
Minimum native tokens expected (slippage protection)
nativeReceived: Amount of native tokens received
TokenSold
sellPercentage
Sell a percentage of your token balance, perfect for “Sell 25%” buttons.
address
required
Address of the token to sell
uint256
required
Percentage in basis points (5000 = 50%, 10000 = 100%)
uint256
required
Minimum native tokens expected
nativeReceived: Amount of native tokens received
TokenSold
Admin Functions
migrate
Graduate a bonded token to DEX. Owner-only function.
address
required
Address of the token to migrate
address
required
Address of the DEX migrator contract
poolAddress: Address of the created liquidity poolplatformName: Name of the DEX platform
TokenMigrated
- Token must be bonded (all 850M tradeable tokens sold)
- Token must not already be graduated
- Caller must be contract owner
- Migrator must implement
IDEXMigratorinterface
For Creators: You cannot manually trigger migration. Graduation is handled
by RektHub’s automated systems after your token bonds and you select your
preferred DEX.
withdrawFees
Withdraw accumulated platform fees. Owner-only function.
Example:
View Functions
getCurve
Get the bonding curve address for a token.
address
required
Token address
address: Bonding curve address
getCreationFee
Get the current token creation fee.
Returns:
uint256: Creation fee in native tokens
Events
TokenCreated
Emitted when a new token is deployed.- Track new token launches
- Build trending token feeds
- Creator analytics dashboards
TokenPurchased
Emitted when tokens are bought through the factory.- Real-time trade feeds
- Price charts and volume tracking
- Creator earnings dashboards
TokenSold
Emitted when tokens are sold through the factory.TokenMigrated
Emitted when a token graduates to DEX.FeesWithdrawn
Emitted when platform fees are withdrawn.Integration Tips
Always Use Factory for Consistency
Handle Events Efficiently
Multi-Chain Setup
Next Steps
Bonding Curve Contract
Learn about the trading engine
Token Contract
Understand creator token standards
Buying Guide
Deep dive into buying patterns
Events Reference
Complete events documentation