Skip to content

fix: derive TDP v1 Top 10 holders % from Blockaid wallet holders only - #38272

Merged
sahar-fehri merged 2 commits into
mainfrom
fix/fix-holders-memecoin-tdp
Oct 27, 2026
Merged

sahar-fehri merged 2 commits into
mainfrom
fix/fix-holders-memecoin-tdp

Conversation

@sahar-fehri

@sahar-fehri sahar-fehri commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

The Token Details Page v1 Security tab "Top 10" concentration figure was wrong in two ways, and this PR fixes both so the holders bar and the stat row read a single, correct source.

1. sumTopTenPercentage now counts only wallet holders.
It previously summed every entry in financialStats.topHolders, including non-wallet holders — AMM pools (market), Solana routers (program), plus locker and contract. For a pooled token that inflates concentration toward ~100% (a single AMM pool can hold 99%+). Per Blockaid's guidance, the figure now filters to label === 'wallet' (the API returns the label lowercase) and sums the top 10 of those, so it reflects trader holdings rather than liquidity venues.

2. The row no longer prefers the launchpad/Codex value.
The "Top 10" stat row used to prefer launchpadData.top10HeldPercent (Codex) and only fall back to the Blockaid sum, which let the row and the holders bar disagree. The row now reads the same sumTopTenPercentage(...) as the bar — one source of truth — and the now-unused launchpadData plumbing is removed from useTokenStats and its caller.

The holders bar inherits the fix automatically because it already reads securityFacts.topTenPercentage, which is this same function.

Known caveat (documented in code): Blockaid caps topHolders at 10, so if fewer than 10 wallet holders remain after filtering out pools/lockers, the list can't reconstruct the true top-10 wallet share and may slightly undercount. This is acceptable (holders past #10 are typically <1%).

Changelog

CHANGELOG entry: Fixed the Token Details top-10 holder concentration to count only wallet holders, excluding liquidity pools and other non-wallet addresses.

Related issues

Refs: ASSETS-4184
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-4184

Manual testing steps

Feature: TDP v1 Top 10 holder concentration

  Scenario: Pooled token excludes the AMM pool from Top 10
    Given I open the Token Details page for a pooled memecoin whose
          largest holder is an AMM pool labeled "market"
    When the Security tab renders
    Then the "Top 10" stat shows the summed wallet holders' share, not ~100%
      And the holders distribution bar matches that same number

  Scenario: Row and bar agree
    Given a token that previously showed different numbers for the row and bar
    When the Security tab renders
    Then the "Top 10" row and the holders bar show the same value

Screenshots/Recordings

Before

Screenshot 2026-10-27 at 10 40 31

After

Screenshot 2026-10-27 at 10 41 22

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Changes how a security-sensitive concentration metric is computed and removes an alternate data source; behavior shifts for pooled tokens but is scoped to TDP v1 display logic with new tests.

Overview
Fixes Token Details v1 “Top 10” holder concentration so it reflects wallet ownership instead of inflated pool-heavy totals.

sumTopTenPercentage now sums only Blockaid holders with label === 'wallet' (top ten after filter), excluding market, program, locker, and contract entries that can dominate pooled tokens. The Security tab holders bar already used this helper via security facts, so it picks up the same correction.

useTokenStats no longer accepts or prefers launchpadData.top10HeldPercent (Codex); the Top 10 stat row uses the same Blockaid wallet sum as the bar. TokenDetailsV1 stops passing launchpad data into the hook for that stat.

Tests cover wallet-only filtering, the top-ten cap after filtering, and updated stat expectations.

Reviewed by Cursor Bugbot for commit ec0cb92. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-authored-by: sahar-fehri <sahar.fehri@consensys.net>
@sahar-fehri sahar-fehri self-assigned this Oct 27, 2026
@metamask-ci

metamask-ci Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Pre-merge author checklist has unchecked items (e.g. "I've tested on Android"). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@sahar-fehri
sahar-fehri marked this pull request as ready for review October 27, 2026 08:39
@sahar-fehri
sahar-fehri requested a review from a team as a code owner October 27, 2026 08:39
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Smart E2E Test Selection

Selected E2E tags: No E2E tests selected

AI Confidence: 92

E2E reasoning

Expand to read

The PR makes targeted, well-contained changes to the TokenDetails feature area:

  1. TokenDetailsV1.tsx: Removes the launchpadData prop from the useTokenStats hook call (1 line removed).
  2. useTokenStats.ts: Removes the launchpadData parameter entirely from the hook interface. The Top10 stat now exclusively uses sumTopTenPercentage(financialStats) instead of preferring launchpadData?.top10HeldPercent first.
  3. securityFacts.ts: Modifies sumTopTenPercentage to filter holders to only label === 'wallet' entries (excluding AMM pools, programs, lockers, contracts), and applies .slice(0, 10) after filtering.
  4. Test files: Unit tests updated to reflect the new behavior with comprehensive coverage.

Why no E2E tags are needed:

  • No existing smoke spec covers the TokenDetails page or the "Top 10 holders" stat display
  • The changes are entirely within the TokenDetails feature boundary with no impact on shared infrastructure, navigation, authentication, or state management
  • The blast radius is limited to the token details view's stat display
  • The new behavior is thoroughly covered by unit tests (useTokenStats.test.ts and securityFacts.test.ts)
  • No smoke tag (SmokeWalletPlatform, SmokeNetworkAbstractions, etc.) exercises the specific token holder concentration stat that was changed
  • The changes are additive in nature (better filtering logic) with no regression risk to existing E2E flows

Performance reasoning

Expand to read

No performance-sensitive paths are affected. The change simplifies computation (filtering before summing wallet holders) and removes a data source (launchpadData). No list rendering, no new API calls, no heavy computation changes. The TokenDetails stat calculation is not covered by any performance test scenario.

View run

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@sonarqubecloud

Copy link
Copy Markdown

@sahar-fehri
sahar-fehri added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit b67a8ad Oct 27, 2026
102 checks passed
@sahar-fehri
sahar-fehri deleted the fix/fix-holders-memecoin-tdp branch October 27, 2026 10:16
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 27, 2026
@metamask-ci metamask-ci Bot added the release-8.19.0 Issue or pull request that will be included in release 8.19.0 label Oct 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.19.0 Issue or pull request that will be included in release 8.19.0 size-M team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants