Skip to content

Commit

Permalink
Token nits (solana-labs#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
garious authored Aug 28, 2020
1 parent 81ac32e commit 6761f44
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/src/token.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ called from other programs that interact with the Token Program's interface.

Accounts containing wrapped SOL are associated with a specific Mint called the
"Native Mint" using the public key
`So11111111111111111111111111111111111111111`.
`So11111111111111111111111111111111111111112`.

These accounts have a few unique behaviors

Expand Down
2 changes: 1 addition & 1 deletion token/program/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub enum TokenError {
#[error("Fixed supply")]
FixedSupply,
/// The account cannot be initialized because it is already being used.
#[error("AlreadyInUse")]
#[error("Already in use")]
AlreadyInUse,
/// Invalid number of provided signers.
#[error("Invalid number of provided signers")]
Expand Down
28 changes: 14 additions & 14 deletions token/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ pub fn transfer(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down Expand Up @@ -698,7 +698,7 @@ pub fn approve(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand All @@ -718,13 +718,13 @@ pub fn revoke(
let data = TokenInstruction::Revoke.pack();

let mut accounts = Vec::with_capacity(2 + signer_pubkeys.len());
accounts.push(AccountMeta::new_readonly(*source_pubkey, false));
accounts.push(AccountMeta::new(*source_pubkey, false));
accounts.push(AccountMeta::new_readonly(
*owner_pubkey,
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down Expand Up @@ -757,7 +757,7 @@ pub fn set_authority(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down Expand Up @@ -786,7 +786,7 @@ pub fn mint_to(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down Expand Up @@ -815,7 +815,7 @@ pub fn burn(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down Expand Up @@ -843,7 +843,7 @@ pub fn close_account(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down Expand Up @@ -871,7 +871,7 @@ pub fn freeze_account(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down Expand Up @@ -899,7 +899,7 @@ pub fn thaw_account(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down Expand Up @@ -932,7 +932,7 @@ pub fn transfer2(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down Expand Up @@ -965,7 +965,7 @@ pub fn approve2(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down Expand Up @@ -995,7 +995,7 @@ pub fn mint_to2(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down Expand Up @@ -1025,7 +1025,7 @@ pub fn burn2(
signer_pubkeys.is_empty(),
));
for signer_pubkey in signer_pubkeys.iter() {
accounts.push(AccountMeta::new(**signer_pubkey, true));
accounts.push(AccountMeta::new_readonly(**signer_pubkey, true));
}

Ok(Instruction {
Expand Down

0 comments on commit 6761f44

Please sign in to comment.