Skip to content

feat: Add bulk token scanning and introduce shared cache manager #6617 - #6483

Merged
AugmentedMode merged 31 commits into
mainfrom
feat/add-bulk-token-screening
Sep 22, 2025
Merged

feat: Add bulk token scanning and introduce shared cache manager #6617#6483
AugmentedMode merged 31 commits into
mainfrom
feat/add-bulk-token-screening

Conversation

@AugmentedMode

@AugmentedModeAugmentedMode commented Sep 7, 2025

Copy link
Copy Markdown
Contributor

Explanation

This PR extends the PhishingController to support bulk token screening with caching, similar to the existing URL scanning functionality. This PR also replaces the urlScanCache with a reusable cacheManager class that is shared between both urlScanCache and now tokenScanCache

Changes introduced

  • Added a new bulkScanTokens method that can screen up to 100 tokens per batch
  • Implemented a new cacheManager class that handles caching logic with a 15-minute TTL.
    • Replaced urlScanCache with cacheManager.
    • Introduced tokenScanCache using the same cacheManager for consistency and reuse.
  • Defined cache key format as ${chainId}:${tokenAddress} for token scans.
  • Registered bulkScanTokens as a controller action under PhishingControllerBulkScanTokensAction.
  • Exported new types for extension consumption and exposed the scanning functionality via the messenger.

Screenshot showcasing the tokenScanCache is implemented as expected

This is grabbed via the extension console using await stateHooks.getPersistedState() after triggering a swap in uniswap. You will notice i was doing a swap for USDC which is the only token address stored in the cache.

Screenshot 2025-09-15 at 10 28 15 AM

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@AugmentedMode
AugmentedMode requested a review from a team as a code ownerSeptember 7, 2025 23:08
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@AugmentedMode
AugmentedMode requested a review from a team as a code ownerSeptember 10, 2025 04:27
@AugmentedModeAugmentedMode self-assigned this Sep 14, 2025
cursor[bot]

This comment was marked as outdated.

@AugmentedModeAugmentedMode changed the title feat: Implement CacheManager for caching functionalityfeat: Add bulk token scanning and introduce shared cache manager #6617Sep 16, 2025
Comment threadpackages/phishing-controller/src/CacheManager.test.ts Outdated
Comment threadpackages/phishing-controller/src/PhishingController.ts Outdated
Comment threadpackages/phishing-controller/src/PhishingController.ts
Comment threadpackages/phishing-controller/src/PhishingController.ts Outdated
Comment threadpackages/phishing-controller/src/PhishingController.ts Outdated
Comment threadpackages/phishing-controller/src/PhishingController.ts Outdated
@AugmentedMode
AugmentedMode enabled auto-merge (squash) September 22, 2025 18:55
@AugmentedMode
AugmentedMode merged commit 313552f into mainSep 22, 2025
239 checks passed
@AugmentedMode
AugmentedMode deleted the feat/add-bulk-token-screening branch September 22, 2025 19:02
@AugmentedModeAugmentedMode mentioned this pull request Sep 24, 2025
4 tasks
Sign up for freeto 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.

2 participants

@AugmentedMode@cryptotavares