Create index.js#2778
Conversation
📝 WalkthroughWalkthroughAdds a new adaptor module for the Alm Vault protocol that queries an on-chain ChangesAlm Vault Adaptor
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Error while running almvault adapter: Test Suites: 1 failed, 1 total |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
src/adaptors/almvault/index.js
| chain: 'Base', | ||
| project: 'almvault', | ||
| symbol: 'USDC', | ||
| tvlUsd: tvlUsd > 0 ? tvlUsd : 50000, |
There was a problem hiding this comment.
🗄️ 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.
| 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.
| apyBase: 35.5, | ||
| apyReward: 85.0, |
There was a problem hiding this comment.
🗄️ 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
left a comment
There was a problem hiding this comment.
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
Summary by CodeRabbit