Skip to content

feat: add WealthVille APY adapter for Solana yield optimizer#2714

Open
amitesh-m wants to merge 4 commits into
DefiLlama:masterfrom
amitesh-m:master
Open

feat: add WealthVille APY adapter for Solana yield optimizer#2714
amitesh-m wants to merge 4 commits into
DefiLlama:masterfrom
amitesh-m:master

Conversation

@amitesh-m

@amitesh-m amitesh-m commented May 29, 2026

Copy link
Copy Markdown

WealthVille auto-compounding yield optimizer on Solana. 5 vaults across Orca Whirlpools and Raydium (AMM/CLMM). TVL ~$14.2M. Website: https://wealthville.net

Summary by CodeRabbit

  • New Features
    • Added a Wealthville integration that surfaces Solana vault opportunities, including pool identifiers, project/chain details, symbols, TVL, APY, and per-vault links.
    • Vault data is fetched from Wealthville, normalized, and limited to active opportunities with positive TVL; underlying tokens are derived from supported Solana mints with positive USD value, with a USDC fallback when none are available.

WealthVille auto-compounding yield optimizer on Solana. 5 vaults across Orca Whirlpools and Raydium (AMM/CLMM). TVL ~$14.2M. Website: https://wealthville.net
@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

A new Wealthville adaptor module is introduced to src/adaptors/wealthville/index.js. The module exports an async apy() function that dynamically fetches vaults from the Wealthville TVL endpoint, filters for active vaults with positive TVL, and maps each into standardized adaptor output shape with pool identifiers, chain/project metadata, TVL and APY values, and underlying tokens derived from vault token accounts or fixed Solana USDC fallback.

Changes

Wealthville Adaptor

