Kaynağa Gözat

Lazer: Add inactive symbol state (#2831)

Dani Mehrjerdi 4 ay önce
ebeveyn
işleme
33b3726a2c

+ 16 - 16
Cargo.lock

@@ -5539,8 +5539,8 @@ dependencies = [
  "hyper 1.6.0",
  "hyper-util",
  "protobuf",
- "pyth-lazer-protocol 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "pyth-lazer-publisher-sdk 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pyth-lazer-protocol 0.7.2",
+ "pyth-lazer-publisher-sdk 0.1.5",
  "serde",
  "serde_json",
  "soketto",
@@ -5568,7 +5568,7 @@ dependencies = [
  "futures-util",
  "hex",
  "libsecp256k1 0.7.2",
- "pyth-lazer-protocol 0.7.2",
+ "pyth-lazer-protocol 0.7.3",
  "serde",
  "serde_json",
  "tokio",
@@ -5580,18 +5580,14 @@ dependencies = [
 [[package]]
 name = "pyth-lazer-protocol"
 version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a9bdf4e2ba853a8b437309487542e742c7d094d8db189db194cb538f2be02ecd"
 dependencies = [
- "alloy-primitives 0.8.25",
  "anyhow",
  "base64 0.22.1",
- "bincode 1.3.3",
- "bs58",
  "byteorder",
  "derive_more 1.0.0",
- "ed25519-dalek 2.1.1",
- "hex",
  "itertools 0.13.0",
- "libsecp256k1 0.7.2",
  "protobuf",
  "rust_decimal",
  "serde",
@@ -5600,15 +5596,19 @@ dependencies = [
 
 [[package]]
 name = "pyth-lazer-protocol"
-version = "0.7.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9bdf4e2ba853a8b437309487542e742c7d094d8db189db194cb538f2be02ecd"
+version = "0.7.3"
 dependencies = [
+ "alloy-primitives 0.8.25",
  "anyhow",
  "base64 0.22.1",
+ "bincode 1.3.3",
+ "bs58",
  "byteorder",
  "derive_more 1.0.0",
+ "ed25519-dalek 2.1.1",
+ "hex",
  "itertools 0.13.0",
+ "libsecp256k1 0.7.2",
  "protobuf",
  "rust_decimal",
  "serde",
@@ -5618,6 +5618,8 @@ dependencies = [
 [[package]]
 name = "pyth-lazer-publisher-sdk"
 version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a3e633db28ca38210de8ab3e99d5bd85ad8cae08a08bb0292506340ee9d1c718"
 dependencies = [
  "anyhow",
  "fs-err",
@@ -5631,16 +5633,14 @@ dependencies = [
 
 [[package]]
 name = "pyth-lazer-publisher-sdk"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3e633db28ca38210de8ab3e99d5bd85ad8cae08a08bb0292506340ee9d1c718"
+version = "0.1.6"
 dependencies = [
  "anyhow",
  "fs-err",
  "humantime",
  "protobuf",
  "protobuf-codegen",
- "pyth-lazer-protocol 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pyth-lazer-protocol 0.7.3",
  "serde-value",
  "tracing",
 ]

+ 15 - 1
lazer/contracts/solana/Cargo.lock

@@ -3200,7 +3200,7 @@ dependencies = [
 
 [[package]]
 name = "pyth-lazer-protocol"
-version = "0.7.2"
+version = "0.7.3"
 dependencies = [
  "anyhow",
  "base64 0.22.1",
@@ -3213,6 +3213,20 @@ dependencies = [
  "serde_json",
 ]
 
+[[package]]
+name = "pyth-lazer-publisher-sdk"
+version = "0.1.6"
+dependencies = [
+ "anyhow",
+ "fs-err",
+ "humantime",
+ "protobuf",
+ "protobuf-codegen",
+ "pyth-lazer-protocol",
+ "serde-value",
+ "tracing",
+]
+
 [[package]]
 name = "pyth-lazer-solana-contract"
 version = "0.4.2"

+ 8 - 0
lazer/publisher_sdk/proto/state.proto

@@ -44,6 +44,12 @@ message Publisher {
     optional bool is_active = 4;
 }
 
+enum FeedState {
+    COMING_SOON = 0; // Default value
+    STABLE = 1;
+    INACTIVE = 2;
+}
+
 // Static data for a feed.
 message FeedMetadata {
     // [required] ID of the price feed.
@@ -86,6 +92,8 @@ message FeedMetadata {
     // [optional] Market schedule in Pythnet format.
     // If absent, the default schedule is used (market is always open).
     optional string market_schedule = 15;
+    // [required] Feed state
+    optional FeedState state = 16;
 }
 
 // An item of the state describing a feed.

+ 1 - 0
lazer/publisher_sdk/proto/transaction_envelope.proto

@@ -64,4 +64,5 @@ enum RejectReason {
     PriceOverflow = 2;
     InvalidFeedId = 3;
     MissingFields = 4;
+    InactiveFeedId = 5;
 }

+ 1 - 1
lazer/publisher_sdk/rust/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "pyth-lazer-publisher-sdk"
-version = "0.1.5"
+version = "0.1.6"
 edition = "2021"
 description = "Pyth Lazer Publisher SDK types."
 license = "Apache-2.0"

+ 1 - 1
lazer/sdk/rust/protocol/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "pyth-lazer-protocol"
-version = "0.7.2"
+version = "0.7.3"
 edition = "2021"
 description = "Pyth Lazer SDK - protocol types."
 license = "Apache-2.0"

+ 4 - 2
lazer/sdk/rust/protocol/src/symbol_state.rs

@@ -6,15 +6,17 @@ use {
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
 #[serde(rename_all = "snake_case")]
 pub enum SymbolState {
-    Stable,
     ComingSoon,
+    Stable,
+    Inactive,
 }
 
 impl Display for SymbolState {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         match self {
-            SymbolState::Stable => write!(f, "stable"),
             SymbolState::ComingSoon => write!(f, "coming_soon"),
+            SymbolState::Stable => write!(f, "stable"),
+            SymbolState::Inactive => write!(f, "inactive"),
         }
     }
 }