Skip to content

Commit b55cf8e

Browse files
committed
feat: update PriceFeedData structure and version to 0.6.0
1 parent d29a68b commit b55cf8e

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lazer/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.

lazer/sdk/rust/protocol/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-protocol"
3-
version = "0.5.1"
3+
version = "0.6.0"
44
edition = "2021"
55
description = "Pyth Lazer SDK - protocol types."
66
license = "Apache-2.0"

lazer/sdk/rust/protocol/src/publisher.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use {
1212
/// from the publisher to the router.
1313
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1414
#[serde(rename_all = "camelCase")]
15-
pub struct PriceFeedData {
15+
pub struct PriceFeedDataV2 {
1616
pub price_feed_id: PriceFeedId,
1717
/// Timestamp of the last update provided by the source of the prices
1818
/// (like an exchange). If unavailable, this value is set to `publisher_timestamp_us`.
@@ -41,7 +41,7 @@ pub struct PriceFeedData {
4141
/// Superseded by `PriceFeedData`.
4242
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4343
#[serde(rename_all = "camelCase")]
44-
pub struct PriceFeedDataV0 {
44+
pub struct PriceFeedDataV1 {
4545
pub price_feed_id: PriceFeedId,
4646
/// Timestamp of the last update provided by the source of the prices
4747
/// (like an exchange). If unavailable, this value is set to `publisher_timestamp_us`.
@@ -62,8 +62,8 @@ pub struct PriceFeedDataV0 {
6262
pub best_ask_price: Option<Price>,
6363
}
6464

65-
impl From<PriceFeedDataV0> for PriceFeedData {
66-
fn from(v0: PriceFeedDataV0) -> Self {
65+
impl From<PriceFeedDataV1> for PriceFeedDataV2 {
66+
fn from(v0: PriceFeedDataV1) -> Self {
6767
Self {
6868
price_feed_id: v0.price_feed_id,
6969
source_timestamp_us: v0.source_timestamp_us,
@@ -103,7 +103,7 @@ fn price_feed_data_serde() {
103103
1, 7, 3, 0, 0, 0, 0, 0, 0, // funding_rate
104104
];
105105

106-
let expected = PriceFeedData {
106+
let expected = PriceFeedDataV2 {
107107
price_feed_id: PriceFeedId(1),
108108
source_timestamp_us: TimestampUs(2),
109109
publisher_timestamp_us: TimestampUs(3),
@@ -113,7 +113,7 @@ fn price_feed_data_serde() {
113113
funding_rate: Some(3 * 256 + 7),
114114
};
115115
assert_eq!(
116-
bincode::deserialize::<PriceFeedData>(&data).unwrap(),
116+
bincode::deserialize::<PriceFeedDataV2>(&data).unwrap(),
117117
expected
118118
);
119119
assert_eq!(bincode::serialize(&expected).unwrap(), data);
@@ -127,7 +127,7 @@ fn price_feed_data_serde() {
127127
0, 0, 0, 0, 0, 0, 0, 0, // best_ask_price
128128
0, // funding_rate
129129
];
130-
let expected2 = PriceFeedData {
130+
let expected2 = PriceFeedDataV2 {
131131
price_feed_id: PriceFeedId(1),
132132
source_timestamp_us: TimestampUs(2),
133133
publisher_timestamp_us: TimestampUs(3),
@@ -137,7 +137,7 @@ fn price_feed_data_serde() {
137137
funding_rate: None,
138138
};
139139
assert_eq!(
140-
bincode::deserialize::<PriceFeedData>(&data2).unwrap(),
140+
bincode::deserialize::<PriceFeedDataV2>(&data2).unwrap(),
141141
expected2
142142
);
143143
assert_eq!(bincode::serialize(&expected2).unwrap(), data2);

0 commit comments

Comments
 (0)