Skip to content

feat: add HypeZion Finance token pricing adapter#11672

Open
huy090202 wants to merge 3 commits intoDefiLlama:masterfrom
huy090202:master
Open

feat: add HypeZion Finance token pricing adapter#11672
huy090202 wants to merge 3 commits intoDefiLlama:masterfrom
huy090202:master

Conversation

@huy090202
Copy link
Copy Markdown

@huy090202 huy090202 commented Apr 6, 2026

HypeZion Finance — Token Pricing Adapter

Protocol: Structured product protocol on Hyperliquid L1, issues
stablecoin (hzUSD) and leverage token (BullHYPE) backed by HYPE reserves.

Chain: Hyperliquid

Tokens priced

Token Address Methodology
hzUSD 0x6E2ade6FFc94d24A81406285c179227dfBFc97CE Stablecoin NAV (reserve/supply), ~$1
BullHYPE 0x12cF926C3884dda144e18E11e2659c0675cF20eA zHYPE NAV × HYPE price (leverage token)
shzUSD 0xce01a9B9bc08f0847fb745044330Eff1181360Cd ERC-4626 share price

How it works

Single on-chain call to getProtocolNavInUSD() on our ExchangeInformation
contract returns all 3 NAVs in USD (18 decimals). All pricing is on-chain —
no off-chain oracle. Uses standard getWrites() with default confidence 0.98.

Local test output

symbol price
hzUSD 1.00
bullHYPE 72.11
shzUSD 1.0447

Related PRs

Summary by CodeRabbit

Release Notes

  • New Features
    • Added HypeZion pricing adapter to retrieve real-time pricing data for HZUSD, BullHYPE, and shzUSD tokens on the Hyperliquid chain.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 6, 2026

Warning

Rate limit exceeded

@huy090202 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 51 minutes and 13 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 51 minutes and 13 seconds.

⌛ 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: 5397c1a1-ff00-4a7b-9322-3fcebe4d4c88

📥 Commits

Reviewing files that changed from the base of the PR and between dc45216 and 3072ad9.

📒 Files selected for processing (1)
  • coins/src/adapters/other/hypezion.ts
📝 Walkthrough

Walkthrough

A new token pricing adapter for HypeZion is added to the adapter registry. The adapter fetches token prices by calling the EXCHANGE_INFO contract's getProtocolNavInUSD() method, processes the returned NAV values, and integrates with the existing adapter infrastructure via getWrites().

Changes

Cohort / File(s) Summary
New HypeZion Adapter
coins/src/adapters/other/hypezion.ts
Implements async getTokenPrices() function that calls Hyperliquid's EXCHANGE_INFO contract to retrieve NAV prices for three HypeZion tokens (HZUSD, BullHYPE, shzUSD), converts 18-decimal values to JavaScript numbers, and filters results to include only tokens with positive NAV values.
Adapter Registry Update
coins/src/adapters/other/index.ts
Registers the new hypezion adapter by importing and exporting a delegating function alongside existing adapters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A new adapter hops into place,
HypeZion tokens find their pricing grace,
NAV values converted with care,
Three tokens priced with rabbity flair! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding a token pricing adapter for HypeZion Finance. It is concise, specific, and directly reflects the primary modification in the changeset.

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

Adapter was exported but missing from the adapters object,
so DefiLlama never invoked it.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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: 1

🧹 Nitpick comments (2)
coins/src/adapters/other/hypezion.ts (2)

25-30: Unused ABI entries.

totalAssets and totalSupply are declared in abis but never called — only getProtocolNavInUSD is used. Consider removing them (or inlining the one used ABI) to avoid implying behavior the adapter does not implement.

