1
use crate::curve::quadratic_curve::{QuadraticCurve};
use crate::utils::mpl::{create_metadata_accounts_v3, CreateMetadataAccountsV3cpi, Metadata};
// use crate::utils::token::{create_mint, create_token_account};
use crate::state::{CurveInfo, PoolInfo};
use crate::{
    TOKEN_MINT_SEED, SOL_VAULT_SEED, TOKEN_VAULT_SEED, IPSHARE_MINT_SEED,DONUT_POOL_INFO_SEED
};
use anchor_lang::{prelude::*, system_program};
use anchor_spl::token::spl_token::state::Account;
use anchor_spl::token::{Mint, self, mint_to, set_authority, MintTo, SetAuthority, Token};
use mpl_token_metadata::{
    accounts::{self},
    types,
};
// use spl_token::instruction::AuthorityType;

// ipshare decimals same with token decimals
#[derive(AnchorDeserialize, AnchorSerialize, Clone)]
pub struct CreateTokenAndBondingCurveArgs {
  pub token_name: String,
  pub token_symbol: String,
  pub token_uri: String,
  pub token_decimals: u8,
  pub ipshare_name: String,
  pub ipshare_symbol: String,
  pub ipshare_uri: String,
  pub m_coefficient: u64,
}

#[derive(Accounts)]
#[instruction(args: CreateTokenAndBondingCurveArgs)]
pub struct CreateTokenAndBondingCurve<'info> {
  #[account(mut)]
  pub admin: Signer<'info>,

  #[account(
    init,
    seeds = [args.token_name.as_bytes(), DONUT_POOL_INFO_SEED.as_bytes()],
    bump,
    payer = admin,
    space = 8 + PoolInfo::LEN,
  )]
  pub pool_info: Account<'info, PoolInfo>,

  #[account(
    mut,
    seeds = [args.token_name.as_bytes(), SOL_VAULT_SEED.as_bytes()],
    bump,
  )]
  pub sol_vault: UncheckedAccount<'info>,

  #[account(
    mut,
    seeds = [args.token_name.as_bytes(), TOKEN_VAULT_SEED.as_bytes()],
    bump,
  )]
  pub token_vault: UncheckedAccount<'info>,


  #[account(
    mut,
    seeds = [args.token_name.as_bytes(), TOKEN_MINT_SEED.as_bytes()],
    bump,
  )]
  pub token_mint: UncheckedAccount<'info>,

  #[account(
    mut,
    address = accounts::Metadata::find_pda(&token_mint.key()).0,
  )]
  pub token_metadata_account: UncheckedAccount<'info>,

  #[account(
    mut,
    seeds = [args.ipshare_name.as_bytes(), IPSHARE_MINT_SEED.as_bytes()],
    bump,
  )]
  pub ipshare_mint: UncheckedAccount<'info>,

  #[account(
    mut,
    address = accounts::Metadata::find_pda(&ipshare_mint.key()).0,
  )]
  pub ipshare_metadata_account: UncheckedAccount<'info>,

  pub system_program: Program<'info, System>,
  pub token_program: Program<'info, Token>,
  pub token_metadata_program: Program<'info, Metadata>,
}

impl<'info> CreateTokenAndBondingCurve<'info> {

}

my code looks almost like it, and it is my Cargo.toml settings it looks like

[dependencies]
anchor-lang = { version = "0.29.0", features = ["init-if-needed"] }
anchor-spl = "0.29.0"
mpl-token-metadata = "4.1.2"
solana-program = "1.18.14"

I got error

`struct takes 0 lifetime arguments but 1 lifetime argument was supplied
expected 0 lifetime argumentsrustcClick for full compiler diagnostic
state.rs(89, 12): struct defined here, with 0 lifetime parameters
create_token_and_bonding_curve.rs(41, 27): remove this lifetime argument
struct takes 0 generic arguments but 1 generic argument was supplied
expected 0 generic argumentsrustcClick for full compiler diagnostic
state.rs(89, 12): struct defined here, with 0 generic parameters
create_token_and_bonding_curve.rs(41, 34): remove this generic argument` 

in the linke pub pool_vault: Account<'info, PoolVault>, and line pub pool_info: Account<'info, LaunchInfo>,, anyone can give me some suggestions?

1 Answer 1

1

You've imported the Account from the SPL Token account, and not the Anchor account. Try to remove use anchor_spl::token::spl_token::state::Account; since the Anchor Account is part of the Anchor prelude.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.