Skip to content

Commit 08aa3cc

Browse files
febodeanmlittle
andauthored
p-token: Fix typo (solana-program#23)
Fix typo Co-authored-by: Dean 利迪恩 <[email protected]>
1 parent ba98569 commit 08aa3cc

File tree

6 files changed

+27
-25
lines changed

6 files changed

+27
-25
lines changed

p-token/src/processor/get_account_data_size.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use super::check_account_owner;
1010

1111
#[inline(always)]
1212
pub fn process_get_account_data_size(accounts: &[AccountInfo]) -> ProgramResult {
13-
let [mint_info, _remaning @ ..] = accounts else {
13+
let [mint_info, _remaining @ ..] = accounts else {
1414
return Err(ProgramError::NotEnoughAccountKeys);
1515
};
1616

p-token/src/processor/revoke.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use super::validate_owner;
88

99
#[inline(always)]
1010
pub fn process_revoke(accounts: &[AccountInfo], _instruction_data: &[u8]) -> ProgramResult {
11-
let [source_account_info, owner_info, remaning @ ..] = accounts else {
11+
let [source_account_info, owner_info, remaining @ ..] = accounts else {
1212
return Err(ProgramError::NotEnoughAccountKeys);
1313
};
1414

@@ -21,7 +21,7 @@ pub fn process_revoke(accounts: &[AccountInfo], _instruction_data: &[u8]) -> Pro
2121
return Err(TokenError::AccountFrozen.into());
2222
}
2323

24-
validate_owner(&source_account.owner, owner_info, remaning)?;
24+
validate_owner(&source_account.owner, owner_info, remaining)?;
2525

2626
source_account.clear_delegate();
2727
source_account.set_delegated_amount(0);

p-token/src/processor/set_authority.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn process_set_authority(accounts: &[AccountInfo], instruction_data: &[u8])
2222

2323
// Validates the accounts.
2424

25-
let [account_info, authority_info, remaning @ ..] = accounts else {
25+
let [account_info, authority_info, remaining @ ..] = accounts else {
2626
return Err(ProgramError::NotEnoughAccountKeys);
2727
};
2828

@@ -37,7 +37,7 @@ pub fn process_set_authority(accounts: &[AccountInfo], instruction_data: &[u8])
3737

3838
match authority_type {
3939
AuthorityType::AccountOwner => {
40-
validate_owner(&account.owner, authority_info, remaning)?;
40+
validate_owner(&account.owner, authority_info, remaining)?;
4141

4242
if let Some(authority) = new_authority {
4343
account.owner = *authority;
@@ -54,7 +54,7 @@ pub fn process_set_authority(accounts: &[AccountInfo], instruction_data: &[u8])
5454
}
5555
AuthorityType::CloseAccount => {
5656
let authority = account.close_authority().unwrap_or(&account.owner);
57-
validate_owner(authority, authority_info, remaning)?;
57+
validate_owner(authority, authority_info, remaining)?;
5858

5959
if let Some(authority) = new_authority {
6060
account.set_close_authority(authority);
@@ -77,7 +77,7 @@ pub fn process_set_authority(accounts: &[AccountInfo], instruction_data: &[u8])
7777
// mint_authority.
7878
let mint_authority = mint.mint_authority().ok_or(TokenError::FixedSupply)?;
7979

80-
validate_owner(mint_authority, authority_info, remaning)?;
80+
validate_owner(mint_authority, authority_info, remaining)?;
8181

8282
if let Some(authority) = new_authority {
8383
mint.set_mint_authority(authority);
@@ -92,7 +92,7 @@ pub fn process_set_authority(accounts: &[AccountInfo], instruction_data: &[u8])
9292
.freeze_authority()
9393
.ok_or(TokenError::MintCannotFreeze)?;
9494

95-
validate_owner(freeze_authority, authority_info, remaning)?;
95+
validate_owner(freeze_authority, authority_info, remaining)?;
9696

9797
if let Some(authority) = new_authority {
9898
mint.set_freeze_authority(authority);

p-token/src/processor/shared/approve.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn process_approve(
1717

1818
let (source_account_info, expected_mint_info, delegate_info, owner_info, remaining) =
1919
if let Some(expected_decimals) = expected_decimals {
20-
let [source_account_info, expected_mint_info, delegate_info, owner_info, remaning @ ..] =
20+
let [source_account_info, expected_mint_info, delegate_info, owner_info, remaining @ ..] =
2121
accounts
2222
else {
2323
return Err(ProgramError::NotEnoughAccountKeys);
@@ -28,18 +28,18 @@ pub fn process_approve(
2828
Some((expected_mint_info, expected_decimals)),
2929
delegate_info,
3030
owner_info,
31-
remaning,
31+
remaining,
3232
)
3333
} else {
34-
let [source_account_info, delegate_info, owner_info, remaning @ ..] = accounts else {
34+
let [source_account_info, delegate_info, owner_info, remaining @ ..] = accounts else {
3535
return Err(ProgramError::NotEnoughAccountKeys);
3636
};
3737
(
3838
source_account_info,
3939
None,
4040
delegate_info,
4141
owner_info,
42-
remaning,
42+
remaining,
4343
)
4444
};
4545

p-token/src/processor/shared/initialize_account.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,26 @@ pub fn process_initialize_account(
2424
) -> ProgramResult {
2525
// Accounts expected depend on whether we have the `rent_sysvar` account or not.
2626

27-
let (new_account_info, mint_info, owner, remaning) = if let Some(owner) = owner {
28-
let [new_account_info, mint_info, remaning @ ..] = accounts else {
27+
let (new_account_info, mint_info, owner, remaining) = if let Some(owner) = owner {
28+
let [new_account_info, mint_info, remaining @ ..] = accounts else {
2929
return Err(ProgramError::NotEnoughAccountKeys);
3030
};
31-
(new_account_info, mint_info, owner, remaning)
31+
(new_account_info, mint_info, owner, remaining)
3232
} else {
33-
let [new_account_info, mint_info, owner_info, remaning @ ..] = accounts else {
33+
let [new_account_info, mint_info, owner_info, remaining @ ..] = accounts else {
3434
return Err(ProgramError::NotEnoughAccountKeys);
3535
};
36-
(new_account_info, mint_info, owner_info.key(), remaning)
36+
(new_account_info, mint_info, owner_info.key(), remaining)
3737
};
3838

3939
// Check rent-exempt status of the token account.
4040

4141
let new_account_info_data_len = new_account_info.data_len();
4242

4343
let minimum_balance = if rent_sysvar_account {
44-
let rent_sysvar_info = remaning.first().ok_or(ProgramError::NotEnoughAccountKeys)?;
44+
let rent_sysvar_info = remaining
45+
.first()
46+
.ok_or(ProgramError::NotEnoughAccountKeys)?;
4547
// SAFETY: single immutable borrow to `rent_sysvar_info`; account ID and length are
4648
// checked by `from_account_info_unchecked`.
4749
let rent = unsafe { Rent::from_account_info_unchecked(rent_sysvar_info)? };

p-token/src/processor/shared/transfer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ pub fn process_transfer(
2020
expected_mint_info,
2121
destination_account_info,
2222
authority_info,
23-
remaning,
23+
remaining,
2424
) = if let Some(decimals) = expected_decimals {
25-
let [source_account_info, mint_info, destination_account_info, authority_info, remaning @ ..] =
25+
let [source_account_info, mint_info, destination_account_info, authority_info, remaining @ ..] =
2626
accounts
2727
else {
2828
return Err(ProgramError::NotEnoughAccountKeys);
@@ -32,10 +32,10 @@ pub fn process_transfer(
3232
Some((mint_info, decimals)),
3333
destination_account_info,
3434
authority_info,
35-
remaning,
35+
remaining,
3636
)
3737
} else {
38-
let [source_account_info, destination_account_info, authority_info, remaning @ ..] =
38+
let [source_account_info, destination_account_info, authority_info, remaining @ ..] =
3939
accounts
4040
else {
4141
return Err(ProgramError::NotEnoughAccountKeys);
@@ -45,7 +45,7 @@ pub fn process_transfer(
4545
None,
4646
destination_account_info,
4747
authority_info,
48-
remaning,
48+
remaining,
4949
)
5050
};
5151

@@ -114,7 +114,7 @@ pub fn process_transfer(
114114
// Validates the authority (delegate or owner).
115115

116116
if source_account.delegate() == Some(authority_info.key()) {
117-
validate_owner(authority_info.key(), authority_info, remaning)?;
117+
validate_owner(authority_info.key(), authority_info, remaining)?;
118118

119119
let delegated_amount = source_account
120120
.delegated_amount()
@@ -129,7 +129,7 @@ pub fn process_transfer(
129129
}
130130
}
131131
} else {
132-
validate_owner(&source_account.owner, authority_info, remaning)?;
132+
validate_owner(&source_account.owner, authority_info, remaining)?;
133133
}
134134

135135
if self_transfer || amount == 0 {

0 commit comments

Comments
 (0)