Layer / File(s) Summary
Wealthville adaptor with API fetch and vault mapping
src/adaptors/wealthville/index.js
Module-level constants define the Wealthville TVL API endpoint (https://wealthville.net/tvl) and fixed Solana USDC token address fallback. The async apy() function fetches vaults via utils.getData, normalizes the response to array, filters for active vaults (status === 'active') with positive TVL, extracts unique Solana mints from token_accounts where value_usd > 0 as underlyingTokens (falling back to fixed USDC mint if none found), and maps each vault into adaptor output with pool naming from vault_pubkey-solana suffix, Solana chain, wealthville project, vault name for symbol, tvl_usd for TVL (default 0), apy for base APY (default 0), and per-vault URL pointing to opportunities page. Module exports the async function, timetravel: false, and module-level base URL.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • 0xkr3p

Poem

🐰 The Wealthville vaults now stream in true,
From Solana's mints, the tokens shine,
Filtered and mapped with careful view,
Yields and APYs align! 🌾

🚥 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 WealthVille APY adapter for Solana, which is a new module export that fetches and normalizes yield data.
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

Error while running wealthville adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 38 passed, 39 total
Snapshots: 0 total
Time: 0.325 s
Ran all test suites.

Nb of pools: 5
 

Sample pools:
┌─────────┬─────────────────────────────────────┬──────────┬───────────────┬──────────────┬──────────┬─────────┬───────────┬──────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────┬─────────────────────────────────────────┐
│ (index) │ pool                                │ chain    │ project       │ symbol       │ tvlUsd   │ apyBase │ apyReward │ rewardTokens │ underlyingTokens                                                                                  │ poolMeta                            │ url                                     │
├─────────┼─────────────────────────────────────┼──────────┼───────────────┼──────────────┼──────────┼─────────┼───────────┼──────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────┼─────────────────────────────────────────┤
│ 0       │ 'wealthville-sol-usdc-orca'         │ 'Solana' │ 'wealthville' │ 'SOL-USDC'   │ 32530000 │ 181.21  │ null      │ []           │ [ 'So11111111111111111111111111111111111111112', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ] │ 'Orca Whirlpool - Auto-compounding' │ 'https://wealthville.net/opportunities' │
│ 1       │ 'wealthville-sol-cbbtc-orca'        │ 'Solana' │ 'wealthville' │ 'SOL-cbBTC'  │ 10490000 │ 57.34   │ null      │ []           │ [ 'So11111111111111111111111111111111111111112', 'cbbtcf3aa214zXHbiAZQwf4122FBYbraNdFqgw4iMij' ]  │ 'Orca Whirlpool - Auto-compounding' │ 'https://wealthville.net/opportunities' │
│ 2       │ 'wealthville-sol-usdc-raydium-amm'  │ 'Solana' │ 'wealthville' │ 'SOL-USDC'   │ 8700000  │ 21.61   │ null      │ []           │ [ 'So11111111111111111111111111111111111111112', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ] │ 'Raydium AMM - Auto-compounding'    │ 'https://wealthville.net/opportunities' │
│ 3       │ 'wealthville-sol-usdc-raydium-clmm' │ 'Solana' │ 'wealthville' │ 'SOL-USDC'   │ 5870000  │ 44.59   │ null      │ []           │ [ 'So11111111111111111111111111111111111111112', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ] │ 'Raydium CLMM - Auto-compounding'   │ 'https://wealthville.net/opportunities' │
│ 4       │ 'wealthville-cbbtc-usdc-orca'       │ 'Solana' │ 'wealthville' │ 'cbBTC-USDC' │ 5810000  │ 70.15   │ null      │ []           │ [ 'cbbtcf3aa214zXHbiAZQwf4122FBYbraNdFqgw4iMij', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ] │ 'Orca Whirlpool - Auto-compounding' │ 'https://wealthville.net/opportunities' │
└─────────┴─────────────────────────────────────┴──────────┴───────────────┴──────────────┴──────────┴─────────┴───────────┴──────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────┴─────────────────────────────────────────┘

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/wealthville/index.js`:
- Around line 10-67: The vaults array currently contains hardcoded tvlUsd and
apyBase values; update the apy() flow to fetch live vault metrics from the
existing WEALTHVILLE_API instead of using fixed numbers. Specifically, remove or
ignore the hardcoded tvlUsd/apyBase inside the vaults constant and implement a
runtime fetch in the apy() function that calls WEALTHVILLE_API, parses the
returned vault list, then maps each vault (matching by pool or underlyingTokens)
to produce the same output shape (including tvlUsd and apyBase) used elsewhere;
ensure you handle network errors and absent fields gracefully and keep pool
identifiers (e.g., "wealthville-sol-usdc-orca") as the matching key.
- Around line 15-60: The hardcoded tvlUsd values in the WealthVille adaptor
(fields named tvlUsd in src/adaptors/wealthville/index.js) total ~63.4M and
likely use the wrong units/scale; inspect and decide whether tvlUsd should be
raw USD or needs decimal/scaling adjustment (e.g., dividing by 1e6 or 1e8) to
match the target ~14.2M, then update the constants accordingly or replace the
hardcoded values with data fetched from WEALTHVILLE_API using axios (ensure
WEALTHVILLE_API and axios are actually used in the module), and add a short
comment explaining the unit/scale chosen so future reviewers understand the
tvlUsd basis.
🪄 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: c420d02f-4d95-4c26-91b4-716671b9d888

📥 Commits

Reviewing files that changed from the base of the PR and between a1f05d9 and 8e585a5.

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

Comment thread src/adaptors/wealthville/index.js Outdated
Comment thread src/adaptors/wealthville/index.js Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/wealthville/index.js`:
- Line 1: Remove the literal "undefined" text that appears before the const
keyword in the module initialization statement. The line should start directly
with const utils instead of undefinedconst utils, as the prefix is causing a
syntax/parse error that prevents the module from loading.
- Line 23: The underlyingTokens property is hardcoded to [USDC_SOL] for all
vaults, but vault names from the API response indicate different compositions
(e.g., "SOL USDT High Yield Vault"). To fix this, either extract the underlying
tokens from the vault name or API response if such data is available (parsing
names if they follow a consistent token-pair format), or if USDC is
intentionally used only as a reference denomination for NAV calculations rather
than the actual underlying assets, add a clarifying code comment explaining this
design decision. Avoid hardcoding the same tokens for all vaults.
🪄 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: 6bcf1505-9d6d-47dc-85b6-b90dca227ab6

📥 Commits

Reviewing files that changed from the base of the PR and between 8e585a5 and 8bb1647.

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

Comment thread src/adaptors/wealthville/index.js Outdated
Comment thread src/adaptors/wealthville/index.js Outdated
@github-actions

Copy link
Copy Markdown

Error while running wealthville adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 33 passed, 34 total
Snapshots: 0 total
Time: 0.282 s
Ran all test suites.

Nb of pools: 5
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬──────────┬───────────────┬─────────────────────────────────────────┬──────────┬─────────┬────────────────────────────────────────────────────┬──────────┬─────────────────────────────────────────┐
│ (index) │ pool                                                  │ chain    │ project       │ symbol                                  │ tvlUsd   │ apyBase │ underlyingTokens                                   │ poolMeta │ url                                     │
├─────────┼───────────────────────────────────────────────────────┼──────────┼───────────────┼─────────────────────────────────────────┼──────────┼─────────┼────────────────────────────────────────────────────┼──────────┼─────────────────────────────────────────┤
│ 0       │ 'AyftocoCqqaPPQXQVePFaGLLYPNyWQWRs6o28JyDboSF-solana' │ 'Solana' │ 'wealthville' │ 'AI Managed Yield Vault Enhanced'       │ 417.0367 │ 39.96   │ [ 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ] │ 'DNA'    │ 'https://wealthville.net/opportunities' │
│ 1       │ '2RN2MB1yE79mHn9tWYiqc9D2sbJesjojZTKkpgm6mSy5-solana' │ 'Solana' │ 'wealthville' │ 'High Yield Native Token Vault'         │ 29.6116  │ 25.45   │ [ 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ] │ 'DNA'    │ 'https://wealthville.net/opportunities' │
│ 2       │ '4WoFWcoCEPVSxYUNypKUr3sMd3fUpcJmvMRWpASVw5Fw-solana' │ 'Solana' │ 'wealthville' │ 'AI Powered Vault For Hot Solana Pools' │ 16.703   │ 181.21  │ [ 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ] │ 'DNA'    │ 'https://wealthville.net/opportunities' │
│ 3       │ '2WypQdQFpHqpMxg5CcuacmcfpqQykV97cvkzYXkCmkSQ-solana' │ 'Solana' │ 'wealthville' │ 'SOL - USDC ORCA Whirlpool Pool'        │ 8.0837   │ 181.21  │ [ 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ] │ 'DNA'    │ 'https://wealthville.net/opportunities' │
│ 4       │ 'Bpm2Aqe6817shSkbobeYJ6aEAREPV4XuGY1wYzn1qCKy-solana' │ 'Solana' │ 'wealthville' │ 'SOL USDT High Yield Vault'             │ 6.1471   │ 40.08   │ [ 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ] │ 'DNA'    │ 'https://wealthville.net/opportunities' │
└─────────┴───────────────────────────────────────────────────────┴──────────┴───────────────┴─────────────────────────────────────────┴──────────┴─────────┴────────────────────────────────────────────────────┴──────────┴─────────────────────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@github-actions

Copy link
Copy Markdown

Error while running wealthville adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 33 passed, 34 total
Snapshots: 0 total
Time: 0.289 s
Ran all test suites.

Nb of pools: 5
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬──────────┬───────────────┬─────────────────────────────────────────┬────────┬─────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────┐
│ (index) │ pool                                                  │ chain    │ project       │ symbol                                  │ tvlUsd │ apyBase │ underlyingTokens                                                                                                                                                   │ url                                     │
├─────────┼───────────────────────────────────────────────────────┼──────────┼───────────────┼─────────────────────────────────────────┼────────┼─────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────┤
│ 0       │ 'AyftocoCqqaPPQXQVePFaGLLYPNyWQWRs6o28JyDboSF-solana' │ 'Solana' │ 'wealthville' │ 'AI Managed Yield Vault Enhanced'       │ 734.9  │ 53.71   │ [ 'Dfh5DzRgSvvCFDoYc2ciTkMrbDfRKybA4SoFbPmApump', 'So11111111111111111111111111111111111111112', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', ... 1 more item ] │ 'https://wealthville.net/opportunities' │
│ 1       │ '2RN2MB1yE79mHn9tWYiqc9D2sbJesjojZTKkpgm6mSy5-solana' │ 'Solana' │ 'wealthville' │ 'High Yield Native Token Vault'         │ 34.4   │ 31.84   │ [ 'So11111111111111111111111111111111111111112', 'METvsvVRapdj9cFLzq4Tr43xK4tAjQfwX76z3n6mWQL', '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R', ... 1 more item ]  │ 'https://wealthville.net/opportunities' │
│ 2       │ '4WoFWcoCEPVSxYUNypKUr3sMd3fUpcJmvMRWpASVw5Fw-solana' │ 'Solana' │ 'wealthville' │ 'AI Powered Vault For Hot Solana Pools' │ 18.58  │ 181.21  │ [ '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R', 'So11111111111111111111111111111111111111112', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ]                  │ 'https://wealthville.net/opportunities' │
│ 3       │ '2WypQdQFpHqpMxg5CcuacmcfpqQykV97cvkzYXkCmkSQ-solana' │ 'Solana' │ 'wealthville' │ 'SOL - USDC ORCA Whirlpool Pool'        │ 8.79   │ 181.21  │ [ 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ]                                                                                                                 │ 'https://wealthville.net/opportunities' │
│ 4       │ 'Bpm2Aqe6817shSkbobeYJ6aEAREPV4XuGY1wYzn1qCKy-solana' │ 'Solana' │ 'wealthville' │ 'SOL USDT High Yield Vault'             │ 6.86   │ 53.14   │ [ 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', 'So11111111111111111111111111111111111111112' ]                                                                  │ 'https://wealthville.net/opportunities' │
└─────────┴───────────────────────────────────────────────────────┴──────────┴───────────────┴─────────────────────────────────────────┴────────┴─────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/adaptors/wealthville/index.js (2)

30-30: ⚡ Quick win

Reconsider the USDC fallback for vaults with no underlying tokens.

When mints.length is zero (no tokens found with value_usd > 0), the code falls back to [USDC_SOL]. This might hide data quality issues where vaults genuinely have no token holdings or the API data is incomplete. Consider either skipping such vaults or logging a warning to surface potential data issues.

💡 Alternative approaches

Option 1: Skip vaults with no tokens

   return list
-    .filter((v) => v && v.status === 'active' && Number(v.tvl_usd) > 0)
+    .filter((v) => v && v.status === 'active' && Number(v.tvl_usd) > 0 && v.vault_pubkey && v.name)
     .map((v) => {
       const mints = [
         ...new Set(
           (v.token_accounts || [])
             .filter((t) => Number(t.value_usd) > 0 && t.mint)
             .map((t) => t.mint)
         ),
       ];
+      if (!mints.length) {
+        console.warn(`Vault ${v.vault_pubkey} has no underlying tokens, skipping`);
+        return null;
+      }
       return {
         pool: `${v.vault_pubkey}-solana`,
         chain: 'Solana',
         project: 'wealthville',
         symbol: v.name,
         tvlUsd: Number(v.tvl_usd) || 0,
         apyBase: Number(v.apy) || 0,
-        underlyingTokens: mints.length ? mints : [USDC_SOL],
+        underlyingTokens: mints,
         url: 'https://wealthville.net/opportunities',
       };
-    });
+    })
+    .filter(Boolean);

Option 2: Keep fallback but add warning

-      underlyingTokens: mints.length ? mints : [USDC_SOL],
+      underlyingTokens: mints.length ? mints : (() => {
+        console.warn(`Vault ${v.vault_pubkey} has no token_accounts, falling back to USDC`);
+        return [USDC_SOL];
+      })(),
🤖 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/wealthville/index.js` at line 30, The fallback to USDC_SOL when
mints.length is zero masks potential data quality issues in vaults with no token
holdings. In the underlyingTokens assignment, implement either Option 1 (skip
processing vaults that have no underlying tokens by returning early or excluding
them from the results) or Option 2 (keep the USDC_SOL fallback but add a warning
log message that surfaces when this default is applied) to make data quality
issues visible rather than silently masked.

10-10: Error handling is optional and not the prevailing pattern in this codebase.

The utils.getData call will throw on network errors or non-2xx responses, causing the adapter to fail entirely. However, most adapters in the codebase (73%) follow the current pattern of letting errors bubble up rather than catching them locally. If the project prefers consistent error handling across all adapters, this change would be aligned with best practices for resilience. Otherwise, the current approach is consistent with the existing pattern.

🤖 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/wealthville/index.js` at line 10, The utils.getData call at line
10 in the Wealthville adapter follows the prevailing pattern in the codebase
where 73% of adapters let errors bubble up rather than implementing local error
handling. No change is required as the current approach is consistent with the
existing codebase pattern. However, if the project decides to implement
consistent error handling across all adapters for improved resilience, you would
wrap the utils.getData call in a try-catch block to capture and handle any
network errors or non-2xx responses before the adapter fails.
🤖 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/wealthville/index.js`:
- Line 24: The pool ID is being constructed using vault_pubkey without
validation, which can result in invalid pool IDs like "undefined-solana" if
vault_pubkey is null or undefined. Add explicit validation to ensure
vault_pubkey exists before using it in the pool ID string template. This
validation should either skip entries with missing vault_pubkey values or throw
an appropriate error to prevent downstream failures caused by invalid pool
identification.

---

Nitpick comments:
In `@src/adaptors/wealthville/index.js`:
- Line 30: The fallback to USDC_SOL when mints.length is zero masks potential
data quality issues in vaults with no token holdings. In the underlyingTokens
assignment, implement either Option 1 (skip processing vaults that have no
underlying tokens by returning early or excluding them from the results) or
Option 2 (keep the USDC_SOL fallback but add a warning log message that surfaces
when this default is applied) to make data quality issues visible rather than
silently masked.
- Line 10: The utils.getData call at line 10 in the Wealthville adapter follows
the prevailing pattern in the codebase where 73% of adapters let errors bubble
up rather than implementing local error handling. No change is required as the
current approach is consistent with the existing codebase pattern. However, if
the project decides to implement consistent error handling across all adapters
for improved resilience, you would wrap the utils.getData call in a try-catch
block to capture and handle any network errors or non-2xx responses before the
adapter fails.
🪄 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: 4d98f5a8-6630-4ce9-b8fc-446852a7be8e

📥 Commits

Reviewing files that changed from the base of the PR and between c6868ce and f0ef4d1.

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

),
];
return {
pool: `${v.vault_pubkey}-solana`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Validate that vault_pubkey exists before using it in the pool ID.

If v.vault_pubkey is undefined or null, the pool ID will be invalid (e.g., "undefined-solana"), causing downstream failures or incorrect pool identification.

🛡️ Suggested validation
   return list
-    .filter((v) => v && v.status === 'active' && Number(v.tvl_usd) > 0)
+    .filter((v) => v && v.status === 'active' && Number(v.tvl_usd) > 0 && v.vault_pubkey && v.name)
     .map((v) => {

Or add explicit validation in the map:

     .map((v) => {
+      if (!v.vault_pubkey || !v.name) {
+        console.warn('Skipping vault missing required fields:', v);
+        return null;
+      }
       const mints = [
         ...new Set(
           (v.token_accounts || [])
             .filter((t) => Number(t.value_usd) > 0 && t.mint)
             .map((t) => t.mint)
         ),
       ];
       return {
         pool: `${v.vault_pubkey}-solana`,
         chain: 'Solana',
         project: 'wealthville',
         symbol: v.name,
         tvlUsd: Number(v.tvl_usd) || 0,
         apyBase: Number(v.apy) || 0,
         underlyingTokens: mints.length ? mints : [USDC_SOL],
         url: 'https://wealthville.net/opportunities',
       };
-    });
+    })
+    .filter(Boolean);
🤖 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/wealthville/index.js` at line 24, The pool ID is being
constructed using vault_pubkey without validation, which can result in invalid
pool IDs like "undefined-solana" if vault_pubkey is null or undefined. Add
explicit validation to ensure vault_pubkey exists before using it in the pool ID
string template. This validation should either skip entries with missing
vault_pubkey values or throw an appropriate error to prevent downstream failures
caused by invalid pool identification.

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