accounts: {
pool: pool.publicKey,
longPayer: longKeypair.publicKey,
shortPayer: shortKeypair.publicKey,
mint: gdTokenMint,
authority: gdTokenKeypair.publicKey,
from: longusdc,
from2: shortusdc,
transferTo: poolusdc,
mintTo: poolgd,
tokenProgram: Spl.TOKEN_PROGRAM_ID,
systemProgram: anchor.web3.SystemProgram.programId,
},
signers: [pool, longKeypair, shortKeypair, gdTokenKeypair],
});
from: ctx.accounts.from.to_account_info(),
to: ctx.accounts.transferTo.to_account_info(),
authority: ctx.accounts.longPayer.to_account_info(),
};
let cpi_program1 = ctx.accounts.token_program.to_account_info();
let cpi_ctx1 = CpiContext::new(cpi_program1, cpi_accounts1);
token::transfer(cpi_ctx1, long_col)?;
let cpi_accounts2 = Transfer {
from: ctx.accounts.from2.to_account_info(),
to: ctx.accounts.transferTo.to_account_info(),
authority: ctx.accounts.shortPayer.to_account_info(),
};
let cpi_program2 = ctx.accounts.token_program.to_account_info();
let cpi_ctx2 = CpiContext::new(cpi_program2, cpi_accounts2);
token::transfer(cpi_ctx2, short_col)?;
let cpi_accounts = MintTo {
mint: ctx.accounts.mint.to_account_info(),
to: ctx.accounts.mintTo.to_account_info(),
authority: ctx.accounts.authority.to_account_info(),
};
let cpi_program = ctx.accounts.token_program.to_account_info();
let cpi_ctx = CpiContext::new(cpi_program, cpi_accounts);
token::mint_to(cpi_ctx, long_col)?;
#[derive(Accounts)]
pub struct CreatePool<'info> {
#[account(init, payer = longPayer, space = Pool::LEN)]
pub pool: Account<'info, Pool>,
pub authority: Signer<'info>,
#[account(mut)]
pub longPayer: Signer<'info>,
#[account(mut)]
pub shortPayer: Signer<'info>,
#[account(mut)]
pub mint: Account<'info, Mint>,
#[account(mut)]
pub from: Account<'info, TokenAccount>,
#[account(mut)]
pub from2: Account<'info, TokenAccount>,
#[account(mut)]
pub mintTo: Account<'info, TokenAccount>,
#[account(mut)]
pub transferTo: Account<'info, TokenAccount>,
pub token_program: Program<'info, Token>,
pub system_program: Program<'info, System>,
}
The error message is not giving me any good leads.
Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Program failed to complete