Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing mut on signer #3

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 36 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions programs/auction-house/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ cpi = ["no-entrypoint"]
default = []

[dependencies]
anchor-lang = "0.18.2"
anchor-spl = "0.18.2"
anchor-lang = "0.20.1"
anchor-spl = "0.20.1"
spl-token = { version = "3.2", features = ["no-entrypoint"] }
spl-associated-token-account = {version = "1.0.3", features = ["no-entrypoint"]}
metaplex-token-metadata = { version = "0.0.1", features = ["no-entrypoint"] }
Expand Down
5 changes: 3 additions & 2 deletions programs/auction-house/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ pub struct ExecuteSale<'info> {
#[account(signer)]
authority: AccountInfo<'info>,
#[account(seeds=[PREFIX.as_bytes(), auction_house.creator.as_ref(), auction_house.treasury_mint.as_ref()], bump=auction_house.bump, has_one=authority, has_one=treasury_mint, has_one=auction_house_treasury, has_one=auction_house_fee_account)]
auction_house: Account<'info, AuctionHouse>,
auction_house: Box<Account<'info, AuctionHouse>>,
#[account(mut, seeds=[PREFIX.as_bytes(), auction_house.key().as_ref(), FEE_PAYER.as_bytes()], bump=auction_house.fee_payer_bump)]
auction_house_fee_account: UncheckedAccount<'info>,
#[account(mut, seeds=[PREFIX.as_bytes(), auction_house.key().as_ref(), TREASURY.as_bytes()], bump=auction_house.treasury_bump)]
Expand Down Expand Up @@ -1291,6 +1291,7 @@ pub struct Cancel<'info> {
#[instruction(bump: u8, fee_payer_bump: u8, treasury_bump: u8)]
pub struct CreateAuctionHouse<'info> {
treasury_mint: Account<'info, Mint>,
#[account(mut)]
payer: Signer<'info>,
authority: AccountInfo<'info>,
#[account(mut)]
Expand Down Expand Up @@ -1350,7 +1351,7 @@ pub struct WithdrawFromFee<'info> {
fee_withdrawal_destination: UncheckedAccount<'info>,
#[account(mut, seeds=[PREFIX.as_bytes(), auction_house.key().as_ref(), FEE_PAYER.as_bytes()], bump=auction_house.fee_payer_bump)]
auction_house_fee_account: UncheckedAccount<'info>,
#[account(mut, seeds=[PREFIX.as_bytes(), auction_house.creator.as_ref(), auction_house.treasury_mint.key().as_ref()], bump=auction_house.bump, has_one=authority, has_one=fee_withdrawal_destination, has_one=auction_house_fee_account)]
#[account(mut, seeds=[PREFIX.as_bytes(), auction_house.creator.as_ref(), auction_house.treasury_mint.as_ref()], bump=auction_house.bump, has_one=authority, has_one=fee_withdrawal_destination, has_one=auction_house_fee_account)]
auction_house: Account<'info, AuctionHouse>,
system_program: Program<'info, System>,
}
Expand Down
20 changes: 10 additions & 10 deletions programs/auction-house/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ use {
arrayref::array_ref,
metaplex_token_metadata::state::Metadata,
spl_associated_token_account::get_associated_token_address,
spl_token::{instruction::initialize_account2, state::Account},
spl_token::{instruction::initialize_account2, state::Account as SplAccount},
std::{convert::TryInto, slice::Iter},
};
pub fn assert_is_ata(
ata: &AccountInfo,
wallet: &Pubkey,
mint: &Pubkey,
) -> Result<Account, ProgramError> {
) -> Result<SplAccount, ProgramError> {
assert_owned_by(ata, &spl_token::id())?;
let ata_account: Account = assert_initialized(ata)?;
let ata_account: SplAccount = assert_initialized(ata)?;
assert_keys_equal(ata_account.owner, *wallet)?;
assert_keys_equal(get_associated_token_address(wallet, mint), *ata.key)?;
Ok(ata_account)
Expand Down Expand Up @@ -72,7 +72,7 @@ pub fn make_ata<'a>(

pub fn assert_metadata_valid<'a>(
metadata: &UncheckedAccount,
token_account: &anchor_lang::Account<'a, TokenAccount>,
token_account: &Account<'a, TokenAccount>,
) -> ProgramResult {
assert_derivation(
&metaplex_token_metadata::id(),
Expand All @@ -92,7 +92,7 @@ pub fn assert_metadata_valid<'a>(

pub fn get_fee_payer<'a, 'b>(
authority: &AccountInfo,
auction_house: &anchor_lang::Account<AuctionHouse>,
auction_house: &Account<AuctionHouse>,
wallet: AccountInfo<'a>,
auction_house_fee_account: AccountInfo<'a>,
auction_house_seeds: &'b [&'b [u8]],
Expand Down Expand Up @@ -120,10 +120,10 @@ pub fn assert_valid_delegation(
src_wallet: &AccountInfo,
dst_wallet: &AccountInfo,
transfer_authority: &AccountInfo,
mint: &anchor_lang::Account<Mint>,
mint: &Account<Mint>,
paysize: u64,
) -> ProgramResult {
match Account::unpack(&src_account.data.borrow()) {
match SplAccount::unpack(&src_account.data.borrow()) {
Ok(token_account) => {
// Ensure that the delegated amount is exactly equal to the maker_size
msg!(
Expand Down Expand Up @@ -191,7 +191,7 @@ pub fn assert_owned_by(account: &AccountInfo, owner: &Pubkey) -> ProgramResult {

#[allow(clippy::too_many_arguments)]
pub fn pay_auction_house_fees<'a>(
auction_house: &anchor_lang::Account<'a, AuctionHouse>,
auction_house: &Account<'a, AuctionHouse>,
auction_house_treasury: &AccountInfo<'a>,
escrow_payment_account: &AccountInfo<'a>,
token_program: &AccountInfo<'a>,
Expand Down Expand Up @@ -247,7 +247,7 @@ pub fn create_program_token_account_if_not_present<'a>(
system_program: &Program<'a, System>,
fee_payer: &AccountInfo<'a>,
token_program: &Program<'a, Token>,
treasury_mint: &anchor_lang::Account<'a, Mint>,
treasury_mint: &Account<'a, Mint>,
owner: &AccountInfo<'a>,
rent: &Sysvar<'a, Rent>,
signer_seeds: &[&[u8]],
Expand All @@ -261,7 +261,7 @@ pub fn create_program_token_account_if_not_present<'a>(
&rent.to_account_info(),
&system_program,
&fee_payer,
spl_token::state::Account::LEN,
SplAccount::LEN,
fee_seeds,
signer_seeds,
)?;
Expand Down