Skip to content

Commit f21448e

Browse files
committed
Another rename
1 parent e82944d commit f21448e

File tree

4 files changed

+43
-34
lines changed

4 files changed

+43
-34
lines changed

program/rust/src/c_oracle_header.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,46 +57,46 @@ impl PythAccount for PriceAccount {
5757
#[repr(C)]
5858
#[derive(Copy, Clone, Pod, Zeroable)]
5959
pub struct PriceAccount {
60-
pub header: AccountHeader,
60+
pub header: AccountHeader,
6161
/// Type of the price account
62-
pub price_type: u32,
62+
pub price_type: u32,
6363
/// Exponent for the published prices
64-
pub exponent: i32,
64+
pub exponent: i32,
6565
/// Current number of authorized publishers
66-
pub num_: u32,
66+
pub num_: u32,
6767
/// Number of valid quotes for the last aggregation
68-
pub num_qt_: u32,
68+
pub num_qt_: u32,
6969
/// Last slot with a succesful aggregation (status : TRADING)
70-
pub last_slot_: u64,
70+
pub last_slot_: u64,
7171
/// Second to last slot where aggregation was attempted
72-
pub valid_slot_: u64,
72+
pub valid_slot_: u64,
7373
/// Ema for price
74-
pub twap_: PriceEma,
74+
pub twap_: PriceEma,
7575
/// Ema for confidence
76-
pub twac_: PriceEma,
76+
pub twac_: PriceEma,
7777
/// Last time aggregation was attempted
78-
pub timestamp_: i64,
78+
pub timestamp_: i64,
7979
/// Minimum valid publisher quotes for a succesful aggregation
80-
pub min_pub_: u8,
81-
pub unused_1_: i8,
82-
pub unused_2_: i16,
83-
pub unused_3_: i32,
80+
pub min_pub_: u8,
81+
pub unused_1_: i8,
82+
pub unused_2_: i16,
83+
pub unused_3_: i32,
8484
/// Corresponding product account
85-
pub prod_: CPubkey,
85+
pub product_account: CPubkey,
8686
/// Next price account in the list
87-
pub next_: CPubkey,
87+
pub next_price_account: CPubkey,
8888
/// Second to last slot where aggregation was succesful (i.e. status : TRADING)
89-
pub prev_slot_: u64,
89+
pub prev_slot_: u64,
9090
/// Aggregate price at prev_slot_
91-
pub prev_price_: i64,
91+
pub prev_price_: i64,
9292
/// Confidence interval at prev_slot_
93-
pub prev_conf_: u64,
93+
pub prev_conf_: u64,
9494
/// Timestamp of prev_slot_
95-
pub prev_timestamp_: i64,
95+
pub prev_timestamp_: i64,
9696
/// Last attempted aggregate results
97-
pub agg_: PriceInfo,
97+
pub agg_: PriceInfo,
9898
/// Publishers' price components
99-
pub comp_: [PriceComponent; PC_COMP_SIZE as usize],
99+
pub comp_: [PriceComponent; PC_COMP_SIZE as usize],
100100
}
101101

102102
#[repr(C)]

program/rust/src/rust_oracle.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,12 @@ pub fn add_price(
369369
initialize_pyth_account_checked::<PriceAccount>(price_account, cmd_args.header.version)?;
370370
price_data.exponent = cmd_args.exponent;
371371
price_data.price_type = cmd_args.price_type;
372-
pubkey_assign(&mut price_data.prod_, &product_account.key.to_bytes());
373372
pubkey_assign(
374-
&mut price_data.next_,
373+
&mut price_data.product_account,
374+
&product_account.key.to_bytes(),
375+
);
376+
pubkey_assign(
377+
&mut price_data.next_price_account,
375378
bytes_of(&product_data.first_price_account),
376379
);
377380
pubkey_assign(
@@ -416,13 +419,13 @@ pub fn del_price(
416419
)?;
417420

418421
pyth_assert(
419-
pubkey_equal(&price_data.prod_, &product_account.key.to_bytes()),
422+
pubkey_equal(&price_data.product_account, &product_account.key.to_bytes()),
420423
ProgramError::InvalidArgument,
421424
)?;
422425

423426
pubkey_assign(
424427
&mut product_data.first_price_account,
425-
bytes_of(&price_data.next_),
428+
bytes_of(&price_data.next_price_account),
426429
);
427430
}
428431

program/rust/src/tests/test_add_price.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ fn test_add_price() {
8383
assert_eq!(price_data.exponent, 1);
8484
assert_eq!(price_data.price_type, 1);
8585
assert!(pubkey_equal(
86-
&price_data.prod_,
86+
&price_data.product_account,
8787
&product_account.key.to_bytes()
8888
));
89-
assert!(pubkey_is_zero(&price_data.next_));
89+
assert!(pubkey_is_zero(&price_data.next_price_account));
9090
assert!(pubkey_equal(
9191
&product_data.first_price_account,
9292
&price_account.key.to_bytes()
@@ -110,11 +110,11 @@ fn test_add_price() {
110110
assert_eq!(price_data_2.exponent, 1);
111111
assert_eq!(price_data_2.price_type, 1);
112112
assert!(pubkey_equal(
113-
&price_data_2.prod_,
113+
&price_data_2.product_account,
114114
&product_account.key.to_bytes()
115115
));
116116
assert!(pubkey_equal(
117-
&price_data_2.next_,
117+
&price_data_2.next_price_account,
118118
&price_account.key.to_bytes()
119119
));
120120
assert!(pubkey_equal(

program/rust/src/tests/test_init_price.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ fn test_init_price() {
6767
price_data.num_ = 4;
6868
pubkey_assign(&mut price_data.comp_[0].pub_, bytes_of(&publisher));
6969
pubkey_assign(&mut price_data.comp_[3].pub_, bytes_of(&publisher2));
70-
pubkey_assign(&mut price_data.prod_, bytes_of(&product));
71-
pubkey_assign(&mut price_data.next_, bytes_of(&next_price));
70+
pubkey_assign(&mut price_data.product_account, bytes_of(&product));
71+
pubkey_assign(&mut price_data.next_price_account, bytes_of(&next_price));
7272

7373
price_data.last_slot_ = 100;
7474
price_data.valid_slot_ = 100;
@@ -115,8 +115,14 @@ fn test_init_price() {
115115
&price_data.comp_[3].pub_,
116116
bytes_of(&publisher2)
117117
));
118-
assert!(pubkey_equal(&price_data.prod_, bytes_of(&product)));
119-
assert!(pubkey_equal(&price_data.next_, bytes_of(&next_price)));
118+
assert!(pubkey_equal(
119+
&price_data.product_account,
120+
bytes_of(&product)
121+
));
122+
assert!(pubkey_equal(
123+
&price_data.next_price_account,
124+
bytes_of(&next_price)
125+
));
120126

121127
assert_eq!(price_data.last_slot_, 0);
122128
assert_eq!(price_data.valid_slot_, 0);

0 commit comments

Comments
 (0)