@@ -14,7 +14,8 @@ pub use errors::{
14
14
UpdatePriceFeedsIfNecessaryError , ParsePriceFeedsError , GetSingleUpdateFeeError ,
15
15
};
16
16
pub use interface :: {
17
- IPyth , IPythDispatcher , IPythDispatcherTrait , DataSource , Price , PriceFeedPublishTime , PriceFeed
17
+ IPyth , IPythDispatcher , IPythDispatcherTrait , DataSource , GetDataSource , Price ,
18
+ PriceFeedPublishTime , PriceFeed
18
19
};
19
20
20
21
#[starknet:: contract]
@@ -34,9 +35,10 @@ mod pyth {
34
35
use core :: starknet :: syscalls :: replace_class_syscall;
35
36
use pyth :: wormhole :: {IWormholeDispatcher , IWormholeDispatcherTrait , VerifiedVM };
36
37
use super :: {
37
- DataSource , UpdatePriceFeedsError , GovernanceActionError , Price , GetPriceUnsafeError ,
38
- IPythDispatcher , IPythDispatcherTrait , PriceFeedPublishTime , GetPriceNoOlderThanError ,
39
- UpdatePriceFeedsIfNecessaryError , PriceFeed , ParsePriceFeedsError , GetSingleUpdateFeeError ,
38
+ DataSource , GetDataSource , UpdatePriceFeedsError , GovernanceActionError , Price ,
39
+ GetPriceUnsafeError , IPythDispatcher , IPythDispatcherTrait , PriceFeedPublishTime ,
40
+ GetPriceNoOlderThanError , UpdatePriceFeedsIfNecessaryError , PriceFeed , ParsePriceFeedsError ,
41
+ GetSingleUpdateFeeError ,
40
42
};
41
43
use super :: governance;
42
44
use super :: governance :: GovernancePayload ;
@@ -547,7 +549,7 @@ mod pyth {
547
549
let wormhole = IWormholeDispatcher { contract_address : self . wormhole_address. read () };
548
550
let claim_vm = wormhole . parse_and_verify_vm (claim_vaa . clone ());
549
551
// Note: no verify_governance_vm() because claim_vaa is signed by the new data source
550
- let instruction = governance :: parse_instruction (claim_vm . payload);
552
+ let instruction = governance :: parse_instruction (claim_vm . payload. clone () );
551
553
if instruction . target_chain_id != 0
552
554
&& instruction . target_chain_id != wormhole . chain_id () {
553
555
panic_with_felt252 (GovernanceActionError :: InvalidGovernanceTarget . into ());
@@ -565,10 +567,7 @@ mod pyth {
565
567
}
566
568
self . governance_data_source_index. write (request_payload . governance_data_source_index);
567
569
let old_data_source = self . governance_data_source. read ();
568
- let new_data_source = DataSource {
569
- emitter_chain_id : claim_vm . emitter_chain_id,
570
- emitter_address : claim_vm . emitter_address,
571
- };
570
+ let new_data_source = claim_vm . data_source ();
572
571
self . governance_data_source. write (new_data_source );
573
572
// Setting the last executed governance to the claimVaa sequence to avoid
574
573
// using older sequences.
@@ -620,10 +619,7 @@ mod pyth {
620
619
let wormhole = IWormholeDispatcher { contract_address : self . wormhole_address. read () };
621
620
let vm = wormhole . parse_and_verify_vm (wormhole_proof );
622
621
623
- let source = DataSource {
624
- emitter_chain_id : vm . emitter_chain_id, emitter_address : vm . emitter_address
625
- };
626
- if ! self . is_valid_data_source. read (source ) {
622
+ if ! self . is_valid_data_source. read (vm . data_source ()) {
627
623
panic_with_felt252 (UpdatePriceFeedsError :: InvalidUpdateDataSource . into ());
628
624
}
629
625
0 commit comments