Skip to content

Commit d02bda5

Browse files
authored
program: fix user stats check for transfer perp pos (#1557)
* program: fix user stats check for transfer perp pos * CHANGELOG
1 parent ec41408 commit d02bda5

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414

1515
### Fixes
1616

17+
- program: fix user stats check for transfer_perp_position ([#1557](https://github.com/drift-labs/protocol-v2/pull/1557))
18+
1719
### Breaking
1820

1921
## [2.116.0] - 2025-03-21

programs/drift/src/instructions/user.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4404,18 +4404,15 @@ pub struct TransferPools<'info> {
44044404
pub struct TransferPerpPosition<'info> {
44054405
#[account(
44064406
mut,
4407-
constraint = can_sign_for_user(&from_user, &authority)?
4407+
constraint = can_sign_for_user(&from_user, &authority)? && is_stats_for_user(&from_user, &user_stats)?
44084408
)]
44094409
pub from_user: AccountLoader<'info, User>,
44104410
#[account(
44114411
mut,
4412-
constraint = can_sign_for_user(&to_user, &authority)?
4412+
constraint = can_sign_for_user(&to_user, &authority)? && is_stats_for_user(&to_user, &user_stats)?
44134413
)]
44144414
pub to_user: AccountLoader<'info, User>,
4415-
#[account(
4416-
mut,
4417-
has_one = authority
4418-
)]
4415+
#[account(mut)]
44194416
pub user_stats: AccountLoader<'info, UserStats>,
44204417
pub authority: Signer<'info>,
44214418
pub state: Box<Account<'info, State>>,

0 commit comments

Comments
 (0)