Skip to content

Conversation

@AugmentedMode
Copy link
Contributor

@AugmentedMode AugmentedMode commented Sep 7, 2025

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 owner September 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 owner September 10, 2025 04:27
@AugmentedMode AugmentedMode self-assigned this Sep 14, 2025
cursor[bot]

This comment was marked as outdated.

@AugmentedMode AugmentedMode changed the title feat: Implement CacheManager for caching functionality feat: Add bulk token scanning and introduce shared cache manager #6617 Sep 16, 2025
@AugmentedMode AugmentedMode enabled auto-merge (squash) September 22, 2025 18:55
@AugmentedMode AugmentedMode merged commit 313552f into main Sep 22, 2025
239 checks passed
@AugmentedMode AugmentedMode deleted the feat/add-bulk-token-screening branch September 22, 2025 19:02
@AugmentedMode AugmentedMode mentioned this pull request Sep 24, 2025
4 tasks
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