Open yornaath opened 3 months ago
I have add a seeds::program
constraint to fix it.
#[derive(Accounts)]
pub struct ProxyInitialize<'info> {
pub cp_swap_program: Program<'info, RaydiumCpSwap>,
/// Address paying to create the pool. Can be anyone
#[account(mut)]
pub creator: Signer<'info>,
/// Which config the pool belongs to.
pub amm_config: Box<Account<'info, AmmConfig>>,
/// CHECK: pool vault and lp mint authority
#[account(
seeds = [
raydium_cp_swap::AUTH_SEED.as_bytes(),
],
seeds::program = cp_swap_program,
bump,
)]
pub authority: UncheckedAccount<'info>,
.....
}
Implementing this example(cp-swap-cpi) locally I ran into errors where seed constraints for accounts like authority are violated, probably since the account::seeds macro checks if the account passed mathches the seed discriminator + the calling programm:id. But it should be seed desicriminator + raydium_cp_swap:programId.
Omitting the seeds and the bump fixes the problem for me and I am able to cpi into the raydium contract and init a pool.
I think this is fine since the underlying raydium contract enforces the correct seed?