You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
harmonix-finance: price each hyperevm vault by its own currency instead of one pyth feed - #3274
The chainId === 'hyperliquid' branch read one Pyth feed and multiplied every vault's tvl by it,
whatever the vault held, which is why all three Hyperliquid pools published the same implied price of
$65.2563 and a 167,869 USDC vault came out at $10.95m. This prices v.tvl by the vault's own vault_currency, through assets.hyperliquid, which is what the other chains' branch already does. The
hand-rolled ethers provider and the feed id go with it.
pool
before
after
why
USDC 0x1D5D9E73...
10,954,520
167,842
167,869.0642 USDC at $0.9998 instead of at $65.26
KHYPE 0x1368ee9d...
3,484,662
3,311,971
53,399.5963 kHYPE at kHYPE's own $62.02
HYPE 0xfde5b062...
618,247
572,885
9,474.1282 HYPE at $60.47, coins instead of the Pyth read
Arbitrum USDC x2
425,631
425,631
untouched branch
total
15,483,060
4,478,329
The control is the other repo: DefiLlama-Adapters' TVL for the protocol reads Hyperliquid L1
$4,102,909 and Arbitrum $436,638 against the $4,052,698 and $425,631 here, both inside the price
timing, where before the merge the Hyperliquid side disagreed by $11.0m.
testing
npm run test --adapter=harmonix-finance, twice, 41 tests passed both times and the two runs differ
only by the price refresh ($167,840.29 then $167,841.97):
The two throws are deliberate: a vault currency with no address in assets.hyperliquid, or a token
coins does not price, should stop the pool rather than publish a figure priced off something else.
Summary by CodeRabbit
Bug Fixes
Hyperliquid vault USD TVL now reflects the vault token’s current price, improving displayed valuations as prices change. TVL can’t be calculated if the token isn’t recognized or its price is unavailable.
A vault that fails to load no longer prevents other vault results from being displayed; unavailable vaults are omitted.
No actionable comments were generated in the recent review.
Walkthrough
The Hyperliquid pricing path now uses each vault currency’s mapped token address and current price. Missing addresses or prices raise errors. Vault requests use Promise.allSettled; the adapter logs and omits rejected results.
Changes: Hyperliquid vault pricing
Layer / File(s)
Summary
Vault-currency pricing and result handling src/adaptors/harmonix-finance/index.js
The Hyperliquid branch looks up the vault currency’s address in the asset map and requests its current price through the price API. It calculates USD TVL as v.tvl * tokenPrice and raises errors if the address or price is missing. The adapter logs rejected vault requests and omits them while retaining fulfilled results. The prior ethers-based price-feed lookup was removed.
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: Hyperliquid vault pricing switches from one shared Pyth feed to each vault's own currency. The raw summary confirms this. The code now looks up the vault currency in t…
Linked Issues check
Issue #3273 requires that each Hyperliquid vault's tvl be priced by its own vault_currency, using the address in assets.hyperliquid, and that the hand-rolled ethers provider and Pyth feed be removed. …
Out of Scope Changes check
The whole-PR diff against the merge base 96aa952 touches only src/adaptors/harmonix-finance/index.js. Every hunk is part of the issue #3273 fix: the hyperliquid pricing branch replacement and the remo…
Full details: Title check
Explanation
The title names the main change: Hyperliquid vault pricing switches from one shared Pyth feed to each vault's own currency. The raw summary confirms this. The code now looks up the vault currency in the hyperliquid asset map, fetches its price through the shared price API, and computes TVL as tvl times token price. The title is specific, one sentence, and free of file lists or vague terms. It names the adaptor and the vault-specific pricing. Only the title's wording on the Pyth removal is slightly less prominent, but it is still covered.
Full details: Linked Issues check
Explanation
Issue #3273 requires that each Hyperliquid vault's tvl be priced by its own vault_currency, using the address in assets.hyperliquid, and that the hand-rolled ethers provider and Pyth feed be removed. The diff to src/adaptors/harmonix-finance/index.js at the reviewed head does this. The hyperliquid branch now resolves assets[chainId][v.vault_currency.toLowerCase()] (hype, khype, usdc are all mapped), requests /prices/current/hyperliquid:<address> through utils.getPriceApiUrl, and sets tvlUsd = v.tvl * tokenPrice. The ethers require, the JsonRpcProvider, the contract address 0xe9d69..., and the feed id 0x4279e... are removed. No ethers reference remains in the file. The non-hyperliquid branch is unchanged. The issue requires no automated test additions, and none are required by its stated objectives. The PR's reported test runs are not independently verified here, but no coding requirement depends on them.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base 96aa952 touches only src/adaptors/harmonix-finance/index.js. Every hunk is part of the issue #3273 fix: the hyperliquid pricing branch replacement and the removal of the now-unused ethers import. The two new throws (missing vault_currency address in assets.hyperliquid, missing coins price) are the error handling the PR description explains and do not add unrelated behavior. No unrelated changes were found.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 1286b157-bc09-4409-a860-39b9f1d5770d
Commits
Reviewing files that changed from the base of the PR and between 96aa952 and 6909a3d.
Files selected for processing: 1
src/adaptors/harmonix-finance/index.js
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
A vault whose currency is unmapped, has no coins.llama.fi price, or whose
tvl call fails now drops out on its own; the other vaults still publish.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3273
The
chainId === 'hyperliquid'branch read one Pyth feed and multiplied every vault'stvlby it,whatever the vault held, which is why all three Hyperliquid pools published the same implied price of
$65.2563 and a 167,869 USDC vault came out at $10.95m. This prices
v.tvlby the vault's ownvault_currency, throughassets.hyperliquid, which is what the other chains' branch already does. Thehand-rolled ethers provider and the feed id go with it.
0x1D5D9E73...0x1368ee9d...0xfde5b062...The control is the other repo: DefiLlama-Adapters' TVL for the protocol reads
Hyperliquid L1$4,102,909 and
Arbitrum$436,638 against the $4,052,698 and $425,631 here, both inside the pricetiming, where before the merge the Hyperliquid side disagreed by $11.0m.
testing
npm run test --adapter=harmonix-finance, twice, 41 tests passed both times and the two runs differonly by the price refresh ($167,840.29 then $167,841.97):
The two throws are deliberate: a vault currency with no address in
assets.hyperliquid, or a tokencoins does not price, should stop the pool rather than publish a figure priced off something else.
Summary by CodeRabbit