@@ -38,14 +38,15 @@ impl TrustedSignerInfo {
3838 const SERIALIZED_LEN : usize = PUBKEY_BYTES + size_of :: < i64 > ( ) ;
3939}
4040
41+ /// TODO: remove this legacy storage type
4142#[ account]
42- pub struct StorageV1 {
43+ pub struct Storage {
4344 pub top_authority : Pubkey ,
4445 pub num_trusted_signers : u8 ,
4546 pub trusted_signers : [ TrustedSignerInfo ; MAX_NUM_TRUSTED_SIGNERS ] ,
4647}
4748
48- impl StorageV1 {
49+ impl Storage {
4950 const SERIALIZED_LEN : usize = PUBKEY_BYTES
5051 + size_of :: < u8 > ( )
5152 + TrustedSignerInfo :: SERIALIZED_LEN * MAX_NUM_TRUSTED_SIGNERS ;
@@ -84,7 +85,8 @@ pub const STORAGE_SEED: &[u8] = b"storage";
8485pub mod pyth_lazer_solana_contract {
8586 use super :: * ;
8687
87- pub fn initialize_v1 ( ctx : Context < InitializeV1 > , top_authority : Pubkey ) -> Result < ( ) > {
88+ /// TODO: remove this legacy instruction
89+ pub fn initialize ( ctx : Context < Initialize > , top_authority : Pubkey ) -> Result < ( ) > {
8890 ctx. accounts . storage . top_authority = top_authority;
8991 Ok ( ( ) )
9092 }
@@ -101,7 +103,7 @@ pub mod pyth_lazer_solana_contract {
101103 }
102104
103105 pub fn migrate_to_storage_v2 ( ctx : Context < MigrateToStorageV2 > , treasury : Pubkey ) -> Result < ( ) > {
104- let old_storage = StorageV1 :: try_deserialize ( & mut & * * ctx. accounts . storage . data . borrow ( ) ) ?;
106+ let old_storage = Storage :: try_deserialize ( & mut & * * ctx. accounts . storage . data . borrow ( ) ) ?;
105107 if old_storage. top_authority != ctx. accounts . top_authority . key ( ) {
106108 return Err ( ProgramError :: MissingRequiredSignature . into ( ) ) ;
107109 }
@@ -220,17 +222,17 @@ pub mod pyth_lazer_solana_contract {
220222}
221223
222224#[ derive( Accounts ) ]
223- pub struct InitializeV1 < ' info > {
225+ pub struct Initialize < ' info > {
224226 #[ account( mut ) ]
225227 pub payer : Signer < ' info > ,
226228 #[ account(
227229 init,
228230 payer = payer,
229- space = 8 + StorageV1 :: SERIALIZED_LEN ,
231+ space = 8 + Storage :: SERIALIZED_LEN ,
230232 seeds = [ STORAGE_SEED ] ,
231233 bump,
232234 ) ]
233- pub storage : Account < ' info , StorageV1 > ,
235+ pub storage : Account < ' info , Storage > ,
234236 pub system_program : Program < ' info , System > ,
235237}
236238
0 commit comments