Skip to content

Commit 7399069

Browse files
authored
program: allow fixing hlm num users (#1630)
1 parent ede19b8 commit 7399069

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

programs/drift/src/instructions/admin.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4398,13 +4398,18 @@ pub fn handle_update_high_leverage_mode_config(
43984398
ctx: Context<UpdateHighLeverageModeConfig>,
43994399
max_users: u32,
44004400
reduce_only: bool,
4401+
current_users: Option<u32>,
44014402
) -> Result<()> {
44024403
let mut config = load_mut!(ctx.accounts.high_leverage_mode_config)?;
44034404

44044405
config.max_users = max_users;
44054406

44064407
config.reduce_only = reduce_only as u8;
44074408

4409+
if let Some(current_users) = current_users {
4410+
config.current_users = current_users;
4411+
}
4412+
44084413
config.validate()?;
44094414

44104415
Ok(())

programs/drift/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1679,8 +1679,9 @@ pub mod drift {
16791679
ctx: Context<UpdateHighLeverageModeConfig>,
16801680
max_users: u32,
16811681
reduce_only: bool,
1682+
current_users: Option<u32>,
16821683
) -> Result<()> {
1683-
handle_update_high_leverage_mode_config(ctx, max_users, reduce_only)
1684+
handle_update_high_leverage_mode_config(ctx, max_users, reduce_only, current_users)
16841685
}
16851686

16861687
pub fn initialize_protected_maker_mode_config(

sdk/src/adminClient.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4113,10 +4113,15 @@ export class AdminClient extends DriftClient {
41134113

41144114
public async updateUpdateHighLeverageModeConfig(
41154115
maxUsers: number,
4116-
reduceOnly: boolean
4116+
reduceOnly: boolean,
4117+
currentUsers?: number
41174118
): Promise<TransactionSignature> {
41184119
const updateHighLeverageModeConfigIx =
4119-
await this.getUpdateHighLeverageModeConfigIx(maxUsers, reduceOnly);
4120+
await this.getUpdateHighLeverageModeConfigIx(
4121+
maxUsers,
4122+
reduceOnly,
4123+
currentUsers
4124+
);
41204125

41214126
const tx = await this.buildTransaction(updateHighLeverageModeConfigIx);
41224127

@@ -4127,11 +4132,13 @@ export class AdminClient extends DriftClient {
41274132

41284133
public async getUpdateHighLeverageModeConfigIx(
41294134
maxUsers: number,
4130-
reduceOnly: boolean
4135+
reduceOnly: boolean,
4136+
currentUsers?: number
41314137
): Promise<TransactionInstruction> {
41324138
return await this.program.instruction.updateHighLeverageModeConfig(
41334139
maxUsers,
41344140
reduceOnly,
4141+
currentUsers,
41354142
{
41364143
accounts: {
41374144
admin: this.isSubscribed

0 commit comments

Comments
 (0)