morpho-blue: use 1d-realized APY and drop spike snapshots#2686
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR refactors the Morpho Blue yield adapter to query and sanitize daily APY components ( ChangesMorpho Blue APY Refactoring
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
The morpho-blue adapter exports pools: Test Suites: 1 passed, 1 total |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/adaptors/morpho-blue/index.js (1)
151-152: ⚡ Quick winV2 query fetches
baseApyDaybut never reads it.
buildVaultV2Poolsonly consumesvault.netApyDay(line 261) and derivesapyBaseasnetApy - rewardComponent * 100(line 279). ThebaseApyDayalias added at line 152 is unused, so this either wastes a GraphQL field or — more likely — was intended to driveapyBasedirectly (which would also make V2 consistent with the V1 path that usessanitizeApyPct(vault.state.baseApyDay)).Either drop
baseApyDayfrom the query, or use it in V2 the same way V1 does and reserve thenetApy - rewardComponentarithmetic for back-checking the split.🤖 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/morpho-blue/index.js` around lines 151 - 152, The V2 query adds baseApyDay but nothing reads it; update buildVaultV2Pools to use the fetched vault.baseApyDay for apyBase (mirroring V1's sanitizeApyPct(vault.state.baseApyDay)) instead of computing apyBase as netApy - rewardComponent*100, and keep the netApy - rewardComponent arithmetic only for a sanity check or remove baseApyDay from the GraphQL query entirely — adjust the code paths that reference apyBase (and function sanitizeApyPct) so V2 consumes vault.baseApyDay consistently.
🤖 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/morpho-blue/index.js`:
- Around line 398-409: The pool shaping logic in the Morpho Blue adaptor can
return non-empty reward tokens with a zero `apyReward` when
`vault.state.netApyDay` is missing, which creates a misleading result. Update
the `buildVaultV1Pools` flow around `sanitizeApyPct`, `isNegligibleApy`,
`rewardTokens`, and `apyReward` so the missing-`netApy` case is handled
consistently: either skip returning the pool when `netApy` is null like
`buildVaultV2Pools` does, or force the no-net case to behave as negligible so
`rewardTokens` stays empty and the APY fields remain aligned.
---
Nitpick comments:
In `@src/adaptors/morpho-blue/index.js`:
- Around line 151-152: The V2 query adds baseApyDay but nothing reads it; update
buildVaultV2Pools to use the fetched vault.baseApyDay for apyBase (mirroring
V1's sanitizeApyPct(vault.state.baseApyDay)) instead of computing apyBase as
netApy - rewardComponent*100, and keep the netApy - rewardComponent arithmetic
only for a sanity check or remove baseApyDay from the GraphQL query entirely —
adjust the code paths that reference apyBase (and function sanitizeApyPct) so V2
consumes vault.baseApyDay consistently.
🪄 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: afefd1e4-b28f-4d21-b5f5-5d9bd527cb6c
📒 Files selected for processing (1)
src/adaptors/morpho-blue/index.js
Adapter recorded Morpho's instantaneous netApy, which briefly spikes when underlying markets hit ~100% utilization. Switch to avgNetApy(lookback: ONE_DAY) for both base and net, and drop pools whose 1d-realized reading exceeds 200% — broken liquidity adapters return constant 1000%+ values across every Morpho field. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2b5fd78 to
09e1df1
Compare
|
The morpho-blue adapter exports pools: Test Suites: 1 passed, 1 total |
Adapter recorded Morpho's instantaneous netApy, which briefly spikes when underlying markets hit ~100% utilization. Switch to avgNetApy(lookback: ONE_DAY) for both base and net, and drop pools whose 1d-realized reading exceeds 200% — broken liquidity adapters return constant 1000%+ values across every Morpho field.
Summary by CodeRabbit
Release Notes