Skip to content

Commit

Permalink
PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wphan committed Oct 30, 2023
1 parent 377b788 commit 7703690
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions programs/drift_vaults/src/instructions/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ pub fn is_user_stats_for_vault(
}

pub fn is_spot_market_for_vault(
vault_depositor: &AccountLoader<Vault>,
vault: &AccountLoader<Vault>,
drift_spot_market: &AccountLoader<SpotMarket>,
market_index: u16,
) -> anchor_lang::Result<bool> {
Ok(
(vault_depositor.load()?.spot_market_index).eq(&drift_spot_market.load()?.market_index)
&& (vault_depositor.load()?.spot_market_index).eq(&market_index),
(vault.load()?.spot_market_index).eq(&drift_spot_market.load()?.market_index)
&& (vault.load()?.spot_market_index).eq(&market_index),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ pub struct InitializeCompetitor<'info> {

#[account(
mut,
seeds = [b"competitor", competition.key().as_ref(), vault.key().as_ref()],
seeds = [b"competitor", drift_competitions.key().as_ref(), vault.key().as_ref()],
bump,
seeds::program = drift_competitions_program.key(),
)]
/// CHECK: checked in drift cpi
pub competitor: AccountInfo<'info>,
#[account(mut)]
/// CHECK: checked in drift cpi
pub competition: AccountInfo<'info>,
pub drift_competitions: AccountInfo<'info>,
#[account(
mut,
constraint = is_user_stats_for_vault(&vault, &drift_user_stats.to_account_info())?
Expand All @@ -53,7 +53,7 @@ impl<'info> InitializeCompetitorCPI for Context<'_, '_, '_, 'info, InitializeCom

let cpi_accounts = DriftCompetitionInitializeCompetitor {
competitor: self.accounts.competitor.to_account_info().clone(),
competition: self.accounts.competition.to_account_info().clone(),
competition: self.accounts.drift_competitions.to_account_info().clone(),
drift_user_stats: self.accounts.drift_user_stats.to_account_info().clone(),
authority: self.accounts.vault.to_account_info().clone(),
payer: self.accounts.payer.to_account_info().clone(),
Expand Down

0 comments on commit 7703690

Please sign in to comment.