Skip to content

Commit 5702b5e

Browse files
committed
remove unnecessary admin func
1 parent d4ad8db commit 5702b5e

File tree

3 files changed

+14
-45
lines changed

3 files changed

+14
-45
lines changed

programs/drift/src/instructions/lp_admin.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,6 @@ pub fn handle_initialize_lp_pool(
113113
Ok(())
114114
}
115115

116-
pub fn handle_increase_lp_pool_max_aum(
117-
ctx: Context<UpdateLpPoolParams>,
118-
new_max_aum: u128,
119-
) -> Result<()> {
120-
let mut lp_pool = ctx.accounts.lp_pool.load_mut()?;
121-
msg!(
122-
"lp pool max aum: {:?} -> {:?}",
123-
lp_pool.max_aum,
124-
new_max_aum
125-
);
126-
lp_pool.max_aum = new_max_aum;
127-
Ok(())
128-
}
129-
130116
pub fn handle_initialize_constituent<'info>(
131117
ctx: Context<'_, '_, '_, 'info, InitializeConstituent<'info>>,
132118
spot_market_index: u16,
@@ -399,6 +385,7 @@ pub struct LpPoolParams {
399385
pub volatility: Option<u64>,
400386
pub gamma_execution: Option<u8>,
401387
pub xi: Option<u8>,
388+
pub max_aum: Option<u128>,
402389
pub whitelist_mint: Option<Pubkey>,
403390
}
404391

@@ -445,6 +432,16 @@ pub fn handle_update_lp_pool_params<'info>(
445432
lp_pool.whitelist_mint = whitelist_mint;
446433
}
447434

435+
if let Some(max_aum) = lp_pool_params.max_aum {
436+
validate!(
437+
max_aum >= lp_pool.max_aum,
438+
ErrorCode::DefaultError,
439+
"new max_aum must be greater than or equal to current max_aum"
440+
)?;
441+
msg!("max_aum: {:?} -> {:?}", lp_pool.max_aum, max_aum);
442+
lp_pool.max_aum = max_aum;
443+
}
444+
448445
Ok(())
449446
}
450447

programs/drift/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,13 +1851,6 @@ pub mod drift {
18511851
)
18521852
}
18531853

1854-
pub fn increase_lp_pool_max_aum(
1855-
ctx: Context<UpdateLpPoolParams>,
1856-
new_max_aum: u128,
1857-
) -> Result<()> {
1858-
handle_increase_lp_pool_max_aum(ctx, new_max_aum)
1859-
}
1860-
18611854
pub fn update_high_leverage_mode_config(
18621855
ctx: Context<UpdateHighLeverageModeConfig>,
18631856
max_users: u32,

sdk/src/adminClient.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5323,30 +5323,6 @@ export class AdminClient extends DriftClient {
53235323
];
53245324
}
53255325

5326-
public async increaseLpPoolMaxAum(
5327-
name: string,
5328-
newMaxAum: BN
5329-
): Promise<TransactionSignature> {
5330-
const ixs = await this.getIncreaseLpPoolMaxAumIx(name, newMaxAum);
5331-
const tx = await this.buildTransaction(ixs);
5332-
const { txSig } = await this.sendTransaction(tx, []);
5333-
return txSig;
5334-
}
5335-
5336-
public async getIncreaseLpPoolMaxAumIx(
5337-
name: string,
5338-
newMaxAum: BN
5339-
): Promise<TransactionInstruction> {
5340-
const lpPool = getLpPoolPublicKey(this.program.programId, encodeName(name));
5341-
return this.program.instruction.increaseLpPoolMaxAum(newMaxAum, {
5342-
accounts: {
5343-
admin: this.wallet.publicKey,
5344-
lpPool,
5345-
state: await this.getStatePublicKey(),
5346-
},
5347-
});
5348-
}
5349-
53505326
public async initializeConstituent(
53515327
lpPoolName: number[],
53525328
initializeConstituentParams: InitializeConstituentParams
@@ -5597,6 +5573,7 @@ export class AdminClient extends DriftClient {
55975573
gammaExecution?: number;
55985574
xi?: number;
55995575
whitelistMint?: PublicKey;
5576+
maxAum?: BN;
56005577
}
56015578
): Promise<TransactionSignature> {
56025579
const ixs = await this.getUpdateLpPoolParamsIx(
@@ -5616,6 +5593,7 @@ export class AdminClient extends DriftClient {
56165593
gammaExecution?: number;
56175594
xi?: number;
56185595
whitelistMint?: PublicKey;
5596+
maxAum?: BN;
56195597
}
56205598
): Promise<TransactionInstruction[]> {
56215599
const lpPool = getLpPoolPublicKey(this.program.programId, lpPoolName);
@@ -5628,6 +5606,7 @@ export class AdminClient extends DriftClient {
56285606
gammaExecution: null,
56295607
xi: null,
56305608
whitelistMint: null,
5609+
maxAum: null,
56315610
},
56325611
updateLpPoolParams
56335612
),

0 commit comments

Comments
 (0)