浏览代码

Merge branch 'pyth-stylus-sdk-crate' into pyth-stylus-update-and-initialize

Ayush Suresh 4 月之前
父节点
当前提交
2fb67fe4d2

+ 7 - 0
target_chains/stylus/Cargo.lock

@@ -3871,6 +3871,13 @@ dependencies = [
  "thiserror 1.0.69",
 ]
 
+[[package]]
+name = "pyth-types"
+version = "0.1.0"
+dependencies = [
+ "stylus-sdk 0.6.0",
+]
+
 [[package]]
 name = "quick-error"
 version = "1.2.3"

+ 2 - 2
target_chains/stylus/Cargo.toml

@@ -1,8 +1,8 @@
 [workspace]
 members = [
     "contracts/wormhole",
-    "contracts/pyth-receiver"
-]
+    "contracts/pyth-receiver",
+    "contracts/pyth-types"]
 resolver = "2"
 
 [workspace.package]

+ 9 - 0
target_chains/stylus/contracts/pyth-types/Cargo.toml

@@ -0,0 +1,9 @@
+[package]
+name = "pyth-types"
+edition.workspace = true
+license.workspace = true
+repository.workspace = true
+version.workspace = true
+
+[dependencies]
+stylus-sdk = { workspace = true, default-features = false }

+ 30 - 0
target_chains/stylus/contracts/pyth-types/src/lib.rs

@@ -0,0 +1,30 @@
+use stylus_sdk::{
+    alloy_primitives::{Address, FixedBytes},
+};
+
+#[derive(Clone, PartialEq, Default)]
+pub struct GuardianSet {
+    pub keys: Vec<Address>,
+    pub expiration_time: u32,
+}
+
+#[derive(Clone)]
+pub struct GuardianSignature {
+    pub guardian_index: u8,
+    pub signature: FixedBytes<65>,
+}
+
+#[derive(Clone)]
+pub struct VerifiedVM {
+    pub version: u8,
+    pub guardian_set_index: u32,
+    pub signatures: Vec<GuardianSignature>,
+    pub timestamp: u32,
+    pub nonce: u32,
+    pub emitter_chain_id: u16,
+    pub emitter_address: FixedBytes<32>,
+    pub sequence: u64,
+    pub consistency_level: u8,
+    pub payload: Vec<u8>,
+    pub hash: FixedBytes<32>,
+}