Skip to content

add mezo vaults#2676

Merged
0xkr3p merged 4 commits into
DefiLlama:masterfrom
0xkr3p:feat/add-mezo-vaults
May 13, 2026
Merged

add mezo vaults#2676
0xkr3p merged 4 commits into
DefiLlama:masterfrom
0xkr3p:feat/add-mezo-vaults

Conversation

@0xkr3p
Copy link
Copy Markdown
Contributor

@0xkr3p 0xkr3p commented May 13, 2026

Summary by CodeRabbit

  • New Features
    • Added Mezo vaults support to track unstaked and gauge-staked positions.
    • Real-time APY reporting combining base yield over recent lookbacks and active reward-derived APY.
    • View USD TVL for unstaked vs. staked portions and compare yield strategies across Mezo vaults.

Review Change Stack

@github-actions
Copy link
Copy Markdown

The mezo-vaults adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 21 passed, 21 total
Snapshots: 0 total
Time: 0.236 s
Ran all test suites.

Nb of pools: 2
 

Sample pools:
┌─────────┬────────────────────────────────────────────────────┬────────┬───────────────┬─────────┬───────────────────┬────────────────────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬──────────────────────────────────────────────────┬───────────────┬────────────────────────────────┐
│ (index) │ pool                                               │ chain  │ project       │ symbol  │ poolMeta          │ tvlUsd             │ apyBase            │ apyReward         │ rewardTokens                                     │ underlyingTokens                                 │ pricePerShare │ url                            │
├─────────┼────────────────────────────────────────────────────┼────────┼───────────────┼─────────┼───────────────────┼────────────────────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼──────────────────────────────────────────────────┼───────────────┼────────────────────────────────┤
│ 0       │ '0x677817bf3e44b90e8f95222f75e2950b7904a401-mezo}' │ 'Mezo' │ 'mezo-vaults' │ 'sMUSD' │ 'Staked in gauge' │ 5142562.390878621  │ 0                  │ 43.79937553516833 │ [ '0x7B7c000000000000000000000000000000000001' ] │ [ '0xdD468A1DDc392dcdbEf6db6e34E89AA338F9F186' ] │ 1             │ 'https://mezo.org/earn/vaults' │
│ 1       │ '0xb4d498029af77680cd1ef828b967f010d06c51cc-mezo}' │ 'Mezo' │ 'mezo-vaults' │ 'sMUSD' │                   │ 104680.28619213254 │ 2.5059421329398193 │                   │                                                  │ [ '0xdD468A1DDc392dcdbEf6db6e34E89AA338F9F186' ] │ 1             │ 'https://mezo.org/earn/vaults' │
└─────────┴────────────────────────────────────────────────────┴────────┴───────────────┴─────────┴───────────────────┴────────────────────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴──────────────────────────────────────────────────┴───────────────┴────────────────────────────────┘

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

Warning

Rate limit exceeded

@0xkr3p has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 2 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6d7d1562-9fa5-41e0-8bae-f03b6a6d57d0

📥 Commits

Reviewing files that changed from the base of the PR and between 7228a34 and 565460b.

📒 Files selected for processing (1)
  • src/adaptors/mezo-vaults/index.js
📝 Walkthrough

Walkthrough

Adds 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.

Changes

Mezo Vaults Adaptor Implementation

Layer / File(s) Summary
Constants, ABIs, and base APY computation
src/adaptors/mezo-vaults/index.js
Defines Mezo constants/ABI fragments and computeBaseApr which retrieves historical yieldIndex at 7- and 3-day lookbacks to compute an annualized base APY.
Concurrent on-chain data fetching
src/adaptors/mezo-vaults/index.js
Implements getApy fetching current yieldIndex, vault/strategy balances, vault share supply, gauge staked supply, gauge reward token/rate/periodFinish, and latest block concurrently.
TVL, base APY and reward APY computation
src/adaptors/mezo-vaults/index.js
Fetches token prices, computes total, unstaked, and gauge-staked USD TVL; converts yieldIndex changes to apyBase via computeBaseApr; computes apyReward from annualized reward rate if reward period is active.
Pool output formatting and module export
src/adaptors/mezo-vaults/index.js
Builds two pool entries (unstaked and staked-in-gauge) with TVL and APY fields, filters results with utils.keepFinite, and exports timetravel: false, apy: getApy, and url.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

"I nibble logs of on-chain time,
pulling indices, prices, and rhyme.
Two pools sprout where numbers play,
base and reward light up the way.
A happy hop — APYs all day!" 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 new adaptor for Mezo vaults to the codebase.
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.

