Skip to content

fix: stablecoins incorrectly marked from single character symbols#2283

Merged
slasher125 merged 1 commit intoDefiLlama:masterfrom
NFToby:fix/stablecoin-flagging
Jan 23, 2026
Merged

fix: stablecoins incorrectly marked from single character symbols#2283
slasher125 merged 1 commit intoDefiLlama:masterfrom
NFToby:fix/stablecoin-flagging

Conversation

@NFToby
Copy link
Contributor

@NFToby NFToby commented Jan 22, 2026

Pools are incorrectly being marked as containing stablecoins because a substring search is matching a known stablecoin symbol.

The issue though is the stablecoins (fetched from here: https://stablecoins.llama.fi/stablecoins?includePrices=true) include symbols like U, M, R, and D which obviously match a lot of words/tokens when using .includes().

This change enforces an exact match when the stablecoin symbol is a single character.

Testing

Example of an incorrectly marked pool:

API: https://yields.llama.fi/poolsEnriched?pool=90011ef5-44b0-4da8-ba2c-8779baf20599
UI: https://defillama.com/yields/pool/e19c3745-6e2d-4228-b7e0-c28f12b0c727

Summary by CodeRabbit

  • Bug Fixes
    • Refined stablecoin detection with improved token symbol matching logic, providing more accurate stability assessments across various portfolio scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

The checkStablecoin function in triggerEnrichment.js is refined to improve token stability validation. Token strings are now cleaned before comparison, with exact matching applied to single-character stablecoin symbols and substring containment for multi-character symbols, enhancing validation accuracy across single and multi-token scenarios.

Changes

Cohort / File(s) Summary
Stablecoin matching logic
src/handlers/triggerEnrichment.js
Enhanced checkStablecoin function: added token string cleaning, refined comparison logic using exact match for length-1 stablecoins and substring containment for longer symbols, applied consistent matching rules across single and multi-token branches with improved guard conditions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A token cleaned is token blessed,
With symbols matched—the very best,
Single chars or strings so long,
Stability checks now strong!
All coins aligned in harmony's song. 💫

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: preventing single-character stablecoin symbols from being incorrectly matched as substrings, which is the primary change addressing the false-positive stablecoin flagging issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@slasher125 slasher125 merged commit 86be6dc into DefiLlama:master Jan 23, 2026
2 checks passed
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.

2 participants