@@ -51,10 +51,7 @@ pub fn process_create_associated_token_account(
5151 let spl_token_program_info = next_account_info ( account_info_iter) ?;
5252 let spl_token_program_id = spl_token_program_info. key ;
5353
54- // TODO: Remove after ATA 1.0.4 and Token >3.2.0 are released and just use Rent::get()
55- let ( rent_sysvar_info, rent) = next_account_info ( account_info_iter)
56- . map ( |info| ( Some ( info) , Rent :: from_account_info ( info) . unwrap ( ) ) )
57- . unwrap_or ( ( None , Rent :: get ( ) . unwrap ( ) ) ) ;
54+ let rent = Rent :: get ( ) ?;
5855
5956 let ( associated_token_address, bump_seed) = get_associated_token_address_and_bump_seed_internal (
6057 wallet_account_info. key ,
@@ -85,38 +82,18 @@ pub fn process_create_associated_token_account(
8582 ) ?;
8683
8784 msg ! ( "Initialize the associated token account" ) ;
88-
89- if let Some ( rent_sysvar_info) = rent_sysvar_info {
90- invoke (
91- & spl_token:: instruction:: initialize_account (
92- spl_token_program_id,
93- associated_token_account_info. key ,
94- spl_token_mint_info. key ,
95- wallet_account_info. key ,
96- ) ?,
97- & [
98- associated_token_account_info. clone ( ) ,
99- spl_token_mint_info. clone ( ) ,
100- wallet_account_info. clone ( ) ,
101- rent_sysvar_info. clone ( ) ,
102- spl_token_program_info. clone ( ) ,
103- ] ,
104- )
105- } else {
106- // Use InitializeAccount3 when Rent account is not provided
107- invoke (
108- & spl_token:: instruction:: initialize_account3 (
109- spl_token_program_id,
110- associated_token_account_info. key ,
111- spl_token_mint_info. key ,
112- wallet_account_info. key ,
113- ) ?,
114- & [
115- associated_token_account_info. clone ( ) ,
116- spl_token_mint_info. clone ( ) ,
117- wallet_account_info. clone ( ) ,
118- spl_token_program_info. clone ( ) ,
119- ] ,
120- )
121- }
85+ invoke (
86+ & spl_token:: instruction:: initialize_account3 (
87+ spl_token_program_id,
88+ associated_token_account_info. key ,
89+ spl_token_mint_info. key ,
90+ wallet_account_info. key ,
91+ ) ?,
92+ & [
93+ associated_token_account_info. clone ( ) ,
94+ spl_token_mint_info. clone ( ) ,
95+ wallet_account_info. clone ( ) ,
96+ spl_token_program_info. clone ( ) ,
97+ ] ,
98+ )
12299}
0 commit comments