File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ use crate::instructions::optional_accounts::{
3232} ;
3333use crate :: instructions:: SpotFulfillmentType ;
3434use crate :: math:: casting:: Cast ;
35+ use crate :: math:: constants:: GOV_SPOT_MARKET_INDEX ;
3536use crate :: math:: liquidation:: is_user_being_liquidated;
3637use crate :: math:: margin:: calculate_margin_requirement_and_total_collateral_and_liability_info;
3738use crate :: math:: margin:: meets_initial_margin_requirement;
@@ -852,6 +853,10 @@ pub fn handle_withdraw<'c: 'info, 'info>(
852853
853854 spot_market. validate_max_token_deposits_and_borrows ( is_borrow) ?;
854855
856+ if spot_market. market_index == GOV_SPOT_MARKET_INDEX && user_stats. gov_stake_sub_account_active ( ) ? {
857+ user_stats. update_gov_stake ( ) ?;
858+ }
859+
855860 Ok ( ( ) )
856861}
857862
Original file line number Diff line number Diff line change @@ -1654,7 +1654,8 @@ pub struct UserStats {
16541654 /// Second bit: 1 if user was referred, 0 otherwise
16551655 pub referrer_status : u8 ,
16561656 pub disable_update_perp_bid_ask_twap : bool ,
1657- pub padding1 : [ u8 ; 1 ] ,
1657+ // use user subaccount for if_staked_gov_token_amount value (-1 is sub_account 0)
1658+ pub gov_stake_sub_account : i8 ,
16581659 /// whether the user has a FuelOverflow account
16591660 pub fuel_overflow_status : u8 ,
16601661 /// accumulated fuel for token amounts of insurance
You can’t perform that action at this time.
0 commit comments