Skip to content

feat: derive tvl#17974

Merged
g1nt0ki merged 4 commits intoDefiLlama:mainfrom
DillonLin:feat/derive-tvl
Feb 17, 2026
Merged

feat: derive tvl#17974
g1nt0ki merged 4 commits intoDefiLlama:mainfrom
DillonLin:feat/derive-tvl

Conversation

@DillonLin
Copy link
Contributor

@DillonLin DillonLin commented Feb 9, 2026

NOTE

Please enable "Allow edits by maintainers" while putting up the PR.


  • If you would like to add a volume/fees/revenue adapter please submit the PR here.
  • If you would like to add a liquidations adapter, please refer to this readme document for details.
  1. 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.
  2. 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.
  3. Please fill the form below only if the PR is for listing a new protocol else it can be ignored/replaced with reason/details about the PR
  4. For updating listing info It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR
  5. Do not edit/push package-lock.json file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI
  6. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap

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

  • New Features
    • Expanded support for TVL data across additional blockchain networks including Ethereum, Optimism, Base, Arbitrum, Hyperliquid, Mode, and Blast.
    • Implemented dual data sourcing strategy with support for both static and dynamic TVL data retrieval, optimizing data freshness and performance based on chain requirements.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

A new addresses.js module introduces static vault and token address registries for multiple chains, along with a helper function to retrieve token-vault pairs. The index.js is updated to conditionally source token data from static addresses or fetch from URLs based on chain classification.

Changes

Cohort / File(s) Summary
New Static Data Registry
projects/lyra-v2/addresses.js
Introduces VAULTS_BY_CHAIN_ID mapping, CHAIN_TO_CHAIN_ID lookup, and getStaticTokensAndOwners() helper. Categorizes chains into STATIC_TVL_CHAINS (ethereum, optimism, base, arbitrum, hyperliquid) and URL_TVL_CHAINS (mode, blast).
Conditional Data Sourcing
projects/lyra-v2/index.js
Integrates static address imports. Adds per-chain useStatic flag to conditionally use static token/owner data or fetch from URL endpoints, with results concatenated by data source type.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰 A registry of vaults, so static and true,
For chains both old and chains yet new,
Some fetch from URLs in the sky,
While others trust the data nigh,
With flags to guide which path to take—
TVL flows for clarity's sake! 📊

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is the boilerplate template without any specific details filled in about the actual changes, making it largely incomplete for describing this technical modification. Replace the template with a clear explanation of what was changed: the new addresses.js module, the TVL derivation logic updates in index.js, and why these changes were made.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: derive tvl' is concise and directly related to the main changes which involve deriving TVL data from static and URL sources.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
projects/lyra-v2/index.js (1)

21-35: Static addresses require manual updates when new vaults are deployed.

For static chains, getOldToA/getToA URL fetches are fully bypassed. If new vaults are deployed on these chains, addresses.js must be manually updated or TVL will be understated. Consider adding a comment noting this maintenance requirement, or periodically cross-checking against the URL source.


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.

@llamabutler
Copy link

The adapter at projects/lyra-v2 exports TVL:

optimism                  20.20 M
ethereum                  13.75 M
arbitrum                  12.69 M
base                      11.00 M
hyperliquid               5.82 M
mode                      0.00
blast                     0.00

total                    63.45 M 

@g1nt0ki g1nt0ki merged commit f855708 into DefiLlama:main Feb 17, 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.

3 participants