Skip to content

feat(stylus): added crate for types shared across Wormhole and Pyth #2815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions target_chains/stylus/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions target_chains/stylus/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[workspace]
members = [
"contracts/wormhole",
"contracts/pyth-receiver"
]
"contracts/pyth-receiver",
"contracts/pyth-types"]
resolver = "2"

[workspace.package]
Expand Down
9 changes: 9 additions & 0 deletions target_chains/stylus/contracts/pyth-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 changes: 30 additions & 0 deletions target_chains/stylus/contracts/pyth-types/src/lib.rs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ik this is a draft PR but wondering why we want to extract out the wormhole types here? they aren't needed outside of the wormhole crate right?

Original file line number Diff line number Diff line change
@@ -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>,
}