@@ -4,6 +4,7 @@ use crate::ids::{lp_pool_hot_wallet, lp_pool_swap_wallet, WHITELISTED_SWAP_PROGR
44use crate :: instructions:: optional_accounts:: { get_token_mint, load_maps, AccountMaps } ;
55use crate :: math:: constants:: { PRICE_PRECISION_U64 , QUOTE_SPOT_MARKET_INDEX } ;
66use crate :: math:: safe_math:: SafeMath ;
7+ use crate :: perp_market_valid;
78use crate :: state:: amm_cache:: { AmmCache , AMM_POSITIONS_CACHE } ;
89use crate :: state:: lp_pool:: {
910 AmmConstituentDatum , AmmConstituentMapping , Constituent , ConstituentCorrelations ,
@@ -237,6 +238,40 @@ pub fn handle_update_constituent_paused_operations<'info>(
237238 Ok ( ( ) )
238239}
239240
241+ #[ access_control(
242+ perp_market_valid( & ctx. accounts. perp_market)
243+ ) ]
244+ pub fn handle_update_perp_market_lp_pool_fee_transfer_scalar (
245+ ctx : Context < HotAdminUpdatePerpMarketDlp > ,
246+ optional_lp_fee_transfer_scalar : Option < u8 > ,
247+ optional_lp_net_pnl_transfer_scalar : Option < u8 > ,
248+ ) -> Result < ( ) > {
249+ let perp_market = & mut load_mut ! ( ctx. accounts. perp_market) ?;
250+ msg ! ( "perp market {}" , perp_market. market_index) ;
251+
252+ if let Some ( lp_fee_transfer_scalar) = optional_lp_fee_transfer_scalar {
253+ msg ! (
254+ "perp_market.: {:?} -> {:?}" ,
255+ perp_market. lp_fee_transfer_scalar,
256+ lp_fee_transfer_scalar
257+ ) ;
258+
259+ perp_market. lp_fee_transfer_scalar = lp_fee_transfer_scalar;
260+ }
261+
262+ if let Some ( lp_net_pnl_transfer_scalar) = optional_lp_net_pnl_transfer_scalar {
263+ msg ! (
264+ "perp_market.: {:?} -> {:?}" ,
265+ perp_market. lp_exchange_fee_excluscion_scalar,
266+ lp_net_pnl_transfer_scalar
267+ ) ;
268+
269+ perp_market. lp_exchange_fee_excluscion_scalar = lp_net_pnl_transfer_scalar;
270+ }
271+
272+ Ok ( ( ) )
273+ }
274+
240275#[ derive( AnchorSerialize , AnchorDeserialize , Clone , Default ) ]
241276pub struct ConstituentParams {
242277 pub max_weight_deviation : Option < i64 > ,
@@ -1267,6 +1302,17 @@ pub struct UpdateConstituentCorrelation<'info> {
12671302 pub state : Box < Account < ' info , State > > ,
12681303}
12691304
1305+ #[ derive( Accounts ) ]
1306+ pub struct HotAdminUpdatePerpMarketDlp < ' info > {
1307+ #[ account(
1308+ constraint = admin. key( ) == lp_pool_hot_wallet:: id( ) || admin. key( ) == state. admin
1309+ ) ]
1310+ pub admin : Signer < ' info > ,
1311+ pub state : Box < Account < ' info , State > > ,
1312+ #[ account( mut ) ]
1313+ pub perp_market : AccountLoader < ' info , PerpMarket > ,
1314+ }
1315+
12701316#[ derive( Accounts ) ]
12711317#[ instruction(
12721318 in_market_index: u16 ,
0 commit comments