Skip to content

Commit

Permalink
Replace #[account("...")] with #[account(constraint = "...")]
Browse files Browse the repository at this point in the history
Signed-off-by: Nikhil B N <[email protected]>
  • Loading branch information
NBNARADHYA committed Feb 14, 2022
1 parent 07eb693 commit db2f498
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lang/src/idl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub struct IdlSetBuffer<'info> {
//
// Note: we use the same account for the "write buffer", similar to the
// bpf upgradeable loader's mechanism.
#[account("internal")]
#[account(constraint = internal)]
#[derive(Debug)]
pub struct IdlAccount {
// Address that can modify the IDL.
Expand Down
2 changes: 1 addition & 1 deletion tests/lockup/programs/lockup/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ pub struct WhitelistTransfer<'info> {
bump = vesting.nonce,
)]
vesting_signer: AccountInfo<'info>,
#[account("token_program.key == &token::ID")]
#[account(constraint = token_program.key == &token::ID)]
token_program: AccountInfo<'info>,
#[account(mut)]
whitelisted_program_vault: AccountInfo<'info>,
Expand Down
18 changes: 9 additions & 9 deletions tests/lockup/programs/registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ pub struct Initialize<'info> {
registrar: Account<'info, Registrar>,
#[account(zero)]
reward_event_q: Account<'info, RewardQueue>,
#[account("pool_mint.decimals == 0")]
#[account(constraint = pool_mint.decimals == 0)]
pool_mint: Account<'info, Mint>,
}

Expand Down Expand Up @@ -608,20 +608,20 @@ pub struct CreateMember<'info> {
member: Box<Account<'info, Member>>,
beneficiary: Signer<'info>,
#[account(
"&balances.spt.owner == member_signer.key",
"balances.spt.mint == registrar.pool_mint",
"balances.vault.mint == registrar.mint"
constraint = &balances.spt.owner == member_signer.key,
constraint = balances.spt.mint == registrar.pool_mint,
constraint = balances.vault.mint == registrar.mint
)]
balances: BalanceSandboxAccounts<'info>,
#[account(
"&balances_locked.spt.owner == member_signer.key",
"balances_locked.spt.mint == registrar.pool_mint",
"balances_locked.vault.mint == registrar.mint"
constraint = &balances_locked.spt.owner == member_signer.key,
constraint = balances_locked.spt.mint == registrar.pool_mint,
constraint = balances_locked.vault.mint == registrar.mint
)]
balances_locked: BalanceSandboxAccounts<'info>,
member_signer: AccountInfo<'info>,
// Misc.
#[account("token_program.key == &token::ID")]
#[account(constraint = token_program.key == &token::ID)]
token_program: AccountInfo<'info>,
}

Expand Down Expand Up @@ -952,7 +952,7 @@ pub struct ClaimReward<'info> {
pub struct ClaimRewardLocked<'info> {
cmn: ClaimRewardCommon<'info>,
registry: ProgramState<'info, Registry>,
#[account("lockup_program.key == &registry.lockup_program")]
#[account(constraint = lockup_program.key == &registry.lockup_program)]
lockup_program: AccountInfo<'info>,
}

Expand Down

0 comments on commit db2f498

Please sign in to comment.