feat: add HypeZion Finance token pricing adapter#11672
feat: add HypeZion Finance token pricing adapter#11672huy090202 wants to merge 3 commits intoDefiLlama:masterfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Warning Rate limit exceeded
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 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)
📝 WalkthroughWalkthroughA new token pricing adapter for HypeZion is added to the adapter registry. The adapter fetches token prices by calling the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
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]>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
coins/src/adapters/other/hypezion.ts (2)
25-30: Unused ABI entries.
totalAssetsandtotalSupplyare declared inabisbut never called — onlygetProtocolNavInUSDis 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 settingunderlyingon 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 nounderlyinglink 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
📒 Files selected for processing (2)
coins/src/adapters/other/hypezion.tscoins/src/adapters/other/index.ts
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]>
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
How it works
Single on-chain call to
getProtocolNavInUSD()on ourExchangeInformationcontract 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
Related PRs
Summary by CodeRabbit
Release Notes