@@ -272,7 +272,7 @@ impl PythCore for Contract {
272
272
273
273
#[storage(read, write), payable]
274
274
fn update_price_feeds (update_data : Vec <Bytes >) {
275
-
275
+ update_price_feeds ( update_data )
276
276
}
277
277
278
278
#[storage(read, write), payable]
@@ -293,6 +293,7 @@ impl PythCore for Contract {
293
293
if latest_publish_time (price_feed_ids . get (i ). unwrap ()) < publish_times . get (i ). unwrap ()
294
294
{
295
295
update_price_feeds (update_data );
296
+ return ;
296
297
}
297
298
298
299
i += 1 ;
@@ -373,25 +374,23 @@ fn update_fee(update_data: Vec<Bytes>) -> u64 {
373
374
total_fee (total_number_of_updates , storage . single_update_fee)
374
375
}
375
376
376
- #[storage(read, write)]
377
+ #[storage(read, write), payable ]
377
378
fn update_price_feeds (update_data : Vec <Bytes >) {
378
379
require (
379
380
msg_asset_id () == AssetId :: base (),
380
381
PythError :: FeesCanOnlyBePaidInTheBaseAsset ,
381
382
);
382
383
383
- let required_fee = update_fee (update_data );
384
- require (msg_amount () >= required_fee , PythError :: InsufficientFee );
385
-
386
384
let mut total_number_of_updates = 0 ;
387
385
386
+ // let mut updated_price_feeds: Vec<PriceFeedId> = Vec::new(); // TODO: requires append for Vec
388
387
let mut i = 0 ;
389
388
while i < update_data . len () {
390
389
let data = update_data . get (i ). unwrap ();
391
390
392
391
match UpdateType :: determine_type (data ) {
393
392
UpdateType :: Accumulator (accumulator_update ) => {
394
- let (number_of_updates , updated_ids ) = accumulator_update . update_price_feeds (
393
+ let (number_of_updates , _updated_ids ) = accumulator_update . update_price_feeds (
395
394
current_guardian_set_index (),
396
395
storage
397
396
. wormhole_guardian_sets,
@@ -400,11 +399,11 @@ fn update_price_feeds(update_data: Vec<Bytes>) {
400
399
storage
401
400
. is_valid_data_source,
402
401
);
402
+ // updated_price_feeds.append(updated_ids); // TODO: requires append for Vec
403
403
total_number_of_updates += number_of_updates ;
404
- log (UpdatedPriceFeedsEvent { updated_price_feeds : updated_ids });
405
404
},
406
405
UpdateType :: BatchAttestation (batch_attestation_update ) => {
407
- let updated_ids = batch_attestation_update . update_price_feeds (
406
+ let _updated_ids = batch_attestation_update . update_price_feeds (
408
407
current_guardian_set_index (),
409
408
storage
410
409
. wormhole_guardian_sets,
@@ -413,16 +412,20 @@ fn update_price_feeds(update_data: Vec<Bytes>) {
413
412
storage
414
413
. is_valid_data_source,
415
414
);
415
+ // updated_price_feeds.append(updated_ids); // TODO: requires append for Vec
416
416
total_number_of_updates += 1 ;
417
- log (UpdatedPriceFeedsEvent { updated_price_feeds : updated_ids });
418
417
},
419
418
}
420
419
421
420
i += 1 ;
422
421
}
423
422
424
- let fee = total_fee (total_number_of_updates , storage . single_update_fee);
425
- require (msg_amount () >= fee , PythError :: InsufficientFee );
423
+ let required_fee = total_fee (total_number_of_updates , storage . single_update_fee);
424
+ require (msg_amount () >= required_fee , PythError :: InsufficientFee );
425
+
426
+ // log(UpdatedPriceFeedsEvent { // TODO: requires append for Vec
427
+ // updated_price_feeds,
428
+ // })
426
429
}
427
430
428
431
#[storage(read)]
@@ -931,4 +934,4 @@ fn verify_governance_vm(encoded_vm: Bytes) -> WormholeVM {
931
934
932
935
set_last_executed_governance_sequence (vm . sequence);
933
936
vm
934
- }
937
+ }
0 commit comments