Skip to content
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
10 changes: 5 additions & 5 deletions lang/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ use std::fmt;
/// Ok(())
/// }
/// ```
pub struct Context<'a, 'b, 'c, 'info, T: Bumps> {
pub struct Context<'a, 'b, 'info, T: Bumps> {
/// Currently executing program id.
pub program_id: &'a Pubkey,
/// Deserialized accounts.
pub accounts: &'b mut T,
/// Remaining accounts given but not deserialized or validated.
/// Be very careful when using this directly.
pub remaining_accounts: &'c [AccountInfo<'info>],
pub remaining_accounts: &'info [AccountInfo<'info>],
/// Bump seeds found during constraint validation. This is provided as a
/// convenience so that handlers don't have to recalculate bump seeds or
/// pass them in as arguments.
/// Type is the bumps struct generated by #[derive(Accounts)]
pub bumps: T::Bumps,
}

impl<T> fmt::Debug for Context<'_, '_, '_, '_, T>
impl<T> fmt::Debug for Context<'_, '_, '_, T>
where
T: fmt::Debug + Bumps,
{
Expand All @@ -50,14 +50,14 @@ where
}
}

impl<'a, 'b, 'c, 'info, T> Context<'a, 'b, 'c, 'info, T>
impl<'a, 'b, 'info, T> Context<'a, 'b, 'info, T>
where
T: Bumps + Accounts<'info, T::Bumps>,
{
pub fn new(
program_id: &'a Pubkey,
accounts: &'b mut T,
remaining_accounts: &'c [AccountInfo<'info>],
remaining_accounts: &'info [AccountInfo<'info>],
bumps: T::Bumps,
) -> Self {
Self {
Expand Down
20 changes: 10 additions & 10 deletions tests/auction-house/programs/auction-house/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub mod auction_house {
use super::*;

pub fn create_auction_house<'info>(
ctx: Context<'_, '_, '_, 'info, CreateAuctionHouse<'info>>,
ctx: Context<'_, '_, 'info, CreateAuctionHouse<'info>>,
seller_fee_basis_points: u16,
requires_sign_off: bool,
can_change_sale_price: bool,
Expand Down Expand Up @@ -127,7 +127,7 @@ pub mod auction_house {
}

pub fn deposit<'info>(
ctx: Context<'_, '_, '_, 'info, Deposit<'info>>,
ctx: Context<'_, '_, 'info, Deposit<'info>>,
amount: u64,
) -> Result<()> {
let wallet = &ctx.accounts.wallet;
Expand Down Expand Up @@ -222,7 +222,7 @@ pub mod auction_house {
}

pub fn withdraw<'info>(
ctx: Context<'_, '_, '_, 'info, Withdraw<'info>>,
ctx: Context<'_, '_, 'info, Withdraw<'info>>,
amount: u64,
) -> Result<()> {
let wallet = &ctx.accounts.wallet;
Expand Down Expand Up @@ -341,7 +341,7 @@ pub mod auction_house {
}

pub fn sell<'info>(
ctx: Context<'_, '_, '_, 'info, Sell<'info>>,
ctx: Context<'_, '_, 'info, Sell<'info>>,
buyer_price: u64,
token_size: u64,
) -> Result<()> {
Expand Down Expand Up @@ -459,7 +459,7 @@ pub mod auction_house {
}

pub fn cancel<'info>(
ctx: Context<'_, '_, '_, 'info, Cancel<'info>>,
ctx: Context<'_, '_, 'info, Cancel<'info>>,
_buyer_price: u64,
_token_size: u64,
) -> Result<()> {
Expand Down Expand Up @@ -521,7 +521,7 @@ pub mod auction_house {
}

pub fn buy<'info>(
ctx: Context<'_, '_, '_, 'info, Buy<'info>>,
ctx: Context<'_, '_, 'info, Buy<'info>>,
buyer_price: u64,
token_size: u64,
) -> Result<()> {
Expand Down Expand Up @@ -666,7 +666,7 @@ pub mod auction_house {
}

pub fn execute_sale<'info>(
ctx: Context<'_, '_, '_, 'info, ExecuteSale<'info>>,
ctx: Context<'_, '_, 'info, ExecuteSale<'info>>,
buyer_price: u64,
token_size: u64,
) -> Result<()> {
Expand Down Expand Up @@ -948,7 +948,7 @@ pub mod auction_house {
}

pub fn withdraw_from_fee<'info>(
ctx: Context<'_, '_, '_, 'info, WithdrawFromFee<'info>>,
ctx: Context<'_, '_, 'info, WithdrawFromFee<'info>>,
amount: u64,
) -> Result<()> {
let auction_house_fee_account = &ctx.accounts.auction_house_fee_account;
Expand Down Expand Up @@ -982,7 +982,7 @@ pub mod auction_house {
}

pub fn withdraw_from_treasury<'info>(
ctx: Context<'_, '_, '_, 'info, WithdrawFromTreasury<'info>>,
ctx: Context<'_, '_, 'info, WithdrawFromTreasury<'info>>,
amount: u64,
) -> Result<()> {
let treasury_mint = &ctx.accounts.treasury_mint;
Expand Down Expand Up @@ -1045,7 +1045,7 @@ pub mod auction_house {
}

pub fn update_auction_house<'info>(
ctx: Context<'_, '_, '_, 'info, UpdateAuctionHouse<'info>>,
ctx: Context<'_, '_, 'info, UpdateAuctionHouse<'info>>,
seller_fee_basis_points: Option<u16>,
requires_sign_off: Option<bool>,
can_change_sale_price: Option<bool>,
Expand Down
4 changes: 2 additions & 2 deletions tests/misc/programs/remaining-accounts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ pub mod remaining_accounts {
Ok(())
}

pub fn test_remaining_accounts<'c: 'info, 'info>(
ctx: Context<'_, '_, 'c, 'info, TestRemainingAccounts>,
pub fn test_remaining_accounts(
ctx: Context<TestRemainingAccounts>,
) -> Result<()> {
let remaining_accounts_iter = &mut ctx.remaining_accounts.iter();

Expand Down