Update sumTokens.js#20077
Conversation
📝 WalkthroughWalkthroughChangesUpdates Registry ownership normalization
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
registries/sumTokens.jsParsing error: Unexpected token "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1" 🔧 ast-grep (0.44.1)registries/sumTokens.jsast-grep timed out on this file 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. Comment Warning |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@registries/sumTokens.js`:
- Line 607: Fix the malformed address entries in registries/sumTokens.js: at
lines 607-607, quote the address and restore the array terminator; at lines
2219-2219, remove the stray unquoted address before the string literal so the
registry parses and loads correctly.
- Around line 2384-2394: The pool2 configuration in sumTokens has duplicated
token addresses that are also blacklisted, causing the entire token set to be
filtered out. Restore the intended distinct LP addresses in pool2.tokens and
remove or correct the erroneous matching entry in pool2.blacklistedTokens, while
preserving the pool owners and resolveLP settings.
- Around line 1831-1852: Restore the original distinct contract addresses in the
affected sumTokens registry block, replacing the repeated 0x46531... address
entries in both owners and tokens with their intended clearinghouse/vault
addresses. Preserve the one-to-one slot alignment so sumTokens does not
deduplicate the entries and omit balances.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| ] | ||
| "0x3211d27a1A1B8E40C7974F6951935303e6e56DBE", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| 0x46531ea0E7cec64b14181d45F8C6798a1cE45da1 ] |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Malformed address insertions prevent the registry from loading.
registries/sumTokens.js#L607-L607: quote the address and restore the array terminator.registries/sumTokens.js#L2219-L2219: remove the stray unquoted address before the string literal.
📍 Affects 1 file
registries/sumTokens.js#L607-L607(this comment)registries/sumTokens.js#L2219-L2219
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@registries/sumTokens.js` at line 607, Fix the malformed address entries in
registries/sumTokens.js: at lines 607-607, quote the address and restore the
array terminator; at lines 2219-2219, remove the stray unquoted address before
the string literal so the registry parses and loads correctly.
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1" | ||
| ], | ||
| "tokens": [ | ||
| ADDRESSES.base.USDC, | ||
| "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A", | ||
| "0xbeef0e0834849aCC03f0089F01f4F1Eeb06873C9" | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1" |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== File context =="
sed -n '1800,1875p' registries/sumTokens.js
echo
echo "== sumTokens implementation references =="
rg -n "function sumTokens|const sumTokens|sumTokens\(" -S . --glob '!node_modules' --glob '!dist' --glob '!build'Repository: DefiLlama/DefiLlama-Adapters
Length of output: 50384
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== helper/sumTokens.js outline =="
ast-grep outline projects/helper/sumTokens.js --view expanded
echo
echo "== relevant implementation slices =="
sed -n '1,220p' projects/helper/sumTokens.js
echo
echo "== unwrapLPs sumTokens implementation slices =="
sed -n '688,780p' projects/helper/unwrapLPs.js
echo
echo "== search for dedupe helpers in sumTokens path =="
rg -n "uniq\\(|Set\\(|dedup|duplicate|ownerTokens|tokensAndOwners2|tokensAndOwners" projects/helper/sumTokens.js projects/helper/unwrapLPs.js projects/helper/chain/*.jsRepository: DefiLlama/DefiLlama-Adapters
Length of output: 20596
Restore the distinct contract addresses here.
sumTokens dedupes owners and tokens, so this block collapses to a single balance query. If these slots are meant to cover separate clearinghouse/vault contracts, their balances are dropped.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@registries/sumTokens.js` around lines 1831 - 1852, Restore the original
distinct contract addresses in the affected sumTokens registry block, replacing
the repeated 0x46531... address entries in both owners and tokens with their
intended clearinghouse/vault addresses. Preserve the one-to-one slot alignment
so sumTokens does not deduplicate the entries and omit balances.
| "pool2": { | ||
| "owners": [ | ||
| "0xC2d2D7eB9cbF2985714E3310bFDB8eEcC3E96992" | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1" | ||
| ], | ||
| "tokens": [ | ||
| "0x149b55D78f6380Af73FFe57e9aDb7F1963BC251a", | ||
| "0xeb7fE075B7677c98C75E105d4f5ACE0e19505567" | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1", | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1" | ||
| ], | ||
| "resolveLP": true, | ||
| "blacklistedTokens": [ | ||
| "0xa90298e5B1203A2DD0006A75EABE158989C406Fb" | ||
| "0x46531ea0E7cec64b14181d45F8C6798a1cE45da1" |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
The blacklist removes the complete pool2 token set.
Both entries in tokens are the same address listed under blacklistedTokens. sumTokens deduplicates and filters them, leaving no pool2 tokens to query. Restore the intended LP addresses or remove the erroneous blacklist entry.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@registries/sumTokens.js` around lines 2384 - 2394, The pool2 configuration in
sumTokens has duplicated token addresses that are also blacklisted, causing the
entire token set to be filtered out. Restore the intended distinct LP addresses
in pool2.tokens and remove or correct the erroneous matching entry in
pool2.blacklistedTokens, while preserving the pool owners and resolveLP
settings.
NOTE
Please enable "Allow edits by maintainers" while putting up the PR.
If you would like to add a
volume/fees/revenueadapter please submit the PR here.Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord.
Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
For updating listing info Please send a mail to metadata@defillama.com
Please do not add new npm dependencies, do not edit/push
pnpm-lock.yamlfile as part of your changes(Needs to be filled only for new listings)
Name (to be shown on DefiLlama):
Twitter Link:
List of audit links if any:
Website Link:
Logo (High resolution, will be shown with rounded borders):
Current TVL:
Treasury Addresses (if the protocol has treasury)
Chain:
Coingecko ID (so your TVL can appear on Coingecko, leave empty if not listed): (https://api.coingecko.com/api/v3/coins/list)
Coinmarketcap ID (so your TVL can appear on Coinmarketcap, leave empty if not listed): (https://api.coinmarketcap.com/data-api/v3/map/all?listing_status=active,inactive,untracked&start=1&limit=10000)
Short Description (to be shown on DefiLlama):
Token address and ticker if any:
Category (full list at https://defillama.com/categories) *Please choose only one:
Oracle Provider(s): Specify the oracle(s) used (e.g., Chainlink, Band, API3, TWAP, etc.):
Implementation Details: Briefly describe how the oracle is integrated into your project:
Documentation/Proof: Provide links to documentation or any other resources that verify the oracle's usage:
forkedFrom (Does your project originate from another project):
methodology (what is being counted as tvl, how is tvl being calculated):
Github org/user (Optional, if your code is open source, we can track activity):
Does this project have a referral program?
Summary by CodeRabbit