1
1
use anchor_lang:: prelude:: * ;
2
2
use 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
+ } ;
7
7
8
8
declare_id ! ( "FpmpVrP57C6ADT8d4dQp9TkM1vmxohZJ5WEQQc9RGLPY" ) ;
9
9
@@ -28,11 +28,8 @@ pub mod solana_anchor {
28
28
system_program : ctx. accounts . system_program . to_account_info ( ) ,
29
29
} ;
30
30
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
+
36
33
pyth_lazer_solana_contract:: cpi:: verify_ecdsa_message ( cpi_ctx, pyth_message. clone ( ) ) ?;
37
34
38
35
// Deserialize and process the message
@@ -52,7 +49,7 @@ pub mod solana_anchor {
52
49
pub struct Initialize < ' info > {
53
50
#[ account( mut ) ]
54
51
pub payer : Signer < ' info > ,
55
-
52
+
56
53
#[ account(
57
54
init,
58
55
payer = payer,
@@ -61,29 +58,29 @@ pub struct Initialize<'info> {
61
58
bump
62
59
) ]
63
60
pub state : Account < ' info , State > ,
64
-
61
+
65
62
pub system_program : Program < ' info , System > ,
66
63
}
67
64
68
65
#[ derive( Accounts ) ]
69
66
pub struct UpdateEcdsa < ' info > {
70
67
#[ account( mut ) ]
71
68
pub payer : Signer < ' info > ,
72
-
69
+
73
70
#[ account( mut , seeds = [ b"data" ] , bump) ]
74
71
pub state : Account < ' info , State > ,
75
-
72
+
76
73
/// CHECK: This is the Pyth program
77
74
#[ account( address = pyth_lazer_solana_contract:: ID ) ]
78
75
pub pyth_program : AccountInfo < ' info > ,
79
-
76
+
80
77
#[ account( address = pyth_lazer_solana_contract:: STORAGE_ID ) ]
81
78
pub pyth_storage : Account < ' info , pyth_lazer_solana_contract:: Storage > ,
82
-
79
+
83
80
/// CHECK: This is the Pyth treasury account
84
81
#[ account( address = pyth_storage. treasury) ]
85
82
pub pyth_treasury : AccountInfo < ' info > ,
86
-
83
+
87
84
pub system_program : Program < ' info , System > ,
88
85
}
89
86
@@ -105,7 +102,7 @@ pub enum ErrorCode {
105
102
#[ msg( "Invalid payload feed id" ) ]
106
103
InvalidPayloadFeedId ,
107
104
#[ msg( "Invalid payload property" ) ]
108
- InvalidPayloadProperty ,
105
+ InvalidPayloadProperty ,
109
106
#[ msg( "Invalid payload timestamp" ) ]
110
107
InvalidPayloadTimestamp ,
111
108
}
0 commit comments