Overview
RektHub contracts emit detailed events for every significant action. This page is your complete reference for building indexers, dashboards, bots, and real-time UIs.
Pro Tip: Events are indexed by key parameters (token address, buyer/seller,
creator) for efficient querying. Use filters to subscribe to specific tokens or
users.
Factory Events
Events emitted by the RektHubFactory contract.
TokenCreated
Emitted when a new creator token is deployed.
event TokenCreated(
address indexed tokenAddress,
address indexed curveAddress,
address indexed creator,
string name,
string symbol,
string uri,
uint256 realNativeReserves,
uint256 realTokenReserves,
uint256 virtualNativeReserves,
uint256 virtualTokenReserves,
uint256 creationFee
);
Address of the deployed token contract
Address of the bonding curve contract
Address of the token creator
Initial real native reserves (always 0 at creation)
Initial real token reserves (850,000,000 tokens)
Initial virtual native reserves (set by factory)
Initial virtual token reserves (1,073,000,000 tokens)
Fee paid for token creation
Use Cases:
- Track new token launches in real-time
- Build “New Tokens” feed
- Analytics on creator activity
- Notification systems for followers
Example:
factory.on(
'TokenCreated',
(tokenAddress, curveAddress, creator, name, symbol, uri) => {
console.log(`${name} (${symbol}) launched by ${creator}`);
// Fetch metadata
fetchMetadata(uri).then((metadata) => {
displayNewToken({
address: tokenAddress,
name,
symbol,
creator,
image: metadata.image,
socials: metadata.social_links,
});
});
}
);
TokenPurchased
Emitted when tokens are bought through the factory router.
event TokenPurchased(
address indexed token,
address indexed curve,
address indexed buyer,
uint256 nativeIn,
uint256 tokensOut,
uint256 totalFee,
uint256 creatorFee,
uint256 platformFee,
uint256 newRealNativeReserves,
uint256 newRealTokenReserves,
uint256 newVirtualNativeReserves,
uint256 newVirtualTokenReserves
);
Token address that was purchased
Amount of native tokens spent (including fees)
Amount of tokens received
Total fee charged (1% of nativeIn)
Creator’s portion of fee (30% of totalFee)
Platform’s portion of fee (70% of totalFee)
Real native reserves after purchase
Real token reserves after purchase
Virtual native reserves after purchase
Virtual token reserves after purchase
Use Cases:
- Real-time trade feeds
- Price chart updates (calculate price from reserves)
- Volume tracking
- Creator earnings dashboards
- Whale watching (large buys)
Example:
// Listen for buys on a specific token
const filter = factory.filters.TokenPurchased(tokenAddress);
factory.on(
filter,
(
token,
curve,
buyer,
nativeIn,
tokensOut,
totalFee,
creatorFee,
platformFee,
newRealNativeReserves,
newRealTokenReserves
) => {
const price = nativeIn / tokensOut;
const newPrice =
newRealNativeReserves / (850_000_000n * 10n ** 18n - newRealTokenReserves);
const priceImpact = ((newPrice - price) / price) * 100;
console.log(` Buy: ${ethers.formatEther(tokensOut)} tokens`);
console.log(` Spent: ${ethers.formatEther(nativeIn)}`);
console.log(` Price impact: ${priceImpact.toFixed(2)}%`);
console.log(` Creator earned: ${ethers.formatEther(creatorFee)}`);
// Update UI
updatePriceChart(newPrice);
updateVolume(nativeIn);
updateCreatorEarnings(creatorFee);
}
);
TokenSold
Emitted when tokens are sold through the factory router.
event TokenSold(
address indexed token,
address indexed curve,
address indexed seller,
uint256 tokensIn,
uint256 nativeOut,
uint256 totalFee,
uint256 creatorFee,
uint256 platformFee,
uint256 newRealNativeReserves,
uint256 newRealTokenReserves,
uint256 newVirtualNativeReserves,
uint256 newVirtualTokenReserves
);
Token address that was sold
Amount of native tokens received (after fees)
Total fee charged (1% of gross native out)
Creator’s portion of fee (30% of totalFee)
Platform’s portion of fee (70% of totalFee)
Real native reserves after sale
Real token reserves after sale
Virtual native reserves after sale
Virtual token reserves after sale
Use Cases:
- Track selling pressure
- Identify panic sells or whale exits
- Update price charts (sells move price down)
- Creator earnings tracking
Example:
factory.on(
'TokenSold',
(token, curve, seller, tokensIn, nativeOut, totalFee, creatorFee) => {
console.log(` Sell: ${ethers.formatEther(tokensIn)} tokens`);
console.log(` Received: ${ethers.formatEther(nativeOut)}`);
console.log(` Creator still earned: ${ethers.formatEther(creatorFee)}`);
// Check if it's a whale sell (>1% of supply)
const sellSize = tokensIn / (850_000_000n * 10n ** 18n);
if (sellSize > 0.01) {
notifyWhaleActivity('sell', seller, tokensIn);
}
}
);
TokenMigrated
Emitted when a token graduates to DEX.
event TokenMigrated(
address indexed tokenAddress,
address indexed curveAddress,
address indexed poolAddress,
string platformName,
uint256 nativeLiquidity,
uint256 tokenLiquidity,
uint256 migrationFee,
uint256 creatorFee,
uint256 platformFee
);
Bonding curve that was closed
Address of created liquidity pool
Name of the DEX platform (e.g., “Uniswap V2”)
Amount of native tokens added to pool (after 12% migration fee)
Amount of tokens added to pool (~223M if fully bonded)
Total migration fee (12% of native liquidity)
Creator’s portion (60% of migrationFee = 7.2% of liquidity)
Platform’s portion (40% of migrationFee = 4.8% of liquidity)
Use Cases:
- Graduation announcements
- Redirect users to DEX for trading
- Track graduation success rates
- Creator milestone notifications
Example:
factory.on(
'TokenMigrated',
(
tokenAddress,
curveAddress,
poolAddress,
platformName,
nativeLiquidity,
tokenLiquidity,
migrationFee,
creatorFee
) => {
console.log(` Token graduated to ${platformName}!`);
console.log(` Pool: ${poolAddress}`);
console.log(` Liquidity: ${ethers.formatEther(nativeLiquidity)} native`);
console.log(
` Creator earned: ${ethers.formatEther(creatorFee)} from migration`
);
// Notify users and redirect
showGraduationModal({
token: tokenAddress,
dex: platformName,
poolUrl: `https://app.uniswap.org/pools/${poolAddress}`,
});
}
);
FeesWithdrawn
Emitted when platform owner withdraws accumulated fees.
event FeesWithdrawn(
address indexed recipient,
uint256 amount
);
Address receiving the fees (contract owner)
Use Cases:
- Protocol revenue tracking
- Transparency dashboards
Bonding Curve Events
Events emitted by individual BondingCurve contracts.
TokenPurchased (Curve)
Identical to Factory’s TokenPurchased, but emitted by the curve itself.
event TokenPurchased(
address indexed buyer,
uint256 nativeIn,
uint256 tokensOut,
uint256 totalFee,
uint256 creatorFee,
uint256 platformFee,
uint256 newRealNativeReserves,
uint256 newRealTokenReserves,
uint256 newVirtualNativeReserves,
uint256 newVirtualTokenReserves
);
Difference from Factory: No token or curve parameters since those are
implicit (the event is emitted by the curve itself).
Example:
// Listen directly to a specific curve
const curve = new ethers.Contract(curveAddress, CURVE_ABI, provider);
curve.on('TokenPurchased', (buyer, nativeIn, tokensOut) => {
console.log(`Direct buy on curve: ${ethers.formatEther(tokensOut)} tokens`);
});
TokenSold (Curve)
Identical to Factory’s TokenSold, but emitted by the curve.
event TokenSold(
address indexed seller,
uint256 tokensIn,
uint256 nativeOut,
uint256 totalFee,
uint256 creatorFee,
uint256 platformFee,
uint256 newRealNativeReserves,
uint256 newRealTokenReserves,
uint256 newVirtualNativeReserves,
uint256 newVirtualTokenReserves
);
TokenBonded
Emitted when all tradeable tokens are sold and curve enters “bonded” state.
event TokenBonded(
address indexed tokenAddress
);
Token that reached full bonding
Use Cases:
- Notify users that token is ready for graduation
- Trigger graduation countdown/voting UI
- Creator milestone notification
Example:
curve.on('TokenBonded', (tokenAddress) => {
console.log(`Token ${tokenAddress} fully bonded!`);
// Show celebration UI
showBondedCelebration();
// Notify creator
notifyCreator('Your token is fully bonded and ready for graduation!');
// Start graduation countdown
startGraduationCountdown();
});
Critical Event: TokenBonded marks a major milestone. All tokens sold,
maximum liquidity reached, ready for DEX migration.
TokenMigrated (Curve)
Identical to Factory’s TokenMigrated, but emitted by the curve.
event TokenMigrated(
address indexed tokenAddress,
address indexed poolAddress,
string platformName,
uint256 nativeLiquidity,
uint256 tokenLiquidity,
uint256 migrationFee,
uint256 creatorFee,
uint256 platformFee
);
CreatorFeesClaimed
Emitted when creator claims accumulated fees.
event CreatorFeesClaimed(
address indexed creator,
address indexed tokenAddress,
uint256 amount
);
Use Cases:
- Track creator earnings withdrawals
- Creator analytics dashboards
- Tax reporting tools
Example:
curve.on('CreatorFeesClaimed', (creator, tokenAddress, amount) => {
console.log(`Creator ${creator} claimed ${ethers.formatEther(amount)}`);
// Update creator dashboard
updateCreatorBalance(creator, amount);
});
CreatorTransferred
Emitted when creator role is transferred to a new address.
event CreatorTransferred(
address indexed oldCreator,
address indexed newCreator
);
Use Cases:
- Track ownership changes
- Security monitoring
- Creator account recovery tracking
Token Events
Events emitted by RektHubToken contracts.
TokenURIUpdated
Emitted when creator updates token metadata.
event TokenURIUpdated(
string newURI,
uint256 timestamp
);
Block timestamp of update
Use Cases:
- Refresh token metadata in UIs
- Track metadata update history
- Cache invalidation
Example:
token.on('TokenURIUpdated', async (newURI, timestamp) => {
console.log('Metadata updated:', newURI);
// Fetch new metadata
const metadata = await fetchMetadata(newURI);
// Update UI
updateTokenCard({
image: metadata.image,
description: metadata.description,
socials: metadata.social_links,
});
// Invalidate cache
cache.delete(`metadata:${tokenAddress}`);
});
MintingDisabled
Emitted once during token initialization when minting is permanently locked.
event MintingDisabled(
uint256 timestamp
);
Block timestamp when minting was disabled
Use Cases:
- Verify supply is locked
- Security auditing
- Transparency dashboards
Standard ERC20 Events
All RektHub tokens also emit standard ERC20 events:
Transfer
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
Approval
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
Event Filtering Examples
Listen to All Activity for a Token
const tokenAddress = '0x...';
// Factory events
const buyFilter = factory.filters.TokenPurchased(tokenAddress);
const sellFilter = factory.filters.TokenSold(tokenAddress);
const migrateFilter = factory.filters.TokenMigrated(tokenAddress);
factory.on(buyFilter, handleBuy);
factory.on(sellFilter, handleSell);
factory.on(migrateFilter, handleMigration);
Listen to a Specific User’s Activity
const userAddress = '0x...';
// Buys by this user
factory.on(
factory.filters.TokenPurchased(null, null, userAddress),
handleUserBuy
);
// Sells by this user
factory.on(factory.filters.TokenSold(null, null, userAddress), handleUserSell);
Query Historical Events
// Get all tokens created in the last 1000 blocks
const currentBlock = await provider.getBlockNumber();
const fromBlock = currentBlock - 1000;
const events = await factory.queryFilter(
factory.filters.TokenCreated(),
fromBlock,
'latest'
);
events.forEach((event) => {
console.log('Token:', event.args.name);
console.log('Creator:', event.args.creator);
console.log('Block:', event.blockNumber);
});
Build a Trade Feed
async function buildTradeFeed() {
const feed = [];
factory.on('TokenPurchased', (token, curve, buyer, nativeIn, tokensOut) => {
feed.push({
type: 'buy',
token,
user: buyer,
amount: ethers.formatEther(tokensOut),
value: ethers.formatEther(nativeIn),
timestamp: Date.now(),
});
renderFeed(feed);
});
factory.on('TokenSold', (token, curve, seller, tokensIn, nativeOut) => {
feed.push({
type: 'sell',
token,
user: seller,
amount: ethers.formatEther(tokensIn),
value: ethers.formatEther(nativeOut),
timestamp: Date.now(),
});
renderFeed(feed);
});
}
Next Steps