@@ -4711,6 +4711,7 @@ pub fn handle_initialize_lp_pool(
47114711 max_mint_fee : i64 ,
47124712 revenue_rebalance_period : u64 ,
47134713 max_aum : u128 ,
4714+ max_settle_quote_amount_per_market : u64 ,
47144715) -> Result < ( ) > {
47154716 let mut lp_pool = ctx. accounts . lp_pool . load_init ( ) ?;
47164717 let mint = ctx. accounts . mint . key ( ) ;
@@ -4724,11 +4725,11 @@ pub fn handle_initialize_lp_pool(
47244725 last_aum : 0 ,
47254726 last_aum_slot : 0 ,
47264727 last_aum_ts : 0 ,
4728+ max_settle_quote_amount : max_settle_quote_amount_per_market,
47274729 last_revenue_rebalance_ts : 0 ,
47284730 total_fees_received : 0 ,
47294731 total_fees_paid : 0 ,
47304732 total_mint_redeem_fees_paid : 0 ,
4731- oldest_oracle_slot : 0 ,
47324733 bump : ctx. bumps . lp_pool ,
47334734 min_mint_fee,
47344735 max_mint_fee_premium : max_mint_fee,
@@ -5016,6 +5017,7 @@ pub fn handle_initialize_constituent<'info>(
50165017 max_weight_deviation : i64 ,
50175018 swap_fee_min : i64 ,
50185019 swap_fee_max : i64 ,
5020+ max_borrow_token_amount : u64 ,
50195021 oracle_staleness_threshold : u64 ,
50205022 cost_to_trade_bps : i32 ,
50215023 constituent_derivative_index : Option < i16 > ,
@@ -5067,6 +5069,7 @@ pub fn handle_initialize_constituent<'info>(
50675069 constituent. mint = ctx. accounts . spot_market_mint . key ( ) ;
50685070 constituent. token_vault = ctx. accounts . constituent_vault . key ( ) ;
50695071 constituent. bump = ctx. bumps . constituent ;
5072+ constituent. max_borrow_token_amount = max_borrow_token_amount;
50705073 constituent. lp_pool = lp_pool. pubkey ;
50715074 constituent. constituent_index = ( constituent_target_base. targets . len ( ) - 1 ) as u16 ;
50725075 constituent. next_swap_id = 1 ;
@@ -5101,6 +5104,7 @@ pub struct ConstituentParams {
51015104 pub max_weight_deviation : Option < i64 > ,
51025105 pub swap_fee_min : Option < i64 > ,
51035106 pub swap_fee_max : Option < i64 > ,
5107+ pub max_borrow_token_amount : Option < u64 > ,
51045108 pub oracle_staleness_threshold : Option < u64 > ,
51055109 pub cost_to_trade_bps : Option < i32 > ,
51065110 pub constituent_derivative_index : Option < i16 > ,
@@ -5211,6 +5215,38 @@ pub fn handle_update_constituent_params<'info>(
52115215 constituent. xi = constituent_params. xi . unwrap ( ) ;
52125216 }
52135217
5218+ if let Some ( max_borrow_token_amount) = constituent_params. max_borrow_token_amount {
5219+ msg ! (
5220+ "max_borrow_token_amount: {:?} -> {:?}" ,
5221+ constituent. max_borrow_token_amount,
5222+ max_borrow_token_amount
5223+ ) ;
5224+ constituent. max_borrow_token_amount = max_borrow_token_amount;
5225+ }
5226+
5227+ Ok ( ( ) )
5228+ }
5229+
5230+ #[ derive( AnchorSerialize , AnchorDeserialize , Clone , Default ) ]
5231+ pub struct LpPoolParams {
5232+ pub max_settle_quote_amount : Option < u64 > ,
5233+ }
5234+
5235+ pub fn handle_update_lp_pool_params < ' info > (
5236+ ctx : Context < UpdateLpPoolParams > ,
5237+ lp_pool_params : LpPoolParams ,
5238+ ) -> Result < ( ) > {
5239+ let mut lp_pool = ctx. accounts . lp_pool . load_mut ( ) ?;
5240+
5241+ if let Some ( max_settle_quote_amount) = lp_pool_params. max_settle_quote_amount {
5242+ msg ! (
5243+ "max_settle_quote_amount: {:?} -> {:?}" ,
5244+ lp_pool. max_settle_quote_amount,
5245+ max_settle_quote_amount
5246+ ) ;
5247+ lp_pool. max_settle_quote_amount = max_settle_quote_amount;
5248+ }
5249+
52145250 Ok ( ( ) )
52155251}
52165252
@@ -6683,6 +6719,18 @@ pub struct UpdateConstituentParams<'info> {
66836719 pub constituent : AccountLoader < ' info , Constituent > ,
66846720}
66856721
6722+ #[ derive( Accounts ) ]
6723+ pub struct UpdateLpPoolParams < ' info > {
6724+ #[ account( mut ) ]
6725+ pub lp_pool : AccountLoader < ' info , LPPool > ,
6726+ #[ account(
6727+ mut ,
6728+ constraint = admin. key( ) == admin_hot_wallet:: id( ) || admin. key( ) == state. admin
6729+ ) ]
6730+ pub admin : Signer < ' info > ,
6731+ pub state : Box < Account < ' info , State > > ,
6732+ }
6733+
66866734#[ derive( AnchorSerialize , AnchorDeserialize , Clone , Default ) ]
66876735pub struct AddAmmConstituentMappingDatum {
66886736 pub constituent_index : u16 ,
0 commit comments