diff --git a/Cargo.lock b/Cargo.lock index 844805d8f1..67d36e3c06 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5760,8 +5760,8 @@ dependencies = [ "humantime-serde", "libsecp256k1 0.7.2", "protobuf-json-mapping", - "pyth-lazer-protocol 0.20.2", - "pyth-lazer-publisher-sdk 0.20.1", + "pyth-lazer-protocol 0.21.0", + "pyth-lazer-publisher-sdk 0.21.0", "reqwest 0.12.23", "serde", "serde_json", @@ -5798,7 +5798,7 @@ dependencies = [ [[package]] name = "pyth-lazer-protocol" -version = "0.20.2" +version = "0.21.0" dependencies = [ "alloy-primitives 0.8.25", "anyhow", @@ -5839,13 +5839,13 @@ dependencies = [ [[package]] name = "pyth-lazer-publisher-sdk" -version = "0.20.1" +version = "0.21.0" dependencies = [ "anyhow", "fs-err", "protobuf", "protobuf-codegen", - "pyth-lazer-protocol 0.20.2", + "pyth-lazer-protocol 0.21.0", "serde_json", ] diff --git a/lazer/contracts/solana/programs/pyth-lazer-solana-contract/Cargo.toml b/lazer/contracts/solana/programs/pyth-lazer-solana-contract/Cargo.toml index 007c4d1a1e..f415ff87c6 100644 --- a/lazer/contracts/solana/programs/pyth-lazer-solana-contract/Cargo.toml +++ b/lazer/contracts/solana/programs/pyth-lazer-solana-contract/Cargo.toml @@ -19,7 +19,7 @@ no-log-ix-name = [] idl-build = ["anchor-lang/idl-build"] [dependencies] -pyth-lazer-protocol = { path = "../../../../sdk/rust/protocol", version = "0.20.0" } +pyth-lazer-protocol = { path = "../../../../sdk/rust/protocol", version = "0.21.0" } anchor-lang = "0.31.1" bytemuck = { version = "1.20.0", features = ["derive"] } diff --git a/lazer/publisher_sdk/proto/state.proto b/lazer/publisher_sdk/proto/state.proto index 20b371ec64..faae7a4c39 100644 --- a/lazer/publisher_sdk/proto/state.proto +++ b/lazer/publisher_sdk/proto/state.proto @@ -195,6 +195,10 @@ message FeedAggregateData { // [optional] Confidence interval for the `price` field. Can be absent if no data is available. // Never present for funding rate feeds. optional int64 confidence = 8; + // [required] Exponent applied to all price and rate values for this feed. + // Actual value is `mantissa * 10 ^ exponent`. + // Restricted to int16. + optional int32 exponent = 9; } // An item of the state describing an asset. diff --git a/lazer/publisher_sdk/rust/Cargo.toml b/lazer/publisher_sdk/rust/Cargo.toml index 1928a22bf0..8e6bbf7a8f 100644 --- a/lazer/publisher_sdk/rust/Cargo.toml +++ b/lazer/publisher_sdk/rust/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "pyth-lazer-publisher-sdk" -version = "0.20.1" +version = "0.21.0" edition = "2021" description = "Pyth Lazer Publisher SDK types." license = "Apache-2.0" repository = "https://github.com/pyth-network/pyth-crosschain" [dependencies] -pyth-lazer-protocol = { version = "0.20.1", path = "../../sdk/rust/protocol" } +pyth-lazer-protocol = { version = "0.21.0", path = "../../sdk/rust/protocol" } anyhow = "1.0.98" protobuf = "3.7.2" serde_json = "1.0.140" diff --git a/lazer/sdk/rust/client/Cargo.toml b/lazer/sdk/rust/client/Cargo.toml index 8e23bfe4eb..f39e05599d 100644 --- a/lazer/sdk/rust/client/Cargo.toml +++ b/lazer/sdk/rust/client/Cargo.toml @@ -6,8 +6,8 @@ description = "A Rust client for Pyth Lazer" license = "Apache-2.0" [dependencies] -pyth-lazer-protocol = { path = "../protocol", version = "0.20.1" } -pyth-lazer-publisher-sdk = { path = "../../../publisher_sdk/rust", version = "0.20.1" } +pyth-lazer-protocol = { path = "../protocol", version = "0.21.0" } +pyth-lazer-publisher-sdk = { path = "../../../publisher_sdk/rust", version = "0.21.0" } tokio = { version = "1", features = ["full"] } tokio-stream = "0.1.17" diff --git a/lazer/sdk/rust/protocol/Cargo.toml b/lazer/sdk/rust/protocol/Cargo.toml index 7177938363..dabdece679 100644 --- a/lazer/sdk/rust/protocol/Cargo.toml +++ b/lazer/sdk/rust/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyth-lazer-protocol" -version = "0.20.2" +version = "0.21.0" edition = "2021" description = "Pyth Lazer SDK - protocol types." license = "Apache-2.0" diff --git a/lazer/sdk/rust/protocol/src/api.rs b/lazer/sdk/rust/protocol/src/api.rs index 12f995227c..7dbbc421ed 100644 --- a/lazer/sdk/rust/protocol/src/api.rs +++ b/lazer/sdk/rust/protocol/src/api.rs @@ -434,7 +434,6 @@ pub struct ParsedFeedPayload { impl ParsedFeedPayload { pub fn new( price_feed_id: PriceFeedId, - exponent: Option, data: &AggregatedPriceFeedData, properties: &[PriceFeedProperty], ) -> Self { @@ -465,7 +464,7 @@ impl ParsedFeedPayload { output.publisher_count = Some(data.publisher_count); } PriceFeedProperty::Exponent => { - output.exponent = exponent; + output.exponent = Some(data.exponent); } PriceFeedProperty::Confidence => { output.confidence = data.confidence; diff --git a/lazer/sdk/rust/protocol/src/payload.rs b/lazer/sdk/rust/protocol/src/payload.rs index 3fab9673f7..88898f975b 100644 --- a/lazer/sdk/rust/protocol/src/payload.rs +++ b/lazer/sdk/rust/protocol/src/payload.rs @@ -49,6 +49,7 @@ pub struct AggregatedPriceFeedData { pub best_bid_price: Option, pub best_ask_price: Option, pub publisher_count: u16, + pub exponent: i16, pub confidence: Option, pub funding_rate: Option, pub funding_timestamp: Option, @@ -63,7 +64,7 @@ impl PayloadData { pub fn new( timestamp_us: TimestampUs, channel_id: ChannelId, - feeds: &[(PriceFeedId, i16, AggregatedPriceFeedData)], + feeds: &[(PriceFeedId, AggregatedPriceFeedData)], requested_properties: &[PriceFeedProperty], ) -> Self { Self { @@ -71,7 +72,7 @@ impl PayloadData { channel_id, feeds: feeds .iter() - .map(|(feed_id, exponent, feed)| PayloadFeedData { + .map(|(feed_id, feed)| PayloadFeedData { feed_id: *feed_id, properties: requested_properties .iter() @@ -87,7 +88,7 @@ impl PayloadData { PayloadPropertyValue::PublisherCount(feed.publisher_count) } PriceFeedProperty::Exponent => { - PayloadPropertyValue::Exponent(*exponent) + PayloadPropertyValue::Exponent(feed.exponent) } PriceFeedProperty::Confidence => { PayloadPropertyValue::Confidence(feed.confidence)