add mezo vaults#2676
Conversation
|
The mezo-vaults adapter exports pools: Test Suites: 1 passed, 1 total |
|
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)
📝 WalkthroughWalkthroughAdds a Mezo Vaults adaptor that reads on-chain vault and gauge data, computes base APY from yieldIndex history, derives reward APY from gauge rewards, calculates unstaked and staked TVL, and returns two pools. ChangesMezo Vaults Adaptor Implementation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
🚥 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/adaptors/mezo-vaults/index.js (1)
48-48: ⚡ Quick winConsider logging errors in the catch block.
The empty catch block silently swallows errors when querying historical yield index, which could hide network issues, invalid block numbers, or ABI mismatches. While the fallback logic is intentional, completely silent failures make debugging difficult in production.
💬 Suggested improvement to add minimal logging
- } catch {} + } catch (err) { + // Silently continue to next window if block data unavailable + }Or with optional logging:
- } catch {} + } catch (err) { + console.warn(`Failed to fetch yieldIndex at block ${olderBlock}:`, err.message); + }🤖 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/mezo-vaults/index.js` at line 48, The empty catch block (catch {}) that swallows errors when querying the historical yield index should log the caught error and context: replace the silent catch with one that accepts the error (e) and calls the project's logger or console.error with a descriptive message including the function/operation name (e.g., "historical yield index query"), the relevant identifiers (vault/address/block number), and the error stack/message; if a logger is available use that (e.g., logger.error(...)) and keep the fallback behavior afterwards.
🤖 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/mezo-vaults/index.js`:
- Line 123: The pool ID template literals contain an extra closing brace causing
a syntax error; locate the object/property setting pool (the entry using
`${VAULT.toLowerCase()}-${CHAIN}}`) in src/adaptors/mezo-vaults/index.js (and
the similar occurrence referenced at the other location) and fix the template
literal to `${VAULT.toLowerCase()}-${CHAIN}` so the pool string is correctly
formed in both places.
- Line 130: The hardcoded pricePerShare should be replaced with a dynamic
calculation: before building the pools array, compute pricePerShare =
totalAssets / totalSupply (using the vault's totalAssets and totalSupply fields)
and use that value instead of 1 for each pool entry; guard against division by
zero by falling back to 1 when totalSupply is 0. Update both occurrences where
pricePerShare: 1 appears (the pools construction in
src/adaptors/mezo-vaults/index.js) to reference this computed pricePerShare
variable.
- Line 13: Replace the incorrect SECONDS_PER_BLOCK constant (currently set to 2)
with Mezo's actual average block time (~14.3 seconds) by updating the
SECONDS_PER_BLOCK value to 14.3 (or 14–15 as a rounded alternative); after
changing the numeric literal, verify any calculations that assume an integer
(e.g., Math.floor/parseInt usage or block lookback computations) still behave
correctly with a float and adjust casts if necessary.
---
Nitpick comments:
In `@src/adaptors/mezo-vaults/index.js`:
- Line 48: The empty catch block (catch {}) that swallows errors when querying
the historical yield index should log the caught error and context: replace the
silent catch with one that accepts the error (e) and calls the project's logger
or console.error with a descriptive message including the function/operation
name (e.g., "historical yield index query"), the relevant identifiers
(vault/address/block number), and the error stack/message; if a logger is
available use that (e.g., logger.error(...)) and keep the fallback behavior
afterwards.
🪄 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: 1aa7b6e3-f35a-4fa7-8676-9eb4726eabb5
📒 Files selected for processing (1)
src/adaptors/mezo-vaults/index.js
|
The mezo-vaults adapter exports pools: Test Suites: 1 passed, 1 total |
|
The mezo-vaults adapter exports pools: Test Suites: 1 passed, 1 total |
Summary by CodeRabbit