Skip to content

fix(hermes/server): support newer asset types + improve logging #2866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/hermes/server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/hermes/server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hermes"
version = "0.10.2-alpha"
version = "0.10.3"
description = "Hermes is an agent that provides Verified Prices from the Pythnet Pyth Oracle."
edition = "2021"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ where
)
.await
.map_err(|e| {
tracing::warn!(
tracing::debug!(
"Error getting price feeds {:?} with update data: {:?}",
price_ids,
e
Expand Down
33 changes: 28 additions & 5 deletions apps/hermes/server/src/api/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,23 +374,28 @@ pub struct PriceFeedMetadata {
#[serde(rename_all = "snake_case")]
pub enum AssetType {
Crypto,
#[serde(rename = "fx")]
FX,
Fx,
Equity,
Metal,
Rates,
CryptoRedemptionRate,
Commodities,
CryptoIndex,
CryptoNav,
}

impl Display for AssetType {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
match self {
AssetType::Crypto => write!(f, "crypto"),
AssetType::FX => write!(f, "fx"),
AssetType::Fx => write!(f, "fx"),
AssetType::Equity => write!(f, "equity"),
AssetType::Metal => write!(f, "metal"),
AssetType::Rates => write!(f, "rates"),
AssetType::CryptoRedemptionRate => write!(f, "crypto_redemption_rate"),
AssetType::Commodities => write!(f, "commodities"),
AssetType::CryptoIndex => write!(f, "crypto_index"),
AssetType::CryptoNav => write!(f, "crypto_nav"),
}
}
}
Expand All @@ -409,8 +414,8 @@ mod tests {
.trim_matches('"')
);
assert_eq!(
AssetType::FX.to_string(),
serde_json::to_string(&AssetType::FX)
AssetType::Fx.to_string(),
serde_json::to_string(&AssetType::Fx)
.unwrap()
.trim_matches('"')
);
Expand Down Expand Up @@ -438,5 +443,23 @@ mod tests {
.unwrap()
.trim_matches('"')
);
assert_eq!(
AssetType::Commodities.to_string(),
serde_json::to_string(&AssetType::Commodities)
.unwrap()
.trim_matches('"')
);
assert_eq!(
AssetType::CryptoIndex.to_string(),
serde_json::to_string(&AssetType::CryptoIndex)
.unwrap()
.trim_matches('"')
);
assert_eq!(
AssetType::CryptoNav.to_string(),
serde_json::to_string(&AssetType::CryptoNav)
.unwrap()
.trim_matches('"')
);
}
}
Loading