File tree Expand file tree Collapse file tree
anchor/programs/immutable-owner
anchor/programs/interest-bearing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use anchor_spl::token_interface::{
99} ;
1010
1111#[ derive( Accounts ) ]
12- pub struct InitializeGroup < ' info > {
12+ pub struct InitializeGroupAccountConstraints < ' info > {
1313 #[ account( mut ) ]
1414 pub payer : Signer < ' info > ,
1515
@@ -29,7 +29,7 @@ pub struct InitializeGroup<'info> {
2929 pub system_program : Program < ' info , System > ,
3030}
3131
32- fn check_mint_data ( accounts : & mut InitializeGroup ) -> Result < ( ) > {
32+ fn check_mint_data ( accounts : & mut InitializeGroupAccountConstraints ) -> Result < ( ) > {
3333 let mint = & accounts. mint_account . to_account_info ( ) ;
3434 let mint_data = mint. data . borrow ( ) ;
3535 let mint_with_extension = StateWithExtensions :: < MintState > :: unpack ( & mint_data) ?;
@@ -40,7 +40,7 @@ fn check_mint_data(accounts: &mut InitializeGroup) -> Result<()> {
4040 Ok ( ( ) )
4141}
4242
43- pub fn handler ( mut context : Context < InitializeGroup > ) -> Result < ( ) > {
43+ pub fn handler ( mut context : Context < InitializeGroupAccountConstraints > ) -> Result < ( ) > {
4444 check_mint_data ( & mut context. accounts ) ?;
4545
4646 // // Token Group and Token Member extensions features not enabled yet on the Token2022 program
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pub mod group {
1010
1111 use super :: * ;
1212
13- pub fn test_initialize_group ( context : Context < InitializeGroup > ) -> Result < ( ) > {
13+ pub fn test_initialize_group ( context : Context < InitializeGroupAccountConstraints > ) -> Result < ( ) > {
1414 instructions:: test_initialize_group:: handler ( context)
1515 }
1616}
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ fn test_initialize_group() {
2727 let instruction = Instruction :: new_with_bytes (
2828 program_id,
2929 & group:: instruction:: TestInitializeGroup { } . data ( ) ,
30- group:: accounts:: InitializeGroup {
30+ group:: accounts:: InitializeGroupAccountConstraints {
3131 payer : payer. pubkey ( ) ,
3232 mint_account,
3333 token_program : TOKEN_EXTENSIONS_PROGRAM_ID ,
Original file line number Diff line number Diff line change @@ -30,13 +30,13 @@ mod quasar_group {
3030 use super :: * ;
3131
3232 #[ instruction( discriminator = 0 ) ]
33- pub fn initialize_group ( ctx : Ctx < InitializeGroup > ) -> Result < ( ) , ProgramError > {
33+ pub fn initialize_group ( ctx : Ctx < InitializeGroupAccountConstraints > ) -> Result < ( ) , ProgramError > {
3434 handle_initialize_group ( & mut ctx. accounts )
3535 }
3636}
3737
3838#[ derive( Accounts ) ]
39- pub struct InitializeGroup {
39+ pub struct InitializeGroupAccountConstraints {
4040 #[ account( mut ) ]
4141 pub payer : Signer ,
4242 #[ account( mut ) ]
@@ -46,7 +46,7 @@ pub struct InitializeGroup {
4646}
4747
4848#[ inline( always) ]
49- fn handle_initialize_group ( accounts : & mut InitializeGroup ) -> Result < ( ) , ProgramError > {
49+ fn handle_initialize_group ( accounts : & mut InitializeGroupAccountConstraints ) -> Result < ( ) , ProgramError > {
5050 // Mint + GroupPointer extension = 234 bytes
5151 // (base mint padded to 165 + account_type byte + GroupPointer TLV [2 type + 2 len + 64 data])
5252 let mint_size: u64 = 234 ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ pub mod immutable_owner {
1717
1818 // There is currently not an anchor constraint to automatically initialize the ImmutableOwner extension
1919 // We can manually create and initialize the token account via CPIs in the instruction handler
20- pub fn initialize ( context : Context < Initialize > ) -> Result < ( ) > {
20+ pub fn initialize ( context : Context < InitializeAccountConstraints > ) -> Result < ( ) > {
2121 // Calculate space required for token and extension data
2222 let token_account_size = ExtensionType :: try_calculate_account_len :: < PodAccount > ( & [
2323 ExtensionType :: ImmutableOwner ,
@@ -63,7 +63,7 @@ pub mod immutable_owner {
6363}
6464
6565#[ derive( Accounts ) ]
66- pub struct Initialize < ' info > {
66+ pub struct InitializeAccountConstraints < ' info > {
6767 #[ account( mut ) ]
6868 pub payer : Signer < ' info > ,
6969
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ fn test_create_token_account_with_immutable_owner() {
6868 let initialize_ix = Instruction :: new_with_bytes (
6969 program_id,
7070 & immutable_owner:: instruction:: Initialize { } . data ( ) ,
71- immutable_owner:: accounts:: Initialize {
71+ immutable_owner:: accounts:: InitializeAccountConstraints {
7272 payer : payer. pubkey ( ) ,
7373 token_account : token_keypair. pubkey ( ) ,
7474 mint_account : mint,
Original file line number Diff line number Diff line change @@ -26,13 +26,13 @@ mod quasar_immutable_owner {
2626 use super :: * ;
2727
2828 #[ instruction( discriminator = 0 ) ]
29- pub fn initialize ( ctx : Ctx < Initialize > ) -> Result < ( ) , ProgramError > {
29+ pub fn initialize ( ctx : Ctx < InitializeAccountConstraints > ) -> Result < ( ) , ProgramError > {
3030 handle_initialize ( & mut ctx. accounts )
3131 }
3232}
3333
3434#[ derive( Accounts ) ]
35- pub struct Initialize {
35+ pub struct InitializeAccountConstraints {
3636 #[ account( mut ) ]
3737 pub payer : Signer ,
3838 #[ account( mut ) ]
@@ -43,7 +43,7 @@ pub struct Initialize {
4343}
4444
4545#[ inline( always) ]
46- fn handle_initialize ( accounts : & mut Initialize ) -> Result < ( ) , ProgramError > {
46+ fn handle_initialize ( accounts : & mut InitializeAccountConstraints ) -> Result < ( ) , ProgramError > {
4747 // 165 (base) + 1 (account type) + 4 (TLV header, ImmutableOwner is zero-size) = 170 bytes
4848 let account_size: u64 = 170 ;
4949 let lamports = Rent :: get ( ) ?. try_minimum_balance ( account_size as usize ) ?;
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use anchor_spl::{
1212use crate :: check_mint_data;
1313
1414#[ derive( Accounts ) ]
15- pub struct Initialize < ' info > {
15+ pub struct InitializeAccountConstraints < ' info > {
1616 #[ account( mut ) ]
1717 pub payer : Signer < ' info > ,
1818 #[ account( mut ) ]
@@ -22,7 +22,7 @@ pub struct Initialize<'info> {
2222 pub system_program : Program < ' info , System > ,
2323}
2424
25- pub fn handler ( context : Context < Initialize > , rate : i16 ) -> Result < ( ) > {
25+ pub fn handler ( context : Context < InitializeAccountConstraints > , rate : i16 ) -> Result < ( ) > {
2626 // Calculate space required for mint and extension data
2727 let mint_size = ExtensionType :: try_calculate_account_len :: < PodMint > ( & [
2828 ExtensionType :: InterestBearingConfig ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use anchor_spl::token_interface::{
66use crate :: check_mint_data;
77
88#[ derive( Accounts ) ]
9- pub struct UpdateRate < ' info > {
9+ pub struct UpdateRateAccountConstraints < ' info > {
1010 #[ account( mut ) ]
1111 pub authority : Signer < ' info > ,
1212 #[ account( mut ) ]
@@ -16,7 +16,7 @@ pub struct UpdateRate<'info> {
1616 pub system_program : Program < ' info , System > ,
1717}
1818
19- pub fn handler ( context : Context < UpdateRate > , rate : i16 ) -> Result < ( ) > {
19+ pub fn handler ( context : Context < UpdateRateAccountConstraints > , rate : i16 ) -> Result < ( ) > {
2020 interest_bearing_mint_update_rate (
2121 CpiContext :: new (
2222 context. accounts . token_program . key ( ) ,
Original file line number Diff line number Diff line change @@ -18,11 +18,11 @@ pub mod interest_bearing {
1818
1919 use super :: * ;
2020
21- pub fn initialize ( context : Context < Initialize > , rate : i16 ) -> Result < ( ) > {
21+ pub fn initialize ( context : Context < InitializeAccountConstraints > , rate : i16 ) -> Result < ( ) > {
2222 instructions:: initialize:: handler ( context, rate)
2323 }
2424
25- pub fn update_rate ( context : Context < UpdateRate > , rate : i16 ) -> Result < ( ) > {
25+ pub fn update_rate ( context : Context < UpdateRateAccountConstraints > , rate : i16 ) -> Result < ( ) > {
2626 instructions:: update_rate:: handler ( context, rate)
2727 }
2828}
You can’t perform that action at this time.
0 commit comments