Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
GabeDottl committed Apr 20, 2021
1 parent 9de30d9 commit 2f4d59b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 68 deletions.
2 changes: 1 addition & 1 deletion src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Processor {
)?;

msg!("Calling the token program to transfer token account ownership...");
msg!("Token program: {}. Transferring ownership {}->{}", token_program.key, initializer.key, pda);
msg!("Token program: {}. Transferring ownership {} -> {}", token_program.key, initializer.key, pda);
invoke(
&owner_change_ix,
&[
Expand Down
69 changes: 2 additions & 67 deletions tests/functional_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,72 +248,7 @@ async fn test_token() {
assert_eq!(alice_account_temp_account.owner, spl_token::id());
let internal_account = spl_token::state::Account::unpack(&alice_account_temp_account.data).unwrap();
let (pda, _bump_seed) = Pubkey::find_program_address(&[b"escrow"], &hearttoken::id());
// Ensure that

// Ensure that the escrow account's ownership
assert_eq!(internal_account.owner, pda);
}

// #[tokio::test]
// https://github.com/solana-labs/solana-program-library/blob/2b3f71ead5b81f4ea4a2fd3e4fe9583a6e39b6a4/record/program/tests/functional.rs
// async fn test_escrow() {
// let spl_token::id() = Pubkey::new_unique();
// let mut program_test =
// ProgramTest::new("token_test", hearttoken::id(), processor!(process_instruction));

// let hearttoken::id() = Pubkey::new_unique();

// // Create a SPL token
// // Create a main token account for Alice
// // Create temporary token account for Alice
// // Create a receiving account for Alice
// // Create Escrow program

// let alice_pubkey = Pubkey::new_unique();
// let destination_pubkey = Pubkey::new_unique();
// // TODO: Create SPL token program & transactions?
// // let mut program_test =
// ProgramTest::new("escrow_test", hearttoken::id(), processor!(process_instruction));
// // add_usdc_mint(&mut program_test);

// // Start the test client
// let (mut banks_client, payer, recent_blockhash) = program_test.start().await;

// let mut transaction = Transaction::new_with_payer(
// &[Instruction {
// hearttoken::id(),
// accounts: vec![AccountMeta::new(payer.pubkey(), false)],
// data: vec![1, 2, 3],
// }],
// Some(&payer.pubkey()),
// );
// transaction.sign(&[&payer], recent_blockhash);
// // assert_eq!(true, false);
// assert_matches!(banks_client.process_transaction(transaction).await, Ok(()));
// }

// pub struct TestQuoteMint {
// pub pubkey: Pubkey,
// pub authority: Keypair,
// pub decimals: u8,
// }

// pub fn add_usdc_mint(test: &mut ProgramTest) -> TestQuoteMint {
// let authority = Keypair::new();
// let pubkey = Pubkey::from_str(USDC_MINT).unwrap();
// let decimals = 6;
// test.add_packable_account(
// pubkey,
// u32::MAX as u64,
// &Mint {
// is_initialized: true,
// mint_authority: COption::Some(authority.pubkey()),
// decimals,
// ..Mint::default()
// },
// &spl_token::id(),
// );
// TestQuoteMint {
// pubkey,
// authority,
// decimals,
// }
// }

0 comments on commit 2f4d59b

Please sign in to comment.