Skip to content

Add Monetrix yield adapter (sUSDM)#2740

Open
MonetrixLab wants to merge 1 commit into
DefiLlama:masterfrom
MonetrixLab:add-monetrix-yield-adapter
Open

Add Monetrix yield adapter (sUSDM)#2740
MonetrixLab wants to merge 1 commit into
DefiLlama:masterfrom
MonetrixLab:add-monetrix-yield-adapter

Conversation

@MonetrixLab

@MonetrixLab MonetrixLab commented Jun 16, 2026

Copy link
Copy Markdown

Adds the sUSDM pool for Monetrix (TVL already merged, slug monetrix).

  • tvlUsd: sUSDM totalAssets() priced via USDC ($1-pegged; USDM has no price feed yet)
  • apyBase: sUSDM share-price (convertToAssets) growth over a trailing 7d window, annualized — fully on-chain, immune to deposits/withdrawals
  • Also adds usdm to triggerEnrichment.js so the pool is flagged as a stablecoin pool

Summary by CodeRabbit

Release Notes

  • New Features
    • Integrated Monetrix yield protocol support, enabling APY calculations for Hyperliquid sUSDM vault with annualized yield metrics, real-time share-price tracking, and accurate USD-denominated TVL valuations.
    • Enhanced stablecoin ecosystem by officially registering USDM in the platform's recognized stablecoins list, improving asset compatibility and protocol coverage.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

A new Monetrix adaptor is added that computes APY for the Hyperliquid sUSDM ERC-4626 vault using a clamped 7-day trailing window of convertToAssets share-price readings, annualizes the growth, and derives USD TVL via USDC pricing. The token 'usdm' is also appended to the stablecoins list in the enrichment handler.

Changes

Monetrix sUSDM Adaptor

Layer / File(s) Summary
Adaptor constants, APY logic, and exports
src/adaptors/monetrix/index.js
Defines Hyperliquid chain/contract addresses and timing constants, implements the async apy function (block fetching, parallel convertToAssets calls, APY annualization, USD TVL computation), and exports timetravel, apy, and url.
Register 'usdm' in enrichment stablecoins
src/handlers/triggerEnrichment.js
Adds a conditional append of 'usdm' to the stablecoins array so the token is treated as a stablecoin during yield enrichment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • 0xkr3p

Poem

🐇 A vault on Hyperliquid, shiny and new,
sUSDM earns yield — the rabbit approves too!
Seven days of prices, annualized with care,
USDM's a stablecoin now, officially there.
Hop hop, the adaptor is live and it's true! 🌟

🚥 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 'Add Monetrix yield adapter (sUSDM)' clearly and directly describes the main change: adding a new yield adapter for the Monetrix sUSDM vault, which is the primary objective of the changeset.
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.

@github-actions

Copy link
Copy Markdown

The monetrix adapter exports pools:

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

Nb of pools: 1
 

Sample pools:
┌─────────┬──────────────────────────────────────────────────────────┬──────────────────┬────────────┬────────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬─────────────────────────────┐
│ (index) │ pool                                                     │ chain            │ project    │ symbol │ tvlUsd             │ apyBase           │ underlyingTokens                                 │ url                         │
├─────────┼──────────────────────────────────────────────────────────┼──────────────────┼────────────┼────────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼─────────────────────────────┤
│ 0       │ '0x5f1ab62C3159eBE04aFF14Beef84b0b60de63DDF-hyperliquid' │ 'Hyperliquid L1' │ 'monetrix' │ 'USDM' │ 1149401.5044407474 │ 9.135380958497773 │ [ '0xE2d2959f89B6389DeB624bF076Fe7D9E5401f377' ] │ 'https://www.monetrix.xyz/' │
└─────────┴──────────────────────────────────────────────────────────┴──────────────────┴────────────┴────────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴─────────────────────────────┘

@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: 1

🤖 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/monetrix/index.js`:
- Around line 42-43: The totalAssets RPC call in the Promise.all block is
missing a block parameter, causing it to be fetched at the latest head while the
ppsNowRes and ppsPastRes calls are pinned to specific block numbers. Add a block
parameter to the sdk.api.abi.call for the SUSDM totalAssets target to match the
same block number used in the ppsNowRes call so that all three data points are
consistently fetched from the same block height.
🪄 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: d778de1c-c443-484e-b454-aa6b7672c2e9

📥 Commits

Reviewing files that changed from the base of the PR and between cc1da6e and f994a56.

📒 Files selected for processing (2)
  • src/adaptors/monetrix/index.js
  • src/handlers/triggerEnrichment.js

Comment on lines +42 to +43
const [totalAssetsRes, ppsNowRes, ppsPastRes] = await Promise.all([
sdk.api.abi.call({ target: SUSDM, chain: CHAIN, abi: 'uint256:totalAssets' }),

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Pin totalAssets to the same block as the APY snapshot.

Right now TVL is fetched at whatever the latest head is when the RPC call lands, while the share-price samples are pinned to latest.number/past.block. That can produce a small block-to-block mismatch in tvlUsd.

♻️ Proposed fix
   const [totalAssetsRes, ppsNowRes, ppsPastRes] = await Promise.all([
-    sdk.api.abi.call({ target: SUSDM, chain: CHAIN, abi: 'uint256:totalAssets' }),
+    sdk.api.abi.call({
+      target: SUSDM,
+      chain: CHAIN,
+      abi: 'uint256:totalAssets',
+      block: latest.number,
+    }),
     sdk.api.abi.call({
       target: SUSDM,
       chain: CHAIN,
📝 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
const [totalAssetsRes, ppsNowRes, ppsPastRes] = await Promise.all([
sdk.api.abi.call({ target: SUSDM, chain: CHAIN, abi: 'uint256:totalAssets' }),
const [totalAssetsRes, ppsNowRes, ppsPastRes] = await Promise.all([
sdk.api.abi.call({
target: SUSDM,
chain: CHAIN,
abi: 'uint256:totalAssets',
block: latest.number,
}),
🤖 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/monetrix/index.js` around lines 42 - 43, The totalAssets RPC
call in the Promise.all block is missing a block parameter, causing it to be
fetched at the latest head while the ppsNowRes and ppsPastRes calls are pinned
to specific block numbers. Add a block parameter to the sdk.api.abi.call for the
SUSDM totalAssets target to match the same block number used in the ppsNowRes
call so that all three data points are consistently fetched from the same block
height.

tvlUsd: tvlUnderlying * usdcPrice,
apyBase,
underlyingTokens: [USDM],
url: 'https://www.monetrix.xyz/',

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.

pls add pricePerShare

tvlUsd: tvlUnderlying * usdcPrice,
apyBase,
underlyingTokens: [USDM],
url: 'https://www.monetrix.xyz/',

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.

: 0;

// USDM has no price feed yet; it mints/redeems 1:1 against USDC, so price via USDC
const { pricesByAddress } = await utils.getPrices([USDC], CHAIN);

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.

we could use usdm and fallback to usdc so works when pricing is added


return [
{
pool: `${SUSDM}-${CHAIN}`,

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.

pls add toLowerCase()

tvlUsd: tvlUnderlying * usdcPrice,
apyBase,
underlyingTokens: [USDM],
url: 'https://www.monetrix.xyz/',

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.

this is a yield bearing stablecoin so we should add isIntrinsicSource: true

@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 @MonetrixLab, thanks for the PR - i've left a few comments to resolve

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