Skip to content

Conversation

@koo-virtuals
Copy link
Contributor

No description provided.

@koo-virtuals koo-virtuals changed the title Ai review Ai review project 60days Jan 24, 2026
@koo-virtuals
Copy link
Contributor Author

koo-virtuals commented Jan 24, 2026

@AI-Reviewer-QS

Executive Summary

This change introduces a new token launch mechanism (preLaunchProject60days) that allows specific tokens to have their tax recipients updated dynamically. The core functionality enables redirecting tax revenue to a dedicated vault during the 60-day pre-commit period, with the ability to revert to the original creator after commitment.

Current Implementation Scope: Only the tax recipient update mechanism is implemented. The "rug" and "commit" drain logic is NOT included in this change.


Product Context

60 Days Launch Mechanism Overview

The system introduces a new project type with a 60-day commitment window:

  1. Pre-commit Phase:

    • Token launched with standard tokenomics (45% LP, 5% Airdrop, 25% Team, 25% sell wall)
    • Trading taxes accumulate in a dedicated vault
    • Founder has 60 days to commit or the project is considered "rugged"
  2. Commit Status (Future):

    • Founder presses "COMMIT" button within 60 days
    • Vault funds are immediately released to founder wallet
    • Tax recipient reverts to original creator
  3. Rugged Status (Future):

    • After 60 days without commitment
    • Liquidity pools drained, vault funds released
    • Project closed down

Note: The current implementation only handles tax recipient redirection. Drain logic for commit/rug scenarios is NOT implemented.

Please help review

Copy link
Collaborator

@AI-Reviewer-QS AI-Reviewer-QS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these findings affect event data integrity with no direct fund risk. Recommend fixing before mainnet deployment to ensure reliable off-chain indexing and audit trails.

And another similar issue, which cannot be added to the review due to GitHub limit:

⚠️ LOW/MEDIUM: Event Emits Zeroed Value
File: contracts/launchpadv2/BondingV2.sol
Lines: 401-408

_token.initialPurchase is set to 0 on line 401, then emitted on line 408. The event will always log 0 as the refund amount regardless of actual amount transferred.

Why this happens:

Step _token.initialPurchase
Line 395-398: Transfer Correct value used ✅
Line 401: Reset Set to 0
Line 408: Emit 0 emitted ❌

Impact: Off-chain indexers/analytics will record all cancelled launches as having 0 refund. No fund loss—the actual transfer on line 395-398 uses the correct pre-zeroed value.

Fix: Cache the value before zeroing:

uint256 refundAmount = _token.initialPurchase;
_token.initialPurchase = 0;
_token.launchExecuted = true;
emit CancelledLaunch(_tokenAddress, _token.pair, tokenInfo[_tokenAddress].virtualId, refundAmount);

Comment on lines +383 to +387
TaxRecipient storage recipient = _agentRecipients[agentId];
address oldCreator = recipient.creator;
recipient.tba = tba;
recipient.creator = creator;
emit CreatorUpdated(agentId, oldCreator, creator);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ MEDIUM: Uninitialized Storage Reads as Zero

If _agentRecipients[agentId] was never accessed before, recipient.creator defaults to address(0). The actual original creator is available via info.founder (line 370), but it's not used to initialize the storage.

Compare with _getTaxRecipient() pattern:

if (recipient.tba == address(0)) {
    recipient.tba = info.tba;
    recipient.creator = info.founder;  // ← Correct initialization
}

Impact: First-time updates for any agentId will emit oldCreator = 0x0000... instead of the actual founder address, breaking historical tracking.

Fix: Apply the same initialization pattern:

TaxRecipient storage recipient = _agentRecipients[agentId];
if (recipient.tba == address(0)) {
    recipient.tba = info.tba;
    recipient.creator = info.founder;
}
address oldCreator = recipient.creator;
recipient.tba = tba;
recipient.creator = creator;
emit CreatorUpdated(agentId, oldCreator, creator);

TaxRecipient storage recipient = _agentRecipients[agentId];
recipient.tba = tba;
recipient.creator = creator;
emit CreatorUpdated(agentId, tba, creator);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ MEDIUM: Event Parameter Mismatch

The emitted event uses tba as the second parameter, but CreatorUpdated is defined as:

event CreatorUpdated(
    uint256 agentId,
    address oldCreator,  // ← Expected: previous creator address
    address newCreator
);

Impact: Off-chain systems parsing CreatorUpdated events will interpret the TBA address as the old creator, corrupting audit trails and making creator change history unreliable.

Fix: Capture old creator before overwriting:

TaxRecipient storage recipient = _agentRecipients[agentId];
address oldCreator = recipient.creator;
recipient.tba = tba;
recipient.creator = creator;
emit CreatorUpdated(agentId, oldCreator, creator);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants