|
1 | | -#[cfg(feature = "pythnet")] |
2 | 1 | pub use price_pythnet::*; |
3 | | -#[cfg(not(feature = "pythnet"))] |
4 | | -pub use price_solana::*; |
5 | 2 | use { |
6 | 3 | super::{ |
7 | 4 | AccountHeader, |
|
21 | 18 | }; |
22 | 19 |
|
23 | 20 | /// Pythnet-specific PriceAccount implementation |
24 | | -#[cfg(feature = "pythnet")] |
25 | 21 | mod price_pythnet { |
26 | 22 | pub type PriceAccount = PriceAccountPythnet; |
27 | 23 |
|
@@ -191,79 +187,6 @@ mod price_pythnet { |
191 | 187 | } |
192 | 188 | } |
193 | 189 |
|
194 | | -/// Solana-specific PriceAccount implementation |
195 | | -#[cfg(not(feature = "pythnet"))] |
196 | | -mod price_solana { |
197 | | - pub type PriceAccount = PriceAccountSolana; |
198 | | - |
199 | | - use { |
200 | | - super::*, |
201 | | - crate::c_oracle_header::PC_NUM_COMP_SOLANA, |
202 | | - }; |
203 | | - |
204 | | - /// Legacy Solana-only price account format. This price account |
205 | | - /// schema is maintained for compatibility reasons. |
206 | | - /// |
207 | | - /// The main source of incompatibility on mainnet/devnet is the |
208 | | - /// possibility of strict account size checks which could break |
209 | | - /// existing users if they encountered a longer struct like |
210 | | - /// PriceAccountPythnet (see mod price_pythnet for details) |
211 | | - #[repr(C)] |
212 | | - #[derive(Copy, Clone, Pod, Zeroable)] |
213 | | - pub struct PriceAccountSolana { |
214 | | - pub header: AccountHeader, |
215 | | - /// Type of the price account |
216 | | - pub price_type: u32, |
217 | | - /// Exponent for the published prices |
218 | | - pub exponent: i32, |
219 | | - /// Current number of authorized publishers |
220 | | - pub num_: u32, |
221 | | - /// Number of valid quotes for the last aggregation |
222 | | - pub num_qt_: u32, |
223 | | - /// Last slot with a succesful aggregation (status : TRADING) |
224 | | - pub last_slot_: u64, |
225 | | - /// Second to last slot where aggregation was attempted |
226 | | - pub valid_slot_: u64, |
227 | | - /// Ema for price |
228 | | - pub twap_: PriceEma, |
229 | | - /// Ema for confidence |
230 | | - pub twac_: PriceEma, |
231 | | - /// Last time aggregation was attempted |
232 | | - pub timestamp_: i64, |
233 | | - /// Minimum valid publisher quotes for a succesful aggregation |
234 | | - pub min_pub_: u8, |
235 | | - /// Whether the current aggregate price has been sent as a message to the message buffer. |
236 | | - /// 0 = false, 1 = true. (this is a u8 to make the Pod trait happy) |
237 | | - pub message_sent_: u8, |
238 | | - /// Configurable max latency in slots between send and receive |
239 | | - pub max_latency_: u8, |
240 | | - /// Unused placeholder for alignment |
241 | | - pub unused_2_: i8, |
242 | | - pub unused_3_: i32, |
243 | | - /// Corresponding product account |
244 | | - pub product_account: Pubkey, |
245 | | - /// Next price account in the list |
246 | | - pub next_price_account: Pubkey, |
247 | | - /// Second to last slot where aggregation was succesful (i.e. status : TRADING) |
248 | | - pub prev_slot_: u64, |
249 | | - /// Aggregate price at prev_slot_ |
250 | | - pub prev_price_: i64, |
251 | | - /// Confidence interval at prev_slot_ |
252 | | - pub prev_conf_: u64, |
253 | | - /// Timestamp of prev_slot_ |
254 | | - pub prev_timestamp_: i64, |
255 | | - /// Last attempted aggregate results |
256 | | - pub agg_: PriceInfo, |
257 | | - /// Publishers' price components |
258 | | - pub comp_: [PriceComponent; PC_NUM_COMP_SOLANA as usize], |
259 | | - } |
260 | | - |
261 | | - impl PythAccount for PriceAccountSolana { |
262 | | - const ACCOUNT_TYPE: u32 = PC_ACCTYPE_PRICE; |
263 | | - const INITIAL_SIZE: u32 = size_of::<PriceAccountSolana>() as u32; |
264 | | - } |
265 | | -} |
266 | | - |
267 | 190 | #[repr(C)] |
268 | 191 | #[derive(Copy, Clone, Pod, Zeroable)] |
269 | 192 | pub struct PriceComponent { |
|
0 commit comments