Skip to content

Commit b5000a6

Browse files
authored
fix(hermes/server): support newer asset types + improve logging (#2866)
* fix(hermes/server): support newer asset types * refactor(hermes/server): change log level of data not found
1 parent 815fc83 commit b5000a6

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

apps/hermes/server/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/hermes/server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hermes"
3-
version = "0.10.2-alpha"
3+
version = "0.10.3"
44
description = "Hermes is an agent that provides Verified Prices from the Pythnet Pyth Oracle."
55
edition = "2021"
66

apps/hermes/server/src/api/rest/v2/timestamp_price_updates.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ where
101101
)
102102
.await
103103
.map_err(|e| {
104-
tracing::warn!(
104+
tracing::debug!(
105105
"Error getting price feeds {:?} with update data: {:?}",
106106
price_ids,
107107
e

apps/hermes/server/src/api/types.rs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,23 +374,28 @@ pub struct PriceFeedMetadata {
374374
#[serde(rename_all = "snake_case")]
375375
pub enum AssetType {
376376
Crypto,
377-
#[serde(rename = "fx")]
378-
FX,
377+
Fx,
379378
Equity,
380379
Metal,
381380
Rates,
382381
CryptoRedemptionRate,
382+
Commodities,
383+
CryptoIndex,
384+
CryptoNav,
383385
}
384386

385387
impl Display for AssetType {
386388
fn fmt(&self, f: &mut Formatter) -> FmtResult {
387389
match self {
388390
AssetType::Crypto => write!(f, "crypto"),
389-
AssetType::FX => write!(f, "fx"),
391+
AssetType::Fx => write!(f, "fx"),
390392
AssetType::Equity => write!(f, "equity"),
391393
AssetType::Metal => write!(f, "metal"),
392394
AssetType::Rates => write!(f, "rates"),
393395
AssetType::CryptoRedemptionRate => write!(f, "crypto_redemption_rate"),
396+
AssetType::Commodities => write!(f, "commodities"),
397+
AssetType::CryptoIndex => write!(f, "crypto_index"),
398+
AssetType::CryptoNav => write!(f, "crypto_nav"),
394399
}
395400
}
396401
}
@@ -409,8 +414,8 @@ mod tests {
409414
.trim_matches('"')
410415
);
411416
assert_eq!(
412-
AssetType::FX.to_string(),
413-
serde_json::to_string(&AssetType::FX)
417+
AssetType::Fx.to_string(),
418+
serde_json::to_string(&AssetType::Fx)
414419
.unwrap()
415420
.trim_matches('"')
416421
);
@@ -438,5 +443,23 @@ mod tests {
438443
.unwrap()
439444
.trim_matches('"')
440445
);
446+
assert_eq!(
447+
AssetType::Commodities.to_string(),
448+
serde_json::to_string(&AssetType::Commodities)
449+
.unwrap()
450+
.trim_matches('"')
451+
);
452+
assert_eq!(
453+
AssetType::CryptoIndex.to_string(),
454+
serde_json::to_string(&AssetType::CryptoIndex)
455+
.unwrap()
456+
.trim_matches('"')
457+
);
458+
assert_eq!(
459+
AssetType::CryptoNav.to_string(),
460+
serde_json::to_string(&AssetType::CryptoNav)
461+
.unwrap()
462+
.trim_matches('"')
463+
);
441464
}
442465
}

0 commit comments

Comments
 (0)