11use {
2- super :: {
3- local:: PriceInfo ,
4- oracle:: PricePublishingMetadata ,
5- transactions:: Transactions ,
6- State ,
7- } ,
2+ super :: { State , local:: PriceInfo , oracle:: PricePublishingMetadata , transactions:: Transactions } ,
83 crate :: agent:: {
94 services:: exporter:: NetworkState ,
105 solana:: network:: Network ,
11- state:: {
12- global:: GlobalStore ,
13- keypairs:: Keypairs ,
14- local:: LocalStore ,
15- } ,
16- } ,
17- anyhow:: {
18- anyhow,
19- bail,
20- Context ,
21- Result ,
6+ state:: { global:: GlobalStore , keypairs:: Keypairs , local:: LocalStore } ,
227 } ,
8+ anyhow:: { Context , Result , anyhow, bail} ,
239 bincode:: Options ,
24- bytemuck:: {
25- bytes_of,
26- cast_slice,
27- } ,
10+ bytemuck:: { bytes_of, cast_slice} ,
2811 chrono:: Utc ,
2912 futures_util:: future:: join_all,
3013 pyth_price_store:: accounts:: buffer:: BufferedPrice ,
3114 pyth_sdk:: Identifier ,
3215 pyth_sdk_solana:: state:: PriceStatus ,
3316 serde:: Serialize ,
34- solana_client:: {
35- nonblocking:: rpc_client:: RpcClient ,
36- rpc_config:: RpcSendTransactionConfig ,
37- } ,
17+ solana_client:: { nonblocking:: rpc_client:: RpcClient , rpc_config:: RpcSendTransactionConfig } ,
3818 solana_pubkey,
3919 solana_sdk:: {
4020 compute_budget:: ComputeBudgetInstruction ,
41- instruction:: {
42- AccountMeta ,
43- Instruction ,
44- } ,
21+ instruction:: { AccountMeta , Instruction } ,
4522 pubkey:: Pubkey ,
4623 signature:: Keypair ,
4724 signer:: Signer ,
4825 sysvar:: clock,
4926 transaction:: Transaction ,
5027 } ,
5128 std:: {
52- collections:: {
53- BTreeMap ,
54- HashMap ,
55- } ,
29+ collections:: { BTreeMap , HashMap } ,
5630 sync:: Arc ,
5731 time:: Duration ,
5832 } ,
59- tokio:: sync:: {
60- watch,
61- RwLock ,
62- } ,
33+ tokio:: sync:: { RwLock , watch} ,
6334 tracing:: instrument,
6435} ;
6536
@@ -69,12 +40,12 @@ const UPDATE_PRICE_NO_FAIL_ON_ERROR: i32 = 13;
6940#[ repr( C ) ]
7041#[ derive( Serialize , PartialEq , Debug , Clone ) ]
7142struct UpdPriceCmd {
72- version : u32 ,
73- cmd : i32 ,
74- status : PriceStatus ,
75- unused_ : u32 ,
76- price : i64 ,
77- conf : u64 ,
43+ version : u32 ,
44+ cmd : i32 ,
45+ status : PriceStatus ,
46+ unused_ : u32 ,
47+ price : i64 ,
48+ conf : u64 ,
7849 pub_slot : u64 ,
7950}
8051
@@ -142,9 +113,9 @@ impl<'a> From<&'a State> for &'a ExporterState {
142113
143114#[ derive( Debug , Clone ) ]
144115pub struct PermissionedUpdate {
145- pub feed_id : pyth_sdk:: Identifier ,
116+ pub feed_id : pyth_sdk:: Identifier ,
146117 pub feed_index : u32 ,
147- pub info : PriceInfo ,
118+ pub info : PriceInfo ,
148119}
149120
150121#[ async_trait:: async_trait]
@@ -693,7 +664,10 @@ where
693664 account
694665 . comp
695666 . iter ( )
696- . find ( |c| c. publisher == solana_pubkey:: Pubkey :: from ( publish_keypair. pubkey ( ) . to_bytes ( ) ) )
667+ . find ( |c| {
668+ c. publisher
669+ == solana_pubkey:: Pubkey :: from ( publish_keypair. pubkey ( ) . to_bytes ( ) )
670+ } )
697671 . map ( |c| c. latest . pub_slot . max ( account. agg . pub_slot ) )
698672 } )
699673 . min ( ) ;
@@ -781,34 +755,34 @@ fn create_instruction_without_accumulator(
781755) -> Result < Instruction > {
782756 Ok ( Instruction {
783757 program_id : pyth_oracle_program_key,
784- accounts : vec ! [
758+ accounts : vec ! [
785759 AccountMeta {
786- pubkey: publish_pubkey,
787- is_signer: true ,
760+ pubkey: publish_pubkey,
761+ is_signer: true ,
788762 is_writable: true ,
789763 } ,
790764 AccountMeta {
791- pubkey: price_id,
792- is_signer: false ,
765+ pubkey: price_id,
766+ is_signer: false ,
793767 is_writable: true ,
794768 } ,
795769 AccountMeta {
796- pubkey: clock:: id( ) ,
797- is_signer: false ,
770+ pubkey: clock:: id( ) ,
771+ is_signer: false ,
798772 is_writable: false ,
799773 } ,
800774 ] ,
801- data : bincode:: DefaultOptions :: new ( )
775+ data : bincode:: DefaultOptions :: new ( )
802776 . with_little_endian ( )
803777 . with_fixint_encoding ( )
804778 . serialize (
805779 & ( UpdPriceCmd {
806- version : PYTH_ORACLE_VERSION ,
807- cmd : UPDATE_PRICE_NO_FAIL_ON_ERROR ,
808- status : price_info. status ,
809- unused_ : 0 ,
810- price : price_info. price ,
811- conf : price_info. conf ,
780+ version : PYTH_ORACLE_VERSION ,
781+ cmd : UPDATE_PRICE_NO_FAIL_ON_ERROR ,
782+ status : price_info. status ,
783+ unused_ : 0 ,
784+ price : price_info. price ,
785+ conf : price_info. conf ,
812786 pub_slot : current_slot,
813787 } ) ,
814788 ) ?,
@@ -822,9 +796,7 @@ fn create_instruction_with_price_store_program(
822796 prices : Vec < PermissionedUpdate > ,
823797) -> Result < Instruction > {
824798 use pyth_price_store:: instruction:: {
825- Instruction as PublishInstruction ,
826- SubmitPricesArgsHeader ,
827- PUBLISHER_CONFIG_SEED ,
799+ Instruction as PublishInstruction , PUBLISHER_CONFIG_SEED , SubmitPricesArgsHeader ,
828800 } ;
829801 let ( publisher_config_key, publisher_config_bump) = Pubkey :: find_program_address (
830802 & [ PUBLISHER_CONFIG_SEED . as_bytes ( ) , & publish_pubkey. to_bytes ( ) ] ,
@@ -853,18 +825,18 @@ fn create_instruction_with_price_store_program(
853825 program_id : pyth_price_store_program_key,
854826 accounts : vec ! [
855827 AccountMeta {
856- pubkey: publish_pubkey,
857- is_signer: true ,
828+ pubkey: publish_pubkey,
829+ is_signer: true ,
858830 is_writable: true ,
859831 } ,
860832 AccountMeta {
861- pubkey: publisher_config_key,
862- is_signer: false ,
833+ pubkey: publisher_config_key,
834+ is_signer: false ,
863835 is_writable: false ,
864836 } ,
865837 AccountMeta {
866- pubkey: publisher_buffer_key,
867- is_signer: false ,
838+ pubkey: publisher_buffer_key,
839+ is_signer: false ,
868840 is_writable: true ,
869841 } ,
870842 ] ,
@@ -902,58 +874,58 @@ fn create_instruction_with_accumulator(
902874
903875 Ok ( Instruction {
904876 program_id : pyth_oracle_program_key,
905- accounts : vec ! [
877+ accounts : vec ! [
906878 AccountMeta {
907- pubkey: publish_pubkey,
908- is_signer: true ,
879+ pubkey: publish_pubkey,
880+ is_signer: true ,
909881 is_writable: true ,
910882 } ,
911883 AccountMeta {
912- pubkey: price_id,
913- is_signer: false ,
884+ pubkey: price_id,
885+ is_signer: false ,
914886 is_writable: true ,
915887 } ,
916888 AccountMeta {
917- pubkey: clock:: id( ) ,
918- is_signer: false ,
889+ pubkey: clock:: id( ) ,
890+ is_signer: false ,
919891 is_writable: false ,
920892 } ,
921893 // accumulator program key
922894 AccountMeta {
923- pubkey: accumulator_program_key,
924- is_signer: false ,
895+ pubkey: accumulator_program_key,
896+ is_signer: false ,
925897 is_writable: false ,
926898 } ,
927899 // whitelist
928900 AccountMeta {
929- pubkey: whitelist_pubkey,
930- is_signer: false ,
901+ pubkey: whitelist_pubkey,
902+ is_signer: false ,
931903 is_writable: false ,
932904 } ,
933905 // oracle_auth_pda
934906 AccountMeta {
935- pubkey: oracle_auth_pda,
936- is_signer: false ,
907+ pubkey: oracle_auth_pda,
908+ is_signer: false ,
937909 is_writable: false ,
938910 } ,
939911 // accumulator_data
940912 AccountMeta {
941- pubkey: accumulator_data_pubkey,
942- is_signer: false ,
913+ pubkey: accumulator_data_pubkey,
914+ is_signer: false ,
943915 is_writable: true ,
944916 } ,
945917 ] ,
946- data : bincode:: DefaultOptions :: new ( )
918+ data : bincode:: DefaultOptions :: new ( )
947919 . with_little_endian ( )
948920 . with_fixint_encoding ( )
949921 . serialize (
950922 & ( UpdPriceCmd {
951- version : PYTH_ORACLE_VERSION ,
952- cmd : UPDATE_PRICE_NO_FAIL_ON_ERROR ,
953- status : price_info. status ,
954- unused_ : 0 ,
955- price : price_info. price ,
956- conf : price_info. conf ,
923+ version : PYTH_ORACLE_VERSION ,
924+ cmd : UPDATE_PRICE_NO_FAIL_ON_ERROR ,
925+ status : price_info. status ,
926+ unused_ : 0 ,
927+ price : price_info. price ,
928+ conf : price_info. conf ,
957929 pub_slot : current_slot,
958930 } ) ,
959931 ) ?,
0 commit comments