Skip to content

Create index.js#2778

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

Create index.js#2778
yurac777 wants to merge 1 commit into
DefiLlama:masterfrom
yurac777:master

Conversation

@yurac777

@yurac777 yurac777 commented Jul 5, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features
    • Added support for a new Alm Vault listing with live on-chain TVL calculation.
    • Displayed fixed base and reward APY values plus reward token information.
    • Included the vault’s public website link in the listing.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new adaptor module for the Alm Vault protocol that queries an on-chain totalAssets() value via SDK ABI calls on the base chain, computes a USD TVL, and returns a single pool with fixed base and reward APY values, along with module exports for timetravel, apy, and url.

Changes

Alm Vault Adaptor

Layer / File(s) Summary
Adaptor implementation and export
src/adaptors/almvault/index.js
Defines vault/promo address constants, calls totalAssets() ABI on base chain via @defillama/sdk, converts result to TVL-USD (with a 50000 fallback when non-positive), returns a pool object keyed by ${VAULT_ADDRESS}-base with fixed apyBase: 35.5 and apyReward: 85.0, promo reward token, and exports { timetravel: false, apy: getApy, url }.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: 0xkr3p

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too generic and does not identify the actual change or Alm Vault adaptor being added. Rename it to describe the feature, e.g. "Add Alm Vault adaptor" or similar.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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.

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

Error while running almvault adapter:

Test Suites: 1 failed, 1 total
Tests: 2 failed, 9 passed, 11 total
Snapshots: 0 total
Time: 0.32 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────┬────────┬────────────┬────────┬──────────┬─────────┬───────────┬──────────────────────────────────────────────────┬─────────────────────────┬───────────────────────────────┐
│ (index) │ pool                                              │ chain  │ project    │ symbol │ tvlUsd   │ apyBase │ apyReward │ rewardTokens                                     │ poolMeta                │ url                           │
├─────────┼───────────────────────────────────────────────────┼────────┼────────────┼────────┼──────────┼─────────┼───────────┼──────────────────────────────────────────────────┼─────────────────────────┼───────────────────────────────┤
│ 0       │ '0x559DF7e63A2F79B8416fbC1d33A6927b8bDDe555-base' │ 'Base' │ 'almvault' │ 'USDC' │ 0.027993 │ 35.5    │ 85        │ [ '0x03a1363AafeaD13237Ac7065D3d6342CdB56a9B1' ] │ 'Aave + UniV3 Strategy' │ 'https://vault.alm-quant.xyz' │
└─────────┴───────────────────────────────────────────────────┴────────┴────────────┴────────┴──────────┴─────────┴───────────┴──────────────────────────────────────────────────┴─────────────────────────┴───────────────────────────────┘
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: 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/almvault/index.js`:
- Line 17: The TVL fallback in the ALMvault adapter is masking the real result
by forcing a fake 50000 when tvlUsd is zero or the fetch fails. Update the logic
in the tvlUsd assignment path in index.js so it preserves a legitimate zero TVL
and does not substitute a fabricated value; if tvlData.output is missing or
invalid, surface the failure by throwing or logging an error instead of
defaulting. Refer to the tvlUsd calculation and the tvlData/output handling in
the adaptor entrypoint to locate the fix.
- Around line 18-19: The APY values in the ALMVault adaptor are hardcoded
constants and must be replaced with data sourced from on-chain vault state or
reward-emission inputs. Update the adaptor’s APY computation in the relevant
export so `apyBase` and `apyReward` are derived dynamically from actual vault
performance rather than fixed literals, using the existing adaptor logic and
on-chain/subgraph data sources tied to the ALMVault implementation.
🪄 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: a0d03972-c346-4084-8898-aafe0dd97094

📥 Commits

Reviewing files that changed from the base of the PR and between 45800e0 and 06b328b.

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

chain: 'Base',
project: 'almvault',
symbol: 'USDC',
tvlUsd: tvlUsd > 0 ? tvlUsd : 50000,

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Fabricated TVL fallback masks real state.

If tvlData.output is 0 or the call fails/returns unexpected data, tvlUsd silently defaults to a fake 50000 instead of surfacing an error or reporting the true (possibly zero) TVL. This misrepresents the protocol's actual TVL to consumers.

Suggested fix
-    tvlUsd: tvlUsd > 0 ? tvlUsd : 50000, 
+    tvlUsd,

If the call can legitimately fail, throw/log instead of substituting a fabricated value.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
tvlUsd: tvlUsd > 0 ? tvlUsd : 50000,
tvlUsd,
🤖 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/almvault/index.js` at line 17, The TVL fallback in the ALMvault
adapter is masking the real result by forcing a fake 50000 when tvlUsd is zero
or the fetch fails. Update the logic in the tvlUsd assignment path in index.js
so it preserves a legitimate zero TVL and does not substitute a fabricated
value; if tvlData.output is missing or invalid, surface the failure by throwing
or logging an error instead of defaulting. Refer to the tvlUsd calculation and
the tvlData/output handling in the adaptor entrypoint to locate the fix.

Comment on lines +18 to +19
apyBase: 35.5,
apyReward: 85.0,

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.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Hardcoded, unchanging APY values violate on-chain sourcing requirement.

apyBase: 35.5 and apyReward: 85.0 are static literals, not derived from any on-chain data, and will never fluctuate regardless of real vault performance. DefiLlama's adaptor guidelines require yield data to be fetched from on-chain calls or subgraphs and to reflect the minimum attainable yield for the pool.

Suggested direction
-    apyBase: 35.5,    
-    apyReward: 85.0,  
+    apyBase: computedBaseApy,
+    apyReward: computedRewardApy,

Derive these from actual vault performance/reward-emission data rather than fixed constants.

🤖 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/almvault/index.js` around lines 18 - 19, The APY values in the
ALMVault adaptor are hardcoded constants and must be replaced with data sourced
from on-chain vault state or reward-emission inputs. Update the adaptor’s APY
computation in the relevant export so `apyBase` and `apyReward` are derived
dynamically from actual vault performance rather than fixed literals, using the
existing adaptor logic and on-chain/subgraph data sources tied to the ALMVault
implementation.

@0xkr3p 0xkr3p 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.

hi @yurac777, thanks for the pr! A couple of things required before we can proceed:

  • A TVL adapter is required
  • apy base/reward should not be hardcoded and should be calculated from on chain data
  • tvl should not fallback to hardcoded 50000

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