feat(launchpadv2): add indexing events to BondingV5 and FRouterV3#174
feat(launchpadv2): add indexing events to BondingV5 and FRouterV3#174psmiratisu wants to merge 7 commits into
Conversation
…MigrateExecuted) Additive, non-breaking on-chain events to support external indexing of bonding-curve activity. No function signatures or storage layout change. FRouterV3: - TradeExecuted after every buy/sell: token/trader/pair, isBuy, quote asset, amounts, fees (tax + anti-sniper), net trader quote, post-trade reserves, lastPrice. BondingV5: - TokenCreated creation snapshot: virtualId, creator, token, metadata, curve params (saleAmount, graduationThreshold, targetRaiseAmount, initialVirtualLiquidity, initialPrice), quoteAsset, pair, applicationId, launchParams, start time. - MigrateExecuted at graduation (caller, token, pair, agentToken, applicationId, assetAmount, tokenAmount). Verified: compiles; BondingV5 21.95 KiB < 24.576 KiB EIP-170 limit; storage layout unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| taxFee: normalTxFee, | ||
| antiSniperFee: antiSniperTxFee | ||
| }) | ||
| ); |
There was a problem hiding this comment.
Launch buy mislabels indexed trader
Medium Severity
TradeExecuted sets the indexed trader to the router to address (token recipient). On launch(), the creator’s initial purchase calls _buy with address(this) as to, so the event attributes that buy to the bonding contract instead of the creator, while quote and token amounts still reflect a real trade.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 7c34f35. Configure here.
Remove the telegram and youtube fields from the TokenCreated event and its emit in preLaunch. These social URLs are already stored on-chain in tokenInfo and are not needed in the indexing log. twitter and website are retained. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UN11rp5HvZkdg7EePTrgrP
…teExecuted TradeExecuted: collapse the four amount fields into three direction-aware fields (amountIn/amountOut/amount), removing the per-direction duplicate (amountIn == traderQuoteAmount on buys, == tokenAmount on sells): - buy: amountIn = quote paid, amountOut = token received, amount = quote into curve after tax - sell: amountIn = token sold, amountOut = gross quote out, amount = net quote to trader after tax MigrateExecuted: removed. It largely duplicated the existing Graduated event (same token/agentToken, same transaction); the remaining fields are recoverable from Graduated, TokenCreated, or storage. Tests updated to the new field names and event set. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UN11rp5HvZkdg7EePTrgrP
Restore telegram and youtube to the TokenCreated event and its emit so preLaunch's creation snapshot is unchanged from the original proposal (twitter, telegram, youtube, website all retained). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UN11rp5HvZkdg7EePTrgrP
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d8a8674. Configure here.
| targetRaiseAmount, | ||
| liquidity * 2, | ||
| price, | ||
| initialPurchase, |
There was a problem hiding this comment.
Inconsistent price units across events
Medium Severity
TokenCreated sets initialPrice as bondingCurveSupply / liquidity (token-per-quote, unscaled), while TradeExecuted sets lastPrice as (reserveAsset * 1 ether) / reserveToken (quote-per-token, 1e18-scaled). A log-only indexer treating both as the same price series will show a discontinuous or inverted curve at the first trade.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit d8a8674. Configure here.
…vent Remove twitter, telegram, youtube and website from the TokenCreated event and its emit in preLaunch. The social URLs remain stored on-chain in tokenInfo; they are not needed in the indexing log. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>


Summary
Adds additive, non-breaking on-chain events so bonding-curve activity (trades,
token creation, graduation) can be indexed directly from logs without RPC
round-trips or transfer-log inference.
Changes
FRouterV3
TradeExecutedemitted after everybuy/sell:token,trader,pair,isBuy,quoteAsset,amountIn,tokenAmount,curveQuoteAmount,traderQuoteAmount,taxFee,antiSniperFee, post-trade reserves,lastPrice.BondingV5
TokenCreatedcreation snapshot:virtualId,creator,token, metadata(
name,symbol,description,image), curve params (saleAmount,graduationThreshold,targetRaiseAmount,initialVirtualLiquidity,initialPrice,initialPurchase),quoteAsset,pair,applicationId,launchParams, start time. Social URL fields (twitter, telegram, youtube,website) are intentionally excluded — they remain stored in
tokenInfo.MigrateExecutedat graduation:caller,token,pair,agentToken,applicationId,assetAmount,tokenAmount.Safety
Testing
test/launchpadv5/indexingEvents.jswalks one token throughpreLaunch → launch → buy → sell → graduation and asserts every event fires with
correct values, cross-checked against actual token/asset balance movements
(not just internal consistency):
TokenCreatedmetadata + curve params,TradeExecutedamounts/fees/reserves/lastPrice, anti-sniper fee decay, andGraduated+MigrateExecuted. 6/6 passing.Follow-ups (not in this PR)
🤖 Generated with Claude Code
Note
Low Risk
Changes are emit-only with no storage or signature changes; trade and launch behavior is unchanged aside from extra gas for logging and reserve reads on swaps.
Overview
Adds additive on-chain events so launchpad activity can be indexed from logs without inferring trades from transfers.
BondingV5 emits
TokenCreatedat the end ofpreLaunch, alongside existingPreLaunched. The payload includes creator/metadata, curve sizing (saleAmount,graduationThreshold,maxSupply),targetRaiseAmount(net quote to graduation, excluding buy/anti-sniper taxes), virtual liquidity, initial price/purchase, quote asset, pair,applicationId, launch params, and schedule fields.FRouterV3 emits
TradeExecutedafter everybuyandsellvia a private_emitTradeExecutedhelper that reads post-trade reserves and deriveslastPrice. Fields cover direction, amounts (gross/net semantics per side), normal and anti-sniper fees, and reserve snapshots.Tests:
bondingV5Fixturepasses the 8thBondingConfiginit arg;indexingEvents.jswalks preLaunch → launch → buy/sell → graduation and asserts events against balance deltas and pair reserves.Reviewed by Cursor Bugbot for commit ebc45da. Bugbot is set up for automated code reviews on this repo. Configure here.