Skip to content

Commit 81f9131

Browse files
committed
fix(apps/pyth-lazer-agent): determine correct update type in /v2/publisher endpoint handler
1 parent 641e1d1 commit 81f9131

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

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/pyth-lazer-agent/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-lazer-agent"
3-
version = "0.5.1"
3+
version = "0.5.2"
44
edition = "2024"
55
description = "Pyth Lazer Agent"
66
license = "Apache-2.0"

apps/pyth-lazer-agent/src/publisher_handle.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,21 @@ async fn try_handle_publisher(
124124
Ok((data, _)) => FeedUpdate {
125125
feed_id: Some(data.price_feed_id.0),
126126
source_timestamp: MessageField::some(data.source_timestamp_us.into()),
127-
update: Some(Update::FundingRateUpdate(FundingRateUpdate {
128-
price: data.price.map(|p| p.mantissa_i64()),
129-
rate: data.funding_rate.map(|r| r.mantissa()),
130-
..FundingRateUpdate::default()
131-
})),
127+
update: if data.funding_rate.is_some() {
128+
Some(Update::FundingRateUpdate(FundingRateUpdate {
129+
price: data.price.map(|p| p.mantissa_i64()),
130+
rate: data.funding_rate.map(|r| r.mantissa()),
131+
funding_rate_interval: MessageField::none(),
132+
special_fields: Default::default(),
133+
}))
134+
} else {
135+
Some(Update::PriceUpdate(PriceUpdate {
136+
price: data.price.map(|p| p.mantissa_i64()),
137+
best_bid_price: data.best_bid_price.map(|p| p.mantissa_i64()),
138+
best_ask_price: data.best_ask_price.map(|p| p.mantissa_i64()),
139+
special_fields: Default::default(),
140+
}))
141+
},
132142
special_fields: Default::default(),
133143
},
134144
Err(err) => {

0 commit comments

Comments
 (0)