@@ -19,7 +19,9 @@ use mock_instant::global::MockClock;
19
19
use alloc:: vec:: Vec ;
20
20
use stylus_sdk:: {
21
21
alloy_primitives:: { Address , FixedBytes , I32 , I64 , U16 , U256 , U32 , U64 } ,
22
+ alloy_sol_types:: sol,
22
23
call:: Call ,
24
+ evm,
23
25
prelude:: * ,
24
26
storage:: {
25
27
StorageAddress , StorageBool , StorageFixedBytes , StorageMap , StorageU16 , StorageU256 ,
@@ -44,6 +46,14 @@ use pythnet_sdk::{
44
46
use structs:: { DataSource , DataSourceStorage , PriceFeedReturn , PriceFeedStorage , PriceReturn } ;
45
47
use wormhole_vaas:: { Readable , Vaa , Writeable } ;
46
48
49
+ sol ! {
50
+ event FeeSet ( uint256 indexed old_fee, uint256 indexed new_fee) ;
51
+ event TransactionFeeSet ( uint256 indexed old_fee, uint256 indexed new_fee) ;
52
+ event FeeWithdrawn ( address indexed target_address, uint256 fee_amount) ;
53
+ event ValidPeriodSet ( uint256 indexed old_valid_period, uint256 indexed new_valid_period) ;
54
+ event DataSourcesSet ( bytes32[ ] old_data_sources, bytes32[ ] new_data_sources) ;
55
+ }
56
+
47
57
sol_interface ! {
48
58
interface IWormholeContract {
49
59
function initialize( address[ ] memory initial_guardians, uint32 initial_guardian_set_index, uint16 chain_id, uint16 governance_chain_id, address governance_contract) external;
@@ -595,19 +605,25 @@ impl PythReceiver {
595
605
596
606
fn set_fee ( & mut self , value : u64 , expo : u64 ) {
597
607
let new_fee = U256 :: from ( value) * U256 :: from ( 10 ) . pow ( U256 :: from ( expo) ) ;
598
- let _old_fee = self . single_update_fee_in_wei . get ( ) ;
608
+ let old_fee = self . single_update_fee_in_wei . get ( ) ;
599
609
600
610
self . single_update_fee_in_wei . set ( new_fee) ;
601
611
602
- // TODO: Emit FeeSet event with old_fee and new_fee
612
+ evm:: log ( FeeSet {
613
+ old_fee,
614
+ new_fee,
615
+ } ) ;
603
616
}
604
617
605
618
fn set_valid_period ( & mut self , valid_time_period_seconds : u64 ) {
606
- let _old_valid_period = self . valid_time_period_seconds . get ( ) ;
607
- self . valid_time_period_seconds . set ( U256 :: from ( valid_time_period_seconds) ) ;
619
+ let old_valid_period = self . valid_time_period_seconds . get ( ) ;
620
+ let new_valid_period = U256 :: from ( valid_time_period_seconds) ;
621
+ self . valid_time_period_seconds . set ( new_valid_period) ;
608
622
609
- // TODO: Emit ValidPeriodSet event with old_valid_period and new_valid_period
610
- // emit ValidPeriodSet(old_valid_period, valid_time_period_seconds);
623
+ evm:: log ( ValidPeriodSet {
624
+ old_valid_period,
625
+ new_valid_period,
626
+ } ) ;
611
627
}
612
628
613
629
fn set_wormhole_address (
@@ -717,11 +733,14 @@ impl PythReceiver {
717
733
718
734
fn set_transaction_fee ( & mut self , value : u64 , expo : u64 ) {
719
735
let new_fee = U256 :: from ( value) * U256 :: from ( 10 ) . pow ( U256 :: from ( expo) ) ;
720
- let _old_fee = self . transaction_fee_in_wei . get ( ) ;
736
+ let old_fee = self . transaction_fee_in_wei . get ( ) ;
721
737
722
738
self . transaction_fee_in_wei . set ( new_fee) ;
723
739
724
- // TODO: Emit TransactionFeeSet event with old_fee and new_fee
740
+ evm:: log ( TransactionFeeSet {
741
+ old_fee,
742
+ new_fee,
743
+ } ) ;
725
744
}
726
745
727
746
fn withdraw_fee ( & mut self , value : u64 , expo : u64 , target_address : Address ) -> Result < ( ) , PythReceiverError > {
@@ -736,7 +755,10 @@ impl PythReceiver {
736
755
self . vm ( ) . transfer_eth ( target_address, fee_to_withdraw)
737
756
. map_err ( |_| PythReceiverError :: InsufficientFee ) ?;
738
757
739
- // TODO: Emit FeeWithdrawn event with target_address and fee_to_withdraw
758
+ evm:: log ( FeeWithdrawn {
759
+ target_address,
760
+ fee_amount : fee_to_withdraw,
761
+ } ) ;
740
762
741
763
Ok ( ( ) )
742
764
}
0 commit comments