Update price to get price from pyth api#1176
Merged
Merged
Conversation
michaeldjeffrey
approved these changes
Apr 20, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Switch the
priceservice from reading HNT prices on-chain (via Solana RPC +helium-libPyth accountreads) to pulling them directly from the Pyth Hermes HTTP API. The Hermes URL (including the HNT feed id) is
configurable via the existing
sourcesetting.Multi-token support is dropped — the service now emits HNT prices only. The
solanapath dependency isremoved from the
pricecrate entirely, and unused workspace deps are trimmed.Changes
PriceGeneratornow holds areqwest::Clientand fetches/v2/updates/price/latest?ids[]=<hnt_feed_id>. The parsed response is scaled by10^(HNT_DECIMALS + expo)to preserve the same u64 integer semantics (price × 10^8) that downstream consumers expect. Stale-price
fallback, file caching, metrics, and the 60s poll cadence are unchanged.
price/src/settings.rs):TokenSetting/tokensVec and the JSON-or-struct deserializer helper.default_priceto a top-level optional field (for testing).sourcenow defaults to the Hermes HNT endpoint.price checkCLI (price/src/cli/check.rs): rewrote to fetch Hermes once and print the feed id, rawprice, confidence, exponent, publish time, and the scaled integer the daemon would emit. Takes an optional
--urloverride; otherwise uses thesourcesetting.main.rs: removed the per-token spawn loop; onePriceGeneratoris started.Checkargs reduced to--url.metrics.rs: hardcodedtoken_type = "hnt"; droppedsolana::Token.Cargo.toml:reqwest = { version = "0.12", features = ["json"] }(pinned locally, mirroringhelium_iceberg).solana = { path = "../solana" }.thiserror,futures-util,prost,tracing-subscriber,tokio-util,metrics-exporter-prometheus,rust_decimal_macros.pkg/settings-template.toml: replaced Solana RPC URL with the Hermes URL; removed[cluster]sectionand legacy per-token commented fields.
README.md: updated to describe the Hermes HTTP flow.