♻️ Suggested cleanup
-const abis = {
-  getProtocolNavInUSD:
-    "function getProtocolNavInUSD() view returns (uint256 zusdNav, uint256 zhypeNav, uint256 szusdNav, uint256 hypePrice)",
-  totalAssets: "uint256:totalAssets",
-  totalSupply: "uint256:totalSupply",
-};
+const getProtocolNavInUSDAbi =
+  "function getProtocolNavInUSD() view returns (uint256 zusdNav, uint256 zhypeNav, uint256 szusdNav, uint256 hypePrice)";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@coins/src/adapters/other/hypezion.ts` around lines 25 - 30, The abis object
currently declares totalAssets and totalSupply even though only
getProtocolNavInUSD is used; remove the unused entries (totalAssets and
totalSupply) from the abis constant or replace abis with a single inline ABI
string for getProtocolNavInUSD to avoid implying unsupported behavior — locate
the abis declaration in hypezion.ts and delete the unused keys or inline
getProtocolNavInUSD where it's referenced.

47-59: Consider setting underlying on the priced tokens.

Most sibling adapters populate { price, underlying } so the pricing graph can attribute a source token (USD stable, HYPE, or the vault's underlying hzUSD for shzUSD). Here all three entries are priced purely by absolute USD NAV with no underlying, which still works but loses downstream linkage (and diverges from the BullHYPE description in the PR, which is "zHYPE NAV × HYPE price"). If NAVs from the contract are already denominated in USD 1e18 this is acceptable; just confirm that's the intended semantics and that no underlying link is desired for shzUSD → hzUSD.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@coins/src/adapters/other/hypezion.ts` around lines 47 - 59, The priced
entries for zusdNav, zhypeNav, and szusdNav in pricesObject lack an underlying
field; update the assignment for HZUSD, BULLHYPE, and STAKED_HZUSD to include an
appropriate underlying token id (e.g., USD stable token for zusdNav, HYPE token
for zhypeNav if BullHYPE = zHYPE NAV × HYPE price, and hzUSD for szusdNav if
shzUSD represents vault shares) so downstream graph can link sources; confirm
that zusdNav is indeed USD-denominated 1e18 before setting underlying to the USD
token and add underlying properties to the objects created by
pricesObject[HZUSD], pricesObject[BULLHYPE], and pricesObject[STAKED_HZUSD].
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@coins/src/adapters/other/hypezion.ts`:
- Around line 22-23: The EXCHANGE_INFO constant is marked TODO and may point at
a placeholder; confirm the final deployed ExchangeInformation address on
Hyperliquid mainnet and update EXCHANGE_INFO to that verified address, then
remove the TODO comment; additionally add a runtime guard in the adapter
initialization (referencing EXCHANGE_INFO and getProtocolNavInUSD) that verifies
the contract exists (e.g., check code length or an env/feature-flag like
VERIFIED_EXCHANGE_INFO) and throw/log and refuse to start or skip reads if the
address is not verified to avoid silent failures or stale NAVs.

---

Nitpick comments:
In `@coins/src/adapters/other/hypezion.ts`:
- Around line 25-30: The abis object currently declares totalAssets and
totalSupply even though only getProtocolNavInUSD is used; remove the unused
entries (totalAssets and totalSupply) from the abis constant or replace abis
with a single inline ABI string for getProtocolNavInUSD to avoid implying
unsupported behavior — locate the abis declaration in hypezion.ts and delete the
unused keys or inline getProtocolNavInUSD where it's referenced.
- Around line 47-59: The priced entries for zusdNav, zhypeNav, and szusdNav in
pricesObject lack an underlying field; update the assignment for HZUSD,
BULLHYPE, and STAKED_HZUSD to include an appropriate underlying token id (e.g.,
USD stable token for zusdNav, HYPE token for zhypeNav if BullHYPE = zHYPE NAV ×
HYPE price, and hzUSD for szusdNav if shzUSD represents vault shares) so
downstream graph can link sources; confirm that zusdNav is indeed
USD-denominated 1e18 before setting underlying to the USD token and add
underlying properties to the objects created by pricesObject[HZUSD],
pricesObject[BULLHYPE], and pricesObject[STAKED_HZUSD].
🪄 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: ed9ed6ab-d415-44ec-9590-6147e05598ab

📥 Commits

Reviewing files that changed from the base of the PR and between 3bcfebe and dc45216.

📒 Files selected for processing (2)
  • coins/src/adapters/other/hypezion.ts
  • coins/src/adapters/other/index.ts

Comment thread coins/src/adapters/other/hypezion.ts Outdated
getProtocolNavInUSD() returns valid NAVs (hzUSD=$1.00, bullHYPE=$72.11,
shzUSD=$1.0447) on Hyperliquid mainnet.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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