Ensure that read only accounts in token-swap instructions are set correctly (#648)

This commit is contained in:
Yutaro Mori 2020-10-19 18:22:39 +09:00 committed by GitHub
parent 2278c164f3
commit 641c27810c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 13 deletions

View File

@ -224,12 +224,12 @@ pub fn initialize(
let accounts = vec![
AccountMeta::new(*swap_pubkey, true),
AccountMeta::new(*authority_pubkey, false),
AccountMeta::new(*token_a_pubkey, false),
AccountMeta::new(*token_b_pubkey, false),
AccountMeta::new_readonly(*authority_pubkey, false),
AccountMeta::new_readonly(*token_a_pubkey, false),
AccountMeta::new_readonly(*token_b_pubkey, false),
AccountMeta::new(*pool_pubkey, false),
AccountMeta::new(*destination_pubkey, false),
AccountMeta::new(*token_program_id, false),
AccountMeta::new_readonly(*token_program_id, false),
];
Ok(Instruction {
@ -263,15 +263,15 @@ pub fn deposit(
.pack();
let accounts = vec![
AccountMeta::new(*swap_pubkey, false),
AccountMeta::new(*authority_pubkey, false),
AccountMeta::new_readonly(*swap_pubkey, false),
AccountMeta::new_readonly(*authority_pubkey, false),
AccountMeta::new(*deposit_token_a_pubkey, false),
AccountMeta::new(*deposit_token_b_pubkey, false),
AccountMeta::new(*swap_token_a_pubkey, false),
AccountMeta::new(*swap_token_b_pubkey, false),
AccountMeta::new(*pool_mint_pubkey, false),
AccountMeta::new(*destination_pubkey, false),
AccountMeta::new(*token_program_id, false),
AccountMeta::new_readonly(*token_program_id, false),
];
Ok(Instruction {
@ -305,15 +305,15 @@ pub fn withdraw(
.pack();
let accounts = vec![
AccountMeta::new(*swap_pubkey, false),
AccountMeta::new(*authority_pubkey, false),
AccountMeta::new_readonly(*swap_pubkey, false),
AccountMeta::new_readonly(*authority_pubkey, false),
AccountMeta::new(*pool_mint_pubkey, false),
AccountMeta::new(*source_pubkey, false),
AccountMeta::new(*swap_token_a_pubkey, false),
AccountMeta::new(*swap_token_b_pubkey, false),
AccountMeta::new(*destination_token_a_pubkey, false),
AccountMeta::new(*destination_token_b_pubkey, false),
AccountMeta::new(*token_program_id, false),
AccountMeta::new_readonly(*token_program_id, false),
];
Ok(Instruction {
@ -343,13 +343,13 @@ pub fn swap(
.pack();
let accounts = vec![
AccountMeta::new(*swap_pubkey, false),
AccountMeta::new(*authority_pubkey, false),
AccountMeta::new_readonly(*swap_pubkey, false),
AccountMeta::new_readonly(*authority_pubkey, false),
AccountMeta::new(*source_pubkey, false),
AccountMeta::new(*swap_source_pubkey, false),
AccountMeta::new(*swap_destination_pubkey, false),
AccountMeta::new(*destination_pubkey, false),
AccountMeta::new(*token_program_id, false),
AccountMeta::new_readonly(*token_program_id, false),
];
Ok(Instruction {