Skip to content

Commit

Permalink
Merge branch 'master' into thlorenz/chore/upgrade-spl-token+fixed-price
Browse files Browse the repository at this point in the history
* master:
  Update Cargo.toml
  Take more bytes from slot for entropy (#300)
  chore: upgrade spl-token package (#299)
  Auction house docs (#296)
  Fix order in extra accounts comment to match (#298)
  • Loading branch information
thlorenz committed Mar 11, 2022
2 parents ea13d5b + e93c2a5 commit 4c7c755
Show file tree
Hide file tree
Showing 35 changed files with 554 additions and 194 deletions.
198 changes: 194 additions & 4 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions auction-house/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"dependencies": {
"@metaplex-foundation/beet": "^0.0.8",
"@metaplex-foundation/beet-solana": "^0.0.6",
"@metaplex-foundation/mpl-core": "0.0.4",
"@metaplex-foundation/mpl-core": "^0.0.5",
"@solana/web3.js": "^1.35.1",
"bn.js": "^5.2.0"
},
Expand All @@ -52,6 +52,7 @@
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"spok": "^1.4.3",
"tape": "^5.5.2"
"tape": "^5.5.2",
"typescript": "^4.6.2"
}
}
10 changes: 9 additions & 1 deletion auction-house/program/src/bid/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
//! Create both private and public bids.
//! A private bid is a bid on a specific NFT *held by a specific person*. A public bid is a bid on a specific NFT *regardless of who holds it*.
use anchor_lang::{
prelude::*,
solana_program::{program::invoke, system_instruction},
AnchorDeserialize, AnchorSerialize,
AnchorDeserialize,
};
use anchor_spl::token::{Mint, Token, TokenAccount};
use solana_program::program_memory::sol_memset;

use crate::{constants::*, utils::*, AuctionHouse, ErrorCode, TRADE_STATE_SIZE};

/// Accounts for the [`public_bid` handler](fn.public_bid.html).
#[derive(Accounts)]
#[instruction(trade_state_bump: u8, escrow_payment_bump: u8, buyer_price: u64, token_size: u64)]
pub struct PublicBuy<'info> {
Expand All @@ -32,6 +35,8 @@ pub struct PublicBuy<'info> {
rent: Sysvar<'info, Rent>,
}

/// Create a bid on a specific SPL token.
/// Public bids are specific to the token itself, rather than the auction, and remain open indefinitely until either the user closes it or the requirements for the bid are met and it is matched with a counter bid and closed as a transaction.
pub fn public_bid(
ctx: Context<PublicBuy>,
trade_state_bump: u8,
Expand Down Expand Up @@ -62,6 +67,7 @@ pub fn public_bid(
)
}

/// Accounts for the [`private_bid` handler](fn.private_bid.html).
#[derive(Accounts)]
#[instruction(trade_state_bump: u8, escrow_payment_bump: u8, buyer_price: u64, token_size: u64)]
pub struct Buy<'info> {
Expand All @@ -86,6 +92,7 @@ pub struct Buy<'info> {
rent: Sysvar<'info, Rent>,
}

/// Create a private bid on a specific SPL token that is *held by a specific wallet*.
pub fn private_bid<'info>(
ctx: Context<'_, '_, '_, 'info, Buy<'info>>,
trade_state_bump: u8,
Expand Down Expand Up @@ -116,6 +123,7 @@ pub fn private_bid<'info>(
)
}

/// Handles the bid logic for both private and public bids.
pub fn bid_logic<'info>(
wallet: Signer<'info>,
payment_account: UncheckedAccount<'info>,
Expand Down
Loading

0 comments on commit 4c7c755

Please sign in to comment.