Skip to content

Commit 8f97571

Browse files
committed
addressed initial reviews
1 parent 99998e4 commit 8f97571

File tree

1 file changed

+5
-11
lines changed
  • target_chains/stylus/contracts/pyth-receiver/src

1 file changed

+5
-11
lines changed

target_chains/stylus/contracts/pyth-receiver/src/lib.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl PythReceiver {
177177
update_data: Vec<Vec<u8>>,
178178
) -> Result<(), PythReceiverError> {
179179
for data in &update_data {
180-
self.update_price_feeds_internal(data.clone(), Vec::new(), 0, 0, false)?;
180+
self.update_price_feeds_internal(data.clone(), 0, 0, false)?;
181181
}
182182

183183
let total_fee = self.get_update_fee(update_data)?;
@@ -221,16 +221,15 @@ impl PythReceiver {
221221
fn update_price_feeds_internal(
222222
&mut self,
223223
update_data: Vec<u8>,
224-
_price_ids: Vec<[u8; 32]>,
225224
min_publish_time: u64,
226225
max_publish_time: u64,
227-
_unique: bool,
226+
unique: bool,
228227
) -> Result<Vec<([u8; 32], PriceInfoReturn)>, PythReceiverError> {
229228
let price_pairs = self.parse_price_feed_updates_internal(
230229
update_data,
231230
min_publish_time,
232231
max_publish_time,
233-
false, // check_uniqueness
232+
unique,
234233
)?;
235234

236235
for (price_id, price_return) in price_pairs.clone() {
@@ -266,12 +265,8 @@ impl PythReceiver {
266265
}
267266
}
268267
}
269-
Ok(self.get_total_fee(total_num_updates))
270-
}
271-
272-
fn get_total_fee(&self, total_num_updates: u64) -> U256 {
273-
U256::from(total_num_updates).saturating_mul(self.single_update_fee_in_wei.get())
274-
+ self.transaction_fee_in_wei.get()
268+
Ok(U256::from(total_num_updates).saturating_mul(self.single_update_fee_in_wei.get())
269+
+ self.transaction_fee_in_wei.get())
275270
}
276271

277272
pub fn get_twap_update_fee(&self, _update_data: Vec<Vec<u8>>) -> U256 {
@@ -312,7 +307,6 @@ impl PythReceiver {
312307
if store_updates_if_fresh {
313308
all_parsed_price_pairs.extend(self.update_price_feeds_internal(
314309
data.clone(),
315-
price_ids.clone(),
316310
min_allowed_publish_time,
317311
max_allowed_publish_time,
318312
check_uniqueness,

0 commit comments

Comments
 (0)