diff --git a/programs/drift/src/instructions/user.rs b/programs/drift/src/instructions/user.rs index 79a6b5bf4..04e00d835 100644 --- a/programs/drift/src/instructions/user.rs +++ b/programs/drift/src/instructions/user.rs @@ -70,8 +70,8 @@ use anchor_lang::solana_program::sysvar::instructions; use anchor_spl::associated_token::AssociatedToken; use borsh::{BorshDeserialize, BorshSerialize}; -pub fn handle_initialize_user<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, InitializeUser<'info>>, +pub fn handle_initialize_user<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, InitializeUser<'info>>, sub_account_id: u16, name: [u8; 32], ) -> Result<()> { @@ -184,8 +184,8 @@ pub fn handle_initialize_user<'a, 'b, 'c: 'info, 'info>( Ok(()) } -pub fn handle_initialize_user_stats<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, InitializeUserStats>, +pub fn handle_initialize_user_stats<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, InitializeUserStats>, ) -> Result<()> { let clock = Clock::get()?; @@ -249,8 +249,8 @@ pub fn handle_initialize_referrer_name( #[access_control( deposit_not_paused(&ctx.accounts.state) )] -pub fn handle_deposit<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, Deposit<'info>>, +pub fn handle_deposit<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, Deposit<'info>>, market_index: u16, amount: u64, reduce_only: bool, @@ -416,8 +416,8 @@ pub fn handle_deposit<'a, 'b, 'c: 'info, 'info>( #[access_control( withdraw_not_paused(&ctx.accounts.state) )] -pub fn handle_withdraw<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, Withdraw<'info>>, +pub fn handle_withdraw<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, Withdraw<'info>>, market_index: u16, amount: u64, reduce_only: bool, @@ -586,8 +586,8 @@ pub fn handle_withdraw<'a, 'b, 'c: 'info, 'info>( deposit_not_paused(&ctx.accounts.state) withdraw_not_paused(&ctx.accounts.state) )] -pub fn handle_transfer_deposit<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, TransferDeposit<'info>>, +pub fn handle_transfer_deposit<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, TransferDeposit<'info>>, market_index: u16, amount: u64, ) -> anchor_lang::Result<()> { @@ -790,8 +790,8 @@ pub fn handle_transfer_deposit<'a, 'b, 'c: 'info, 'info>( #[access_control( exchange_not_paused(&ctx.accounts.state) )] -pub fn handle_place_perp_order<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, PlaceOrder>, +pub fn handle_place_perp_order<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, PlaceOrder>, params: OrderParams, ) -> Result<()> { let clock = &Clock::get()?; @@ -835,8 +835,8 @@ pub fn handle_place_perp_order<'a, 'b, 'c: 'info, 'info>( #[access_control( exchange_not_paused(&ctx.accounts.state) )] -pub fn handle_cancel_order<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, CancelOrder>, +pub fn handle_cancel_order<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, CancelOrder>, order_id: Option, ) -> Result<()> { let clock = &Clock::get()?; @@ -874,8 +874,8 @@ pub fn handle_cancel_order<'a, 'b, 'c: 'info, 'info>( #[access_control( exchange_not_paused(&ctx.accounts.state) )] -pub fn handle_cancel_order_by_user_id<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, CancelOrder>, +pub fn handle_cancel_order_by_user_id<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, CancelOrder>, user_order_id: u8, ) -> Result<()> { let clock = &Clock::get()?; @@ -908,8 +908,8 @@ pub fn handle_cancel_order_by_user_id<'a, 'b, 'c: 'info, 'info>( #[access_control( exchange_not_paused(&ctx.accounts.state) )] -pub fn handle_cancel_orders_by_ids<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, CancelOrder>, +pub fn handle_cancel_orders_by_ids<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, CancelOrder>, order_ids: Vec, ) -> Result<()> { let clock = &Clock::get()?; @@ -944,8 +944,8 @@ pub fn handle_cancel_orders_by_ids<'a, 'b, 'c: 'info, 'info>( #[access_control( exchange_not_paused(&ctx.accounts.state) )] -pub fn handle_cancel_orders<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, CancelOrder<'info>>, +pub fn handle_cancel_orders<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, CancelOrder<'info>>, market_type: Option, market_index: Option, direction: Option, @@ -989,8 +989,8 @@ pub fn handle_cancel_orders<'a, 'b, 'c: 'info, 'info>( #[access_control( exchange_not_paused(&ctx.accounts.state) )] -pub fn handle_modify_order<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, CancelOrder<'info>>, +pub fn handle_modify_order<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, CancelOrder<'info>>, order_id: Option, modify_order_params: ModifyOrderParams, ) -> Result<()> { @@ -1031,8 +1031,8 @@ pub fn handle_modify_order<'a, 'b, 'c: 'info, 'info>( #[access_control( exchange_not_paused(&ctx.accounts.state) )] -pub fn handle_modify_order_by_user_order_id<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, CancelOrder<'info>>, +pub fn handle_modify_order_by_user_order_id<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, CancelOrder<'info>>, user_order_id: u8, modify_order_params: ModifyOrderParams, ) -> Result<()> { @@ -1068,8 +1068,8 @@ pub fn handle_modify_order_by_user_order_id<'a, 'b, 'c: 'info, 'info>( #[access_control( exchange_not_paused(&ctx.accounts.state) )] -pub fn handle_place_orders<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, PlaceOrder>, +pub fn handle_place_orders<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, PlaceOrder>, params: Vec, ) -> Result<()> { let clock = &Clock::get()?; @@ -1144,8 +1144,8 @@ pub fn handle_place_orders<'a, 'b, 'c: 'info, 'info>( #[access_control( fill_not_paused(&ctx.accounts.state) )] -pub fn handle_place_and_take_perp_order<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, PlaceAndTake<'info>>, +pub fn handle_place_and_take_perp_order<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, PlaceAndTake<'info>>, params: OrderParams, _maker_order_id: Option, ) -> Result<()> { @@ -1242,8 +1242,8 @@ pub fn handle_place_and_take_perp_order<'a, 'b, 'c: 'info, 'info>( #[access_control( fill_not_paused(&ctx.accounts.state) )] -pub fn handle_place_and_make_perp_order<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, PlaceAndMake<'info>>, +pub fn handle_place_and_make_perp_order<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, PlaceAndMake<'info>>, params: OrderParams, taker_order_id: u32, ) -> Result<()> { @@ -1339,8 +1339,8 @@ pub fn handle_place_and_make_perp_order<'a, 'b, 'c: 'info, 'info>( Ok(()) } -pub fn handle_place_spot_order<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, PlaceOrder>, +pub fn handle_place_spot_order<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, PlaceOrder>, params: OrderParams, ) -> Result<()> { let AccountMaps { @@ -1381,8 +1381,8 @@ pub fn handle_place_spot_order<'a, 'b, 'c: 'info, 'info>( #[access_control( fill_not_paused(&ctx.accounts.state) )] -pub fn handle_place_and_take_spot_order<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, PlaceAndTake<'info>>, +pub fn handle_place_and_take_spot_order<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, PlaceAndTake<'info>>, params: OrderParams, fulfillment_type: SpotFulfillmentType, maker_order_id: Option, @@ -1516,8 +1516,8 @@ pub fn handle_place_and_take_spot_order<'a, 'b, 'c: 'info, 'info>( #[access_control( fill_not_paused(&ctx.accounts.state) )] -pub fn handle_place_and_make_spot_order<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, PlaceAndMake<'info>>, +pub fn handle_place_and_make_spot_order<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, PlaceAndMake<'info>>, params: OrderParams, taker_order_id: u32, fulfillment_type: SpotFulfillmentType, @@ -1645,8 +1645,8 @@ pub fn handle_place_and_make_spot_order<'a, 'b, 'c: 'info, 'info>( #[access_control( amm_not_paused(&ctx.accounts.state) )] -pub fn handle_add_perp_lp_shares<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, AddRemoveLiquidity<'info>>, +pub fn handle_add_perp_lp_shares<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, AddRemoveLiquidity<'info>>, n_shares: u64, market_index: u16, ) -> Result<()> { @@ -1744,8 +1744,8 @@ pub fn handle_add_perp_lp_shares<'a, 'b, 'c: 'info, 'info>( Ok(()) } -pub fn handle_remove_perp_lp_shares_in_expiring_market<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, RemoveLiquidityInExpiredMarket<'info>>, +pub fn handle_remove_perp_lp_shares_in_expiring_market<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, RemoveLiquidityInExpiredMarket<'info>>, shares_to_burn: u64, market_index: u16, ) -> Result<()> { @@ -1797,8 +1797,8 @@ pub fn handle_remove_perp_lp_shares_in_expiring_market<'a, 'b, 'c: 'info, 'info> #[access_control( amm_not_paused(&ctx.accounts.state) )] -pub fn handle_remove_perp_lp_shares<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, AddRemoveLiquidity<'info>>, +pub fn handle_remove_perp_lp_shares<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, AddRemoveLiquidity<'info>>, shares_to_burn: u64, market_index: u16, ) -> Result<()> { @@ -1857,8 +1857,8 @@ pub fn handle_update_user_custom_margin_ratio( Ok(()) } -pub fn handle_update_user_margin_trading_enabled<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, UpdateUser<'info>>, +pub fn handle_update_user_margin_trading_enabled<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, UpdateUser<'info>>, _sub_account_id: u16, margin_trading_enabled: bool, ) -> Result<()> { @@ -2381,8 +2381,8 @@ pub struct Swap<'info> { #[access_control( fill_not_paused(&ctx.accounts.state) )] -pub fn handle_begin_swap<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, Swap<'info>>, +pub fn handle_begin_swap<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, Swap<'info>>, in_market_index: u16, out_market_index: u16, amount_in: u64, @@ -2631,8 +2631,8 @@ pub enum SwapReduceOnly { #[access_control( fill_not_paused(&ctx.accounts.state) )] -pub fn handle_end_swap<'a, 'b, 'c: 'info, 'info>( - ctx: Context<'a, 'b, 'c, 'info, Swap<'info>>, +pub fn handle_end_swap<'c: 'info, 'info>( + ctx: Context<'_, '_, 'c, 'info, Swap<'info>>, in_market_index: u16, out_market_index: u16, limit_price: Option,