✏️ 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/adaptors/mezo-vaults/index.js (1)

48-48: ⚡ Quick win

Consider 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

📥 Commits

Reviewing files that changed from the base of the PR and between e5d514d and cf37ab9.

📒 Files selected for processing (1)
  • src/adaptors/mezo-vaults/index.js

Comment thread src/adaptors/mezo-vaults/index.js Outdated
Comment thread src/adaptors/mezo-vaults/index.js Outdated
Comment thread src/adaptors/mezo-vaults/index.js Outdated
@github-actions
Copy link
Copy Markdown

The mezo-vaults adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 21 passed, 21 total
Snapshots: 0 total
Time: 0.271 s
Ran all test suites.

Nb of pools: 2
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────┬────────┬───────────────┬─────────┬───────────────────┬───────────────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────┬──────────────────────────────────────────────────┬───────────────┬────────────────────────────────┐
│ (index) │ pool                                              │ chain  │ project       │ symbol  │ poolMeta          │ tvlUsd            │ apyBase            │ apyReward          │ rewardTokens                                     │ underlyingTokens                                 │ pricePerShare │ url                            │
├─────────┼───────────────────────────────────────────────────┼────────┼───────────────┼─────────┼───────────────────┼───────────────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────┼──────────────────────────────────────────────────┼───────────────┼────────────────────────────────┤
│ 0       │ '0x677817bf3e44b90e8f95222f75e2950b7904a401-mezo' │ 'Mezo' │ 'mezo-vaults' │ 'sMUSD' │ 'Staked in gauge' │ 5142901.855131183 │ 0                  │ 43.786842158411396 │ [ '0x7B7c000000000000000000000000000000000001' ] │ [ '0xdD468A1DDc392dcdbEf6db6e34E89AA338F9F186' ] │ 1             │ 'https://mezo.org/earn/vaults' │
│ 1       │ '0xb4d498029af77680cd1ef828b967f010d06c51cc-mezo' │ 'Mezo' │ 'mezo-vaults' │ 'sMUSD' │                   │ 104685.422805771  │ 1.6463090582155873 │                    │                                                  │ [ '0xdD468A1DDc392dcdbEf6db6e34E89AA338F9F186' ] │ 1             │ 'https://mezo.org/earn/vaults' │
└─────────┴───────────────────────────────────────────────────┴────────┴───────────────┴─────────┴───────────────────┴───────────────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────┴──────────────────────────────────────────────────┴───────────────┴────────────────────────────────┘

@github-actions
Copy link
Copy Markdown

The mezo-vaults adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 17 passed, 17 total
Snapshots: 0 total
Time: 0.235 s
Ran all test suites.

Nb of pools: 2
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────┬────────┬───────────────┬─────────┬───────────────────┬───────────────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────┬──────────────────────────────────────────────────┬────────────────────────────────┐
│ (index) │ pool                                              │ chain  │ project       │ symbol  │ poolMeta          │ tvlUsd            │ apyBase            │ apyReward          │ rewardTokens                                     │ underlyingTokens                                 │ url                            │
├─────────┼───────────────────────────────────────────────────┼────────┼───────────────┼─────────┼───────────────────┼───────────────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────┼──────────────────────────────────────────────────┼────────────────────────────────┤
│ 0       │ '0x677817bf3e44b90e8f95222f75e2950b7904a401-mezo' │ 'Mezo' │ 'mezo-vaults' │ 'sMUSD' │ 'Staked in gauge' │ 5142901.855131183 │ 0                  │ 43.786842158411396 │ [ '0x7B7c000000000000000000000000000000000001' ] │ [ '0xdD468A1DDc392dcdbEf6db6e34E89AA338F9F186' ] │ 'https://mezo.org/earn/vaults' │
│ 1       │ '0xb4d498029af77680cd1ef828b967f010d06c51cc-mezo' │ 'Mezo' │ 'mezo-vaults' │ 'sMUSD' │                   │ 104685.422805771  │ 1.6450810737624981 │                    │                                                  │ [ '0xdD468A1DDc392dcdbEf6db6e34E89AA338F9F186' ] │ 'https://mezo.org/earn/vaults' │
└─────────┴───────────────────────────────────────────────────┴────────┴───────────────┴─────────┴───────────────────┴───────────────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────┘

@0xkr3p 0xkr3p merged commit cc96b57 into DefiLlama:master May 13, 2026
2 checks passed
@0xkr3p 0xkr3p deleted the feat/add-mezo-vaults branch May 13, 2026 10:20
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