@@ -115,27 +115,6 @@ impl Default for PriceType {
115
115
}
116
116
}
117
117
118
- /// Public key of a Solana account
119
- #[ derive(
120
- Copy ,
121
- Clone ,
122
- Debug ,
123
- Default ,
124
- PartialEq ,
125
- Eq ,
126
- Hash ,
127
- Ord ,
128
- PartialOrd ,
129
- BorshSerialize ,
130
- BorshDeserialize ,
131
- serde:: Serialize ,
132
- serde:: Deserialize ,
133
- ) ]
134
- #[ repr( C ) ]
135
- pub struct AccKey {
136
- pub val : [ u8 ; 32 ] ,
137
- }
138
-
139
118
/// Mapping accounts form a linked-list containing the listing of all products on Pyth.
140
119
#[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
141
120
#[ repr( C ) ]
@@ -152,8 +131,8 @@ pub struct MappingAccount {
152
131
pub num : u32 ,
153
132
pub unused : u32 ,
154
133
/// next mapping account (if any)
155
- pub next : AccKey ,
156
- pub products : [ AccKey ; MAP_TABLE_SIZE ] ,
134
+ pub next : Pubkey ,
135
+ pub products : [ Pubkey ; MAP_TABLE_SIZE ] ,
157
136
}
158
137
159
138
#[ cfg( target_endian = "little" ) ]
@@ -179,7 +158,7 @@ pub struct ProductAccount {
179
158
/// price account size
180
159
pub size : u32 ,
181
160
/// first price account in list
182
- pub px_acc : AccKey ,
161
+ pub px_acc : Pubkey ,
183
162
/// key/value pairs of reference attr.
184
163
pub attr : [ u8 ; PROD_ATTR_SIZE ] ,
185
164
}
@@ -247,7 +226,7 @@ pub struct PriceInfo {
247
226
#[ repr( C ) ]
248
227
pub struct PriceComp {
249
228
/// key of contributing publisher
250
- pub publisher : AccKey ,
229
+ pub publisher : Pubkey ,
251
230
/// the price used to compute the current aggregate price
252
231
pub agg : PriceInfo ,
253
232
/// The publisher's latest price. This price will be incorporated into the aggregate price
@@ -317,9 +296,9 @@ pub struct PriceAccount {
317
296
/// space for future derived values
318
297
pub drv4 : u32 ,
319
298
/// product account key
320
- pub prod : AccKey ,
299
+ pub prod : Pubkey ,
321
300
/// next Price account in linked list
322
- pub next : AccKey ,
301
+ pub next : Pubkey ,
323
302
/// valid slot of previous update
324
303
pub prev_slot : u64 ,
325
304
/// aggregate price of previous update with TRADING status
@@ -367,7 +346,7 @@ impl PriceAccount {
367
346
self . expo ,
368
347
self . num ,
369
348
self . num_qt ,
370
- ProductIdentifier :: new ( self . prod . val ) ,
349
+ ProductIdentifier :: new ( self . prod . to_bytes ( ) ) ,
371
350
self . agg . price ,
372
351
self . agg . conf ,
373
352
self . ema_price . val ,
@@ -392,15 +371,6 @@ unsafe impl Zeroable for AccKeyU64 {
392
371
unsafe impl Pod for AccKeyU64 {
393
372
}
394
373
395
- impl AccKey {
396
- pub fn is_valid ( & self ) -> bool {
397
- match load :: < AccKeyU64 > ( & self . val ) {
398
- Ok ( k8) => k8. val [ 0 ] != 0 || k8. val [ 1 ] != 0 || k8. val [ 2 ] != 0 || k8. val [ 3 ] != 0 ,
399
- Err ( _) => false ,
400
- }
401
- }
402
- }
403
-
404
374
fn load < T : Pod > ( data : & [ u8 ] ) -> Result < & T , PodCastError > {
405
375
let size = size_of :: < T > ( ) ;
406
376
if data. len ( ) >= size {
0 commit comments