11use anchor_lang:: prelude:: * ;
22use pyth_lazer_solana_contract:: protocol:: {
3- message:: LeEcdsaMessage ,
4- payload:: { PayloadData , PayloadPropertyValue } ,
5- router:: channel_ids:: FIXED_RATE_200 ,
6- } ;
3+ message:: LeEcdsaMessage ,
4+ payload:: { PayloadData , PayloadPropertyValue } ,
5+ router:: channel_ids:: FIXED_RATE_200 ,
6+ } ;
77
88declare_id ! ( "FpmpVrP57C6ADT8d4dQp9TkM1vmxohZJ5WEQQc9RGLPY" ) ;
99
@@ -28,11 +28,8 @@ pub mod solana_anchor {
2828 system_program : ctx. accounts . system_program . to_account_info ( ) ,
2929 } ;
3030
31- let cpi_ctx = CpiContext :: new (
32- ctx. accounts . pyth_program . clone ( ) ,
33- cpi_accounts,
34- ) ;
35-
31+ let cpi_ctx = CpiContext :: new ( ctx. accounts . pyth_program . clone ( ) , cpi_accounts) ;
32+
3633 pyth_lazer_solana_contract:: cpi:: verify_ecdsa_message ( cpi_ctx, pyth_message. clone ( ) ) ?;
3734
3835 // Deserialize and process the message
@@ -52,7 +49,7 @@ pub mod solana_anchor {
5249pub struct Initialize < ' info > {
5350 #[ account( mut ) ]
5451 pub payer : Signer < ' info > ,
55-
52+
5653 #[ account(
5754 init,
5855 payer = payer,
@@ -61,29 +58,29 @@ pub struct Initialize<'info> {
6158 bump
6259 ) ]
6360 pub state : Account < ' info , State > ,
64-
61+
6562 pub system_program : Program < ' info , System > ,
6663}
6764
6865#[ derive( Accounts ) ]
6966pub struct UpdateEcdsa < ' info > {
7067 #[ account( mut ) ]
7168 pub payer : Signer < ' info > ,
72-
69+
7370 #[ account( mut , seeds = [ b"data" ] , bump) ]
7471 pub state : Account < ' info , State > ,
75-
72+
7673 /// CHECK: This is the Pyth program
7774 #[ account( address = pyth_lazer_solana_contract:: ID ) ]
7875 pub pyth_program : AccountInfo < ' info > ,
79-
76+
8077 #[ account( address = pyth_lazer_solana_contract:: STORAGE_ID ) ]
8178 pub pyth_storage : Account < ' info , pyth_lazer_solana_contract:: Storage > ,
82-
79+
8380 /// CHECK: This is the Pyth treasury account
8481 #[ account( address = pyth_storage. treasury) ]
8582 pub pyth_treasury : AccountInfo < ' info > ,
86-
83+
8784 pub system_program : Program < ' info , System > ,
8885}
8986
@@ -105,7 +102,7 @@ pub enum ErrorCode {
105102 #[ msg( "Invalid payload feed id" ) ]
106103 InvalidPayloadFeedId ,
107104 #[ msg( "Invalid payload property" ) ]
108- InvalidPayloadProperty ,
105+ InvalidPayloadProperty ,
109106 #[ msg( "Invalid payload timestamp" ) ]
110107 InvalidPayloadTimestamp ,
111108}
0 commit comments