Skip to content

Add SpringX's info to the Yields adapter#2710

Open
TheOfficialSpringX wants to merge 1 commit into
DefiLlama:masterfrom
TheOfficialSpringX:master
Open

Add SpringX's info to the Yields adapter#2710
TheOfficialSpringX wants to merge 1 commit into
DefiLlama:masterfrom
TheOfficialSpringX:master

Conversation

@TheOfficialSpringX
Copy link
Copy Markdown

@TheOfficialSpringX TheOfficialSpringX commented May 28, 2026

Summary by CodeRabbit

Release Notes

  • New Features
    • Added support for SpringX vault pools with real-time TVL and APY metrics tracking.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

This PR adds a new SpringX adaptor that retrieves yield and TVL data from SpringX contracts on the Plasma chain. The adaptor fetches pool metadata, calculates USD valuations using external price data, computes scaled APY values, and exports filtered results meeting a minimum TVL threshold.

Changes

SpringX Yield Adaptor

Layer / File(s) Summary
SpringX adaptor implementation
src/adaptors/springx/index.js
The adaptor module defines an apy() function that queries SpringX pools on Plasma, retrieves TVL metrics and coin prices, calculates tvlUsd and apyBase, constructs pool objects with identifiers and vault URLs, and filters results. Includes ABI definitions and exports apy and url endpoint.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A new spring appears on the yield farm trail,
Where pools of TVL shall never fail,
Plasma-chain prices dance and sway,
As SpringX leads farmers their rightful way! 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 change: adding a new SpringX adaptor to provide yield information to the Yields adapter system.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions
Copy link
Copy Markdown

The springx adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 10 passed, 10 total
Snapshots: 0 total
Time: 0.239 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬──────────┬────────────────────────────────────────────────┬─────────┬──────────────────────────────────────────────────┬────────────────────┬─────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬───────────┐
│ (index) │ chain    │ pool                                           │ symbol  │ underlyingTokens                                 │ tvlUsd             │ apyBase │ url                                                                                                                   │ project   │
├─────────┼──────────┼────────────────────────────────────────────────┼─────────┼──────────────────────────────────────────────────┼────────────────────┼─────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────────┤
│ 0       │ 'plasma' │ '0xafF15Ca201C08F05f65d4d0A9d9C368C8356f796-0' │ 'USDT0' │ [ '0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb' ] │ 12049.028303002982 │ 20      │ 'https://springx.finance/Vault/0xafF15Ca201C08F05f65d4d0A9d9C368C8356f796/0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb' │ 'springx' │
└─────────┴──────────┴────────────────────────────────────────────────┴─────────┴──────────────────────────────────────────────────┴────────────────────┴─────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴───────────┘

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/adaptors/springx/index.js (1)

16-19: ⚡ Quick win

Deduplicate coin keys before calling the prices endpoint.

Duplicate assets across pools create an unnecessarily long URL and extra lookup work. Build coinsKey from a Set first.

Proposed change
-  let coinsKey = pools.map((pool) => `${chain}:${pool.asset}`);
+  let coinsKey = [...new Set(pools.map((pool) => `${chain}:${pool.asset.toLowerCase()}`))];
   let { coins } = await utils.getData(
     `https://coins.llama.fi/prices/current/${coinsKey}`,
   );
🤖 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 `@src/adaptors/springx/index.js` around lines 16 - 19, The coinsKey built via
pools.map includes duplicate asset keys; change construction to deduplicate
(e.g., create a Set from pools.map or iterate pools to add
`${chain}:${pool.asset}` to a Set) and use the unique keys when calling
utils.getData for the prices endpoint (the call that currently passes coinsKey
to `https://coins.llama.fi/prices/current/${coinsKey}`), ensuring you convert
the Set back into the expected comma-separated string or array form before the
request.
🤖 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 `@src/adaptors/springx/index.js`:
- Around line 42-44: The PID comparison in the tvl lookup can fail when
ABI-decoded types differ (string vs number) causing valid pools to be dropped;
in the block using farmToTvls, tvlRows, and tvlInfo (where you call
tvlRows.find(item => item.pid === pool.pid)), normalize types before comparing
(e.g., coerce both item.pid and pool.pid to the same type with Number(...) or
String(...)) so the find matches regardless of ABI decoding differences and
valid pools are not silently filtered out.
- Around line 29-38: The loop that calls api.abi.call for each key (iterating
farmAddresses, setting farmToTvls) must be changed to batched parallel calls to
avoid N+1 RPC latency/timeouts: collect targets from Object.keys(farmAddresses),
split into chunks (e.g., 50), and for each chunk use Promise.all to call
api.abi.call({ target, abi: abi.getTvl, chain }) in parallel, then write results
into farmToTvls[item.toLowerCase()] preserving the same key format;
alternatively, if your SDK exposes a multicall helper, use that with abi.getTvl
to fetch many targets at once and map responses back to farmToTvls. Ensure
errors per-call are handled so one failure doesn’t abort the whole batch.

---

Nitpick comments:
In `@src/adaptors/springx/index.js`:
- Around line 16-19: The coinsKey built via pools.map includes duplicate asset
keys; change construction to deduplicate (e.g., create a Set from pools.map or
iterate pools to add `${chain}:${pool.asset}` to a Set) and use the unique keys
when calling utils.getData for the prices endpoint (the call that currently
passes coinsKey to `https://coins.llama.fi/prices/current/${coinsKey}`),
ensuring you convert the Set back into the expected comma-separated string or
array form before the request.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7d17f725-f1a4-4d67-be7f-c8f9713df3c6

📥 Commits

Reviewing files that changed from the base of the PR and between 33401ad and 3deb600.

📒 Files selected for processing (1)
  • src/adaptors/springx/index.js

Comment thread src/adaptors/springx/index.js
Comment thread src/adaptors/springx/index.js
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.

1 participant