Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion apps/hermes/server/Cargo.lock

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

2 changes: 1 addition & 1 deletion pythnet/pythnet_sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pythnet-sdk"
version = "2.3.1"
version = "2.4.0"
description = "Pyth Runtime for Solana"
authors = ["Pyth Data Association"]
repository = "https://github.com/pyth-network/pythnet"
Expand Down
25 changes: 24 additions & 1 deletion pythnet/pythnet_sdk/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ impl Arbitrary for PriceFeedMessage {
}
}

/// Message format for sending Twap data via the accumulator program
/// Message format for sending cumulative price data via the accumulator program.
/// These messages are used to calculate TWAPs for a given time window.
/// The calculated TWAPs are stored as TwapPrices in TwapUpdate accounts.
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub struct TwapMessage {
Expand Down Expand Up @@ -175,6 +177,27 @@ impl Arbitrary for TwapMessage {
}
}

/// The time weighted average price & conf for a feed over the window [start_time, end_time].
/// This type is used to persist the calculated TWAP in TwapUpdate accounts on Solana.
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize, BorshSchema)]
#[cfg_attr(feature = "solana-program", derive(AnchorSerialize, AnchorDeserialize))]
#[cfg_attr(
not(feature = "solana-program"),
derive(BorshSerialize, BorshDeserialize)
)]
pub struct TwapPrice {
pub feed_id: FeedId,
pub start_time: i64,
pub end_time: i64,
pub price: i64,
pub conf: u64,
pub exponent: i32,
/// Ratio out of 1_000_000, where a value of 1_000_000 represents
/// all slots were missed and 0 represents no slots were missed.
pub down_slots_ratio: u32,
}

#[repr(C)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PublisherStakeCapsMessage {
Expand Down
Loading
